[gnome-panel] status-notifier: avoid activation loop on toggle items
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] status-notifier: avoid activation loop on toggle items
- Date: Tue, 20 Dec 2016 15:01:25 +0000 (UTC)
commit 87db48b84b24620d75832bd2fe4cf049366f6232
Author: Colomban Wendling <cwendling hypra fr>
Date: Mon Dec 19 15:30:56 2016 +0100
status-notifier: avoid activation loop on toggle items
Do not send the activation signal in response to state synchronization
not to create an infinite loop between the application and the item.
https://bugzilla.gnome.org/show_bug.cgi?id=776278
.../external/status-notifier/sn-dbus-menu-item.c | 4 ++++
.../external/status-notifier/sn-dbus-menu-item.h | 2 ++
modules/external/status-notifier/sn-dbus-menu.c | 4 +++-
3 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/modules/external/status-notifier/sn-dbus-menu-item.c
b/modules/external/status-notifier/sn-dbus-menu-item.c
index e3ccbae..3e740b1 100644
--- a/modules/external/status-notifier/sn-dbus-menu-item.c
+++ b/modules/external/status-notifier/sn-dbus-menu-item.c
@@ -369,10 +369,14 @@ sn_dbus_menu_item_update_props (SnDBusMenuItem *item,
check = GTK_CHECK_MENU_ITEM (item->item);
+ g_signal_handler_block (item->item, item->activate_id);
+
if (item->toggle_state == 1)
gtk_check_menu_item_set_active (check, TRUE);
else if (item->toggle_state == 0)
gtk_check_menu_item_set_active (check, FALSE);
+
+ g_signal_handler_unblock (item->item, item->activate_id);
}
}
else if (g_strcmp0 (prop, "type") == 0)
diff --git a/modules/external/status-notifier/sn-dbus-menu-item.h
b/modules/external/status-notifier/sn-dbus-menu-item.h
index a5ff995..c89de5c 100644
--- a/modules/external/status-notifier/sn-dbus-menu-item.h
+++ b/modules/external/status-notifier/sn-dbus-menu-item.h
@@ -45,6 +45,8 @@ typedef struct
GtkWidget *item;
GtkMenu *submenu;
+
+ gulong activate_id;
} SnDBusMenuItem;
SnDBusMenuItem *sn_dbus_menu_item_new (GVariant *props);
diff --git a/modules/external/status-notifier/sn-dbus-menu.c b/modules/external/status-notifier/sn-dbus-menu.c
index aa3d7e7..9cbab34 100644
--- a/modules/external/status-notifier/sn-dbus-menu.c
+++ b/modules/external/status-notifier/sn-dbus-menu.c
@@ -101,7 +101,9 @@ layout_update_item (SnDBusMenu *menu,
g_object_set_data (G_OBJECT (item->item), "item-id", GUINT_TO_POINTER (id));
gtk_menu_shell_append (GTK_MENU_SHELL (gtk_menu), item->item);
- g_signal_connect (item->item, "activate", G_CALLBACK (activate_cb), menu);
+
+ item->activate_id = g_signal_connect (item->item, "activate",
+ G_CALLBACK (activate_cb), menu);
g_hash_table_replace (menu->items, GUINT_TO_POINTER (id), item);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]