Commit 3d6c9913d8a3508b2465d872276bb4950d9a4423

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

Fixing v3270 state methods.

Showing 1 changed file with 16 additions and 10 deletions   Show diff stats
src/terminal/actions/action.c
@@ -255,7 +255,8 @@ @@ -255,7 +255,8 @@
255 } 255 }
256 256
257 void v3270_action_notify_state(GAction *action) { 257 void v3270_action_notify_state(GAction *action) {
258 - g_idle_add((GSourceFunc) bg_notify_state, G_OBJECT(action)); 258 + if(V3270_ACTION_GET_CLASS(action)->type.state)
  259 + g_idle_add((GSourceFunc) bg_notify_state, G_OBJECT(action));
259 } 260 }
260 261
261 static void event_listener(H3270 G_GNUC_UNUSED(*hSession), void *object) { 262 static void event_listener(H3270 G_GNUC_UNUSED(*hSession), void *object) {
@@ -402,17 +403,22 @@ @@ -402,17 +403,22 @@
402 403
403 GVariant * iface_get_state(GAction *object) { 404 GVariant * iface_get_state(GAction *object) {
404 405
405 - GtkWidget * terminal = V3270_ACTION(object)->terminal;  
406 - GVariant * state; 406 + GVariant * state = NULL;
407 407
408 - if(terminal) {  
409 - state = V3270_ACTION_GET_CLASS(object)->get_state(object,terminal);  
410 - } else {  
411 - state = g_variant_new_boolean(FALSE);  
412 - } 408 + if(V3270_ACTION_GET_CLASS(object)->type.state) {
  409 +
  410 + GtkWidget * terminal = V3270_ACTION(object)->terminal;
  411 +
  412 + if(terminal) {
  413 + state = V3270_ACTION_GET_CLASS(object)->get_state(object,terminal);
  414 + } else {
  415 + state = g_variant_new_boolean(FALSE);
  416 + }
  417 +
  418 + if(state)
  419 + g_variant_ref(state);
413 420
414 - if(state)  
415 - g_variant_ref(state); 421 + }
416 422
417 return state; 423 return state;
418 424