diff options
author | Ted Gould <ted@gould.cx> | 2011-04-12 21:59:57 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-04-12 21:59:57 -0500 |
commit | 418154c793a62115eff24209d8fd8cc841d860b8 (patch) | |
tree | 9f128c6c827cdd495f8800b9d774b7595d3bd35d /libdbusmenu-gtk/menu.c | |
parent | 7036d1a97f6783b8d57243e76d5efa3126d88ec6 (diff) | |
parent | c8dd7726fb7f906de80ce0790662f568a24f963c (diff) | |
download | libdbusmenu-418154c793a62115eff24209d8fd8cc841d860b8.tar.gz libdbusmenu-418154c793a62115eff24209d8fd8cc841d860b8.tar.bz2 libdbusmenu-418154c793a62115eff24209d8fd8cc841d860b8.zip |
Changing the cleanup of GTK Menuitems to avoid undefined references.
Diffstat (limited to 'libdbusmenu-gtk/menu.c')
-rw-r--r-- | libdbusmenu-gtk/menu.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libdbusmenu-gtk/menu.c b/libdbusmenu-gtk/menu.c index 0b31069..236a596 100644 --- a/libdbusmenu-gtk/menu.c +++ b/libdbusmenu-gtk/menu.c @@ -329,6 +329,18 @@ remove_child_signals (gpointer data, gpointer user_data) return; } +/* Handler for all of the menu items on a root change to ensure that + the menus are hidden before we start going and deleting things. */ +static void +popdown_all (DbusmenuMenuitem * mi, gpointer user_data) +{ + GtkMenu * menu = dbusmenu_gtkclient_menuitem_get_submenu(DBUSMENU_GTKCLIENT(user_data), mi); + if (menu != NULL) { + gtk_menu_popdown(menu); + } + return; +} + /* When the root menuitem changes we need to resetup things so that we're back in the game. */ static void @@ -344,6 +356,8 @@ root_changed (DbusmenuGtkClient * client, DbusmenuMenuitem * newroot, DbusmenuGt g_signal_handlers_disconnect_by_func(G_OBJECT(priv->root), root_child_moved, menu); g_signal_handlers_disconnect_by_func(G_OBJECT(priv->root), root_child_delete, menu); + dbusmenu_menuitem_foreach(priv->root, popdown_all, client); + g_object_unref(priv->root); priv->root = NULL; } |