diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2013-05-02 13:57:54 -0700 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2013-05-02 13:57:54 -0700 |
commit | 864cd6288c13bcbd387872de0ceea6bb8679efdf (patch) | |
tree | 348955ab165fc5a38fc1e2fc0cc7ed817b9f3972 | |
parent | 7453a4ef0ecd0e44b8296899f3021587e8110f4e (diff) | |
download | libdbusmenu-864cd6288c13bcbd387872de0ceea6bb8679efdf.tar.gz libdbusmenu-864cd6288c13bcbd387872de0ceea6bb8679efdf.tar.bz2 libdbusmenu-864cd6288c13bcbd387872de0ceea6bb8679efdf.zip |
in dispose(), call gtk_widget_remove_accelerator(), to balance out the earlier calls to gtk_widget_add_accelerator()
-rw-r--r-- | libdbusmenu-gtk/client.c | 29 |
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 */ |