diff options
author | Robert Tari <robert@tari.in> | 2020-09-16 15:39:07 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2020-09-27 15:44:54 +0200 |
commit | 6a4bf3d40364bcac5b8a5b4a5bd701544f5b2863 (patch) | |
tree | d7b8a7985df1c4b808818b43471848d80bb81de3 /src/idoswitchmenuitem.c | |
parent | 7ed68c1550b1c2b24c2c2a0dc33a6784837aaf85 (diff) | |
download | ayatana-ido-6a4bf3d40364bcac5b8a5b4a5bd701544f5b2863.tar.gz ayatana-ido-6a4bf3d40364bcac5b8a5b4a5bd701544f5b2863.tar.bz2 ayatana-ido-6a4bf3d40364bcac5b8a5b4a5bd701544f5b2863.zip |
idoswitchmenuitem.c: Pass the switch activation state in the action signal
Diffstat (limited to 'src/idoswitchmenuitem.c')
-rw-r--r-- | src/idoswitchmenuitem.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/idoswitchmenuitem.c b/src/idoswitchmenuitem.c index 5a068f4..c33e6ee 100644 --- a/src/idoswitchmenuitem.c +++ b/src/idoswitchmenuitem.c @@ -224,6 +224,14 @@ ido_source_menu_item_state_changed (IdoActionHelper *helper, g_variant_get_boolean (state)); } +static void ido_switch_menu_item_activate(IdoSwitchMenuItem *self, gpointer user_data) +{ + IdoActionHelper *helper = user_data; + IdoSwitchMenuItemPrivate *priv = ido_switch_menu_item_get_instance_private(self); + gboolean active = gtk_switch_get_active(GTK_SWITCH(priv->switch_w)); + ido_action_helper_activate_with_parameter(helper, g_variant_new_boolean(active)); +} + GtkMenuItem * ido_switch_menu_item_new_from_menu_model (GMenuItem *menuitem, GActionGroup *actions) @@ -263,9 +271,7 @@ ido_switch_menu_item_new_from_menu_model (GMenuItem *menuitem, helper = ido_action_helper_new (GTK_WIDGET (item), actions, action, NULL); g_signal_connect (helper, "action-state-changed", G_CALLBACK (ido_source_menu_item_state_changed), item); - g_signal_connect_object (item, "activate", - G_CALLBACK (ido_action_helper_activate), helper, - G_CONNECT_SWAPPED); + g_signal_connect(item, "activate", G_CALLBACK(ido_switch_menu_item_activate), helper); g_signal_connect_swapped (item, "destroy", G_CALLBACK (g_object_unref), helper); g_free (action); |