diff options
-rw-r--r-- | libdbusmenu-glib/client.c | 16 | ||||
-rw-r--r-- | libdbusmenu-glib/menuitem.c | 4 |
2 files changed, 15 insertions, 5 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index bb2f588..d8bacea 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -265,19 +265,21 @@ parse_node_get_id (xmlNodePtr node) { if (g_strcmp0((gchar *)node->name, "menu") != 0) { /* This kills some nodes early */ + g_warning("XML Node is not 'menu' it is '%s'", node->name); return 0; } xmlAttrPtr attrib; - for (attrib = node->properties; node != NULL; node = node->next) { - if (g_strcmp0((gchar *)node->name, "id") == 0) { - if (node->children != NULL) { + for (attrib = node->properties; attrib != NULL; attrib = attrib->next) { + if (g_strcmp0((gchar *)attrib->name, "id") == 0) { + if (attrib->children != NULL) { return (guint)g_ascii_strtoull((gchar *)attrib->children->content, NULL, 10); } break; } } + g_warning("Unable to find an ID on the node"); return 0; } @@ -287,7 +289,7 @@ static DbusmenuMenuitem * parse_layout_xml(xmlNodePtr node, DbusmenuMenuitem * item, DbusmenuMenuitem * parent) { guint id = parse_node_get_id(node); - if (item == NULL || dbusmenu_menuitem_get_id(item) != id) { + if (item == NULL || dbusmenu_menuitem_get_id(item) != id || id == 0) { if (item != NULL) { if (parent != NULL) { dbusmenu_menuitem_child_delete(parent, item); @@ -295,6 +297,11 @@ parse_layout_xml(xmlNodePtr node, DbusmenuMenuitem * item, DbusmenuMenuitem * pa g_object_unref(G_OBJECT(item)); } + if (id == 0) { + g_warning("ID from XML file is zero"); + return NULL; + } + /* Build a new item */ item = dbusmenu_menuitem_new_with_id(id); } @@ -354,6 +361,7 @@ update_layout_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data) parse_layout(client, xml); priv->layoutcall = NULL; + g_debug("Root is now: 0x%X", (unsigned int)priv->root); g_signal_emit(G_OBJECT(client), signals[LAYOUT_UPDATED], 0, TRUE); return; diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index c571fd4..0aff2d8 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -126,7 +126,9 @@ dbusmenu_menuitem_new (void) DbusmenuMenuitem * dbusmenu_menuitem_new_with_id (guint id) { - return g_object_new(DBUSMENU_TYPE_MENUITEM, "id", id, NULL); + DbusmenuMenuitem * mi = g_object_new(DBUSMENU_TYPE_MENUITEM, "id", id, NULL); + g_debug("New Menuitem id %d goal id %d", dbusmenu_menuitem_get_id(mi), id); + return mi; } guint |