diff options
| author | Ken VanDine <ken.vandine@canonical.com> | 2009-09-10 10:45:11 -0400 |
|---|---|---|
| committer | Ken VanDine <ken.vandine@canonical.com> | 2009-09-10 10:45:11 -0400 |
| commit | 3d4b7669a7651b6bb3ec7abce32b0d3c3c991e53 (patch) | |
| tree | b287f9b23b3cbf5f8c409fc4b64ea23d18da28a4 /libdbusmenu-gtk/menu.c | |
| parent | 5d4e3baf6c858f34e31c16df2b1239bd520e8b72 (diff) | |
| parent | 7f80787492d57defe7c95144ab30661f91374c49 (diff) | |
| download | libdbusmenu-3d4b7669a7651b6bb3ec7abce32b0d3c3c991e53.tar.gz libdbusmenu-3d4b7669a7651b6bb3ec7abce32b0d3c3c991e53.tar.bz2 libdbusmenu-3d4b7669a7651b6bb3ec7abce32b0d3c3c991e53.zip | |
* Upstream update 0.1.3 (LP: #427360)
* Fixes reordering of menu item issue
Diffstat (limited to 'libdbusmenu-gtk/menu.c')
| -rw-r--r-- | libdbusmenu-gtk/menu.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/libdbusmenu-gtk/menu.c b/libdbusmenu-gtk/menu.c index 74e1bec..5bcf0a1 100644 --- a/libdbusmenu-gtk/menu.c +++ b/libdbusmenu-gtk/menu.c @@ -185,6 +185,9 @@ get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec) /* Internal Functions */ +/* Called when a new child of the root item is + added. Sets up a signal for when it's actually + realized. */ static void root_child_added (DbusmenuMenuitem * root, DbusmenuMenuitem * child, guint position, DbusmenuGtkMenu * menu) { @@ -193,6 +196,8 @@ root_child_added (DbusmenuMenuitem * root, DbusmenuMenuitem * child, guint posit return; } +/* When one of the children move we need to react to that and + move it on the GTK side as well. */ static void root_child_moved (DbusmenuMenuitem * root, DbusmenuMenuitem * child, guint newposition, guint oldposition, DbusmenuGtkMenu * menu) { @@ -202,6 +207,7 @@ root_child_moved (DbusmenuMenuitem * root, DbusmenuMenuitem * child, guint newpo return; } +/* When a root child item disappears. */ static void root_child_delete (DbusmenuMenuitem * root, DbusmenuMenuitem * child, DbusmenuGtkMenu * menu) { @@ -212,6 +218,8 @@ root_child_delete (DbusmenuMenuitem * root, DbusmenuMenuitem * child, DbusmenuGt return; } +/* Called when the child is realized, and thus has all of it's + properties and GTK-isms. We can put it in our menu here. */ static void child_realized (DbusmenuMenuitem * child, gpointer userdata) { @@ -220,10 +228,20 @@ child_realized (DbusmenuMenuitem * child, gpointer userdata) DbusmenuGtkMenu * menu = DBUSMENU_GTKMENU(userdata); DbusmenuGtkMenuPrivate * priv = DBUSMENU_GTKMENU_GET_PRIVATE(menu); - gtk_menu_append(menu, GTK_WIDGET(dbusmenu_gtkclient_menuitem_get(priv->client, child))); + GtkWidget * child_widget = GTK_WIDGET(dbusmenu_gtkclient_menuitem_get(priv->client, child)); + + if (child_widget != NULL) { + gtk_menu_append(menu, child_widget); + gtk_menu_reorder_child(GTK_MENU(menu), child_widget, dbusmenu_menuitem_get_position(child, dbusmenu_client_get_root(DBUSMENU_CLIENT(priv->client)))); + } else { + g_warning("Child is realized, but doesn't have a GTK Widget!"); + } + return; } +/* When the root menuitem changes we need to resetup things so that + we're back in the game. */ static void root_changed (DbusmenuGtkClient * client, DbusmenuMenuitem * newroot, DbusmenuGtkMenu * menu) { if (newroot == NULL) { |
