diff options
author | Ted Gould <ted@gould.cx> | 2012-02-07 10:29:36 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2012-02-07 10:29:36 -0600 |
commit | 815d4e6515e6c17da0c130f8a4a351d7d59ebca0 (patch) | |
tree | bd928c604dfb8fae99b0b7d48e2541f33155f66e | |
parent | 2b28772d5c86fc4784045c1c65325558ea6a08f3 (diff) | |
download | libdbusmenu-815d4e6515e6c17da0c130f8a4a351d7d59ebca0.tar.gz libdbusmenu-815d4e6515e6c17da0c130f8a4a351d7d59ebca0.tar.bz2 libdbusmenu-815d4e6515e6c17da0c130f8a4a351d7d59ebca0.zip |
Ensuring that we don't just unparent a menu item, we remove it from the list of children that it has
-rw-r--r-- | libdbusmenu-gtk/parser.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index 0ecfa1e..ac69b2a 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -415,8 +415,11 @@ parse_menu_structure_helper (GtkWidget * widget, RecurseContext * recurse) /* Oops, let's tell our parents about us */ if (peek == NULL) { - if (dbusmenu_menuitem_get_parent(thisitem) != NULL) { - dbusmenu_menuitem_unparent(thisitem); + g_object_ref(thisitem); + + DbusmenuMenuitem * parent = dbusmenu_menuitem_get_parent(thisitem); + if (parent != NULL) { + dbusmenu_menuitem_child_delete(parent, thisitem); } gint pos = get_child_position (widget); @@ -427,6 +430,8 @@ parse_menu_structure_helper (GtkWidget * widget, RecurseContext * recurse) else dbusmenu_menuitem_child_append (recurse->parent, thisitem); + + g_object_unref(thisitem); } } |