From 815d4e6515e6c17da0c130f8a4a351d7d59ebca0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 7 Feb 2012 10:29:36 -0600 Subject: Ensuring that we don't just unparent a menu item, we remove it from the list of children that it has --- libdbusmenu-gtk/parser.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-gtk') 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); } } -- cgit v1.2.3 From 00fd5940d07b27ccf3385b021145c72c2317e87b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 7 Feb 2012 10:29:57 -0600 Subject: Don't get the string to check if something is being cleared, use whether the variant is NULL or not --- libdbusmenu-gtk/client.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'libdbusmenu-gtk') diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 9888cbe..38f2283 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -1128,12 +1128,7 @@ image_property_handle (DbusmenuMenuitem * item, const gchar * property, GVariant return; } - const gchar * value = NULL; - if (variant != NULL) { - value = g_variant_get_string(variant, NULL); - } - - if (value == NULL || value[0] == '\0') { + if (variant == NULL) { /* This means that we're unsetting a value. */ /* Try to use the other one */ if (g_strcmp0(property, DBUSMENU_MENUITEM_PROP_ICON_NAME)) { -- cgit v1.2.3