Commit b27ded845a98509ea636774461901d5c454a84f7

Authored by Perry Werneck
1 parent bb2bf461
Exists in master and in 1 other branch develop

Fixing boolean properties.

src/linux/getproperties.c
... ... @@ -64,7 +64,7 @@ ipc3270_get_property (GDBusConnection *connection,
64 64 debug("%s=%d",property_name,value);
65 65  
66 66 if(value > 0 || errno == 0) {
67   - return g_variant_new_int16((gint16) value);
  67 + return g_variant_new_boolean(value != 0);
68 68 }
69 69  
70 70 // Erro!
... ... @@ -137,7 +137,7 @@ ipc3270_get_property (GDBusConnection *connection,
137 137 if(toggle != (LIB3270_TOGGLE) -1) {
138 138  
139 139 // Is a Tn3270 toggle, get it!
140   - return g_variant_new_int16((gint16) lib3270_get_toggle( (IPC3270(user_data)->hSession), toggle));
  140 + return g_variant_new_boolean(lib3270_get_toggle( (IPC3270(user_data)->hSession), toggle) != 0);
141 141  
142 142 }
143 143  
... ...
src/linux/setproperties.c
... ... @@ -59,7 +59,7 @@ ipc3270_set_property (GDBusConnection *connection,
59 59 if(boolprop[ix].set && !g_ascii_strcasecmp(boolprop[ix].name, property_name)) {
60 60  
61 61 // Found it!
62   - if(boolprop[ix].set(IPC3270(user_data)->hSession, (int) g_variant_get_int32(value))) {
  62 + if(boolprop[ix].set(IPC3270(user_data)->hSession, (int) (g_variant_get_boolean(value) ? 1 : 0))) {
63 63  
64 64 // Erro!
65 65 g_set_error (error,
... ... @@ -84,7 +84,7 @@ ipc3270_set_property (GDBusConnection *connection,
84 84 if(intprop[ix].set && !g_ascii_strcasecmp(intprop[ix].name, property_name)) {
85 85  
86 86 // Found it!
87   - if(intprop[ix].set(IPC3270(user_data)->hSession, (int) g_variant_get_int32(value))) {
  87 + if(intprop[ix].set(IPC3270(user_data)->hSession, (int) (g_variant_get_boolean(value) ? 1 : 0))) {
88 88  
89 89 // Erro!
90 90 g_set_error (error,
... ...