aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2020-09-16 15:39:07 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2020-10-21 13:14:50 +0200
commiteaa7ce5d2b3d567901c102a3d706a641928e3a59 (patch)
treeafc0dbf37975a0ef67a115b89a70d98c223a13b1 /src
parentf96d98c74329602120c1c4cff57f31aedaa16234 (diff)
downloadayatana-ido-eaa7ce5d2b3d567901c102a3d706a641928e3a59.tar.gz
ayatana-ido-eaa7ce5d2b3d567901c102a3d706a641928e3a59.tar.bz2
ayatana-ido-eaa7ce5d2b3d567901c102a3d706a641928e3a59.zip
idoswitchmenuitem.c: Pass the switch activation state in the action signal
Diffstat (limited to 'src')
-rw-r--r--src/idoswitchmenuitem.c12
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);