From 3d6c9913d8a3508b2465d872276bb4950d9a4423 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Tue, 31 Dec 2019 09:42:39 -0300 Subject: [PATCH] Fixing v3270 state methods. --- src/terminal/actions/action.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/terminal/actions/action.c b/src/terminal/actions/action.c index f9cf6d2..5d84bf4 100644 --- a/src/terminal/actions/action.c +++ b/src/terminal/actions/action.c @@ -255,7 +255,8 @@ } void v3270_action_notify_state(GAction *action) { - g_idle_add((GSourceFunc) bg_notify_state, G_OBJECT(action)); + if(V3270_ACTION_GET_CLASS(action)->type.state) + g_idle_add((GSourceFunc) bg_notify_state, G_OBJECT(action)); } static void event_listener(H3270 G_GNUC_UNUSED(*hSession), void *object) { @@ -402,17 +403,22 @@ GVariant * iface_get_state(GAction *object) { - GtkWidget * terminal = V3270_ACTION(object)->terminal; - GVariant * state; + GVariant * state = NULL; - if(terminal) { - state = V3270_ACTION_GET_CLASS(object)->get_state(object,terminal); - } else { - state = g_variant_new_boolean(FALSE); - } + if(V3270_ACTION_GET_CLASS(object)->type.state) { + + GtkWidget * terminal = V3270_ACTION(object)->terminal; + + if(terminal) { + state = V3270_ACTION_GET_CLASS(object)->get_state(object,terminal); + } else { + state = g_variant_new_boolean(FALSE); + } + + if(state) + g_variant_ref(state); - if(state) - g_variant_ref(state); + } return state; -- libgit2 0.21.2