aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-05-15 11:42:47 +0000
committerTarmac <Unknown>2013-05-15 11:42:47 +0000
commitbd1ae9506dc767b2fb20f381e786afb846f9a85e (patch)
tree348955ab165fc5a38fc1e2fc0cc7ed817b9f3972 /libdbusmenu-gtk
parent7453a4ef0ecd0e44b8296899f3021587e8110f4e (diff)
parent864cd6288c13bcbd387872de0ceea6bb8679efdf (diff)
downloadlibdbusmenu-bd1ae9506dc767b2fb20f381e786afb846f9a85e.tar.gz
libdbusmenu-bd1ae9506dc767b2fb20f381e786afb846f9a85e.tar.bz2
libdbusmenu-bd1ae9506dc767b2fb20f381e786afb846f9a85e.zip
In gtkclient's destructor, balance client's earlier gtk_widget_add_accelerator() calls with gtk_widget_remove_accelerator() calls. Fixes: https://bugs.launchpad.net/bugs/1173262.
Approved by Mathieu Trudel-Lapierre, PS Jenkins bot.
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/client.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c
index 8e84e3d..6ccb81d 100644
--- a/libdbusmenu-gtk/client.c
+++ b/libdbusmenu-gtk/client.c
@@ -130,16 +130,32 @@ dbusmenu_gtkclient_init (DbusmenuGtkClient *self)
return;
}
+static void
+clear_shortcut_foreach (DbusmenuMenuitem *mi, gpointer gclient)
+{
+ guint key = 0;
+ GtkMenuItem * gmi;
+ GdkModifierType mod = 0;
+ DbusmenuGtkClient * client = DBUSMENU_GTKCLIENT (gclient);
+
+ gmi = dbusmenu_gtkclient_menuitem_get (client, mi);
+ dbusmenu_gtkclient_menuitem_get (client, mi);
+ dbusmenu_menuitem_property_get_shortcut (mi, &key, &mod);
+ if (key)
+ gtk_widget_remove_accelerator (GTK_WIDGET (gmi), client->priv->agroup, key, mod);
+}
+
/* Just calling the super class. Future use. */
static void
dbusmenu_gtkclient_dispose (GObject *object)
{
- DbusmenuGtkClientPrivate * priv = DBUSMENU_GTKCLIENT_GET_PRIVATE(object);
+ DbusmenuMenuitem * root;
+ DbusmenuGtkClientPrivate * priv = DBUSMENU_GTKCLIENT(object)->priv;
- if (priv->agroup != NULL) {
- g_object_unref(priv->agroup);
- priv->agroup = NULL;
- }
+ if ((root = dbusmenu_client_get_root (DBUSMENU_CLIENT(object))))
+ dbusmenu_menuitem_foreach (root, clear_shortcut_foreach, object);
+ g_message ("hello world 6");
+ g_clear_object (&priv->agroup);
if (priv->old_themedirs) {
remove_theme_dirs(gtk_icon_theme_get_default(), priv->old_themedirs);
@@ -161,7 +177,6 @@ dbusmenu_gtkclient_dispose (GObject *object)
static void
dbusmenu_gtkclient_finalize (GObject *object)
{
-
G_OBJECT_CLASS (dbusmenu_gtkclient_parent_class)->finalize (object);
return;
}
@@ -361,8 +376,6 @@ do_swap_agroup (DbusmenuMenuitem * mi, gpointer userdata) {
static void
swap_agroup (DbusmenuMenuitem *mi, gpointer userdata) {
do_swap_agroup (mi, userdata);
-
- return; /* See what I did here, Ted? :) */
}
/* Refresh the shortcut for an entry */