aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib/client.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-07-20 13:55:10 -0500
committerTed Gould <ted@gould.cx>2010-07-20 13:55:10 -0500
commit7180f1940bfa95ed9cc7d06a38ed8e459b8aa18f (patch)
treecf6eff59a215963049fd945ec37343c1499c351d /libdbusmenu-glib/client.c
parent88f54f11f9020b5ade4cc4e7b8df2d9f24b83622 (diff)
downloadlibdbusmenu-7180f1940bfa95ed9cc7d06a38ed8e459b8aa18f.tar.gz
libdbusmenu-7180f1940bfa95ed9cc7d06a38ed8e459b8aa18f.tar.bz2
libdbusmenu-7180f1940bfa95ed9cc7d06a38ed8e459b8aa18f.zip
Switching to the assumption that the item is made before calling parse_layout_xml(), and making it true.
Diffstat (limited to 'libdbusmenu-glib/client.c')
-rw-r--r--libdbusmenu-glib/client.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c
index 5b9e406..e9a4e59 100644
--- a/libdbusmenu-glib/client.c
+++ b/libdbusmenu-glib/client.c
@@ -1089,20 +1089,9 @@ parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * it
#ifdef MASSIVEDEBUGGING
g_debug("Client looking at node with id: %d", id);
#endif
- /* If we don't have any item, or the IDs don't match */
- if (item == NULL || dbusmenu_menuitem_get_id(item) != id) {
- if (item != NULL) {
- if (parent != NULL) {
- dbusmenu_menuitem_child_delete(parent, item);
- }
- item = NULL;
- }
- /* Build a new item */
- item = parse_layout_new_child(id, client, parent);
- } else {
- parse_layout_update(item, client);
- }
+ g_return_val_if_fail(item != NULL, NULL);
+ g_return_val_if_fail(id == dbusmenu_menuitem_get_id(item), NULL);
xmlNodePtr children;
guint position;
@@ -1133,6 +1122,7 @@ parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * it
g_object_unref(childmi);
} else {
dbusmenu_menuitem_child_reorder(item, childmi, position);
+ parse_layout_update(childmi, client);
}
parse_layout_xml(client, children, childmi, item, proxy);
@@ -1175,6 +1165,10 @@ parse_layout (DbusmenuClient * client, const gchar * layout)
DbusmenuMenuitem * oldroot = priv->root;
+ if (priv->root == NULL) {
+ priv->root = parse_layout_new_child(0, client, NULL);
+ }
+
priv->root = parse_layout_xml(client, root, priv->root, NULL, priv->menuproxy);
xmlFreeDoc(xmldoc);