ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #02080
[Branch ~dbusmenu-team/dbusmenu/trunk] Rev 149: Makes the layout handle commend nodes better (and thus the KDE layouts).
Merge authors:
Ted Gould (ted)
Related merge proposals:
https://code.launchpad.net/~ted/dbusmenu/fixing-qt-layout/+merge/32777
proposed by: Ted Gould (ted)
review: Approve - Aurélien Gâteau (agateau)
------------------------------------------------------------
revno: 149 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-08-17 11:02:45 -0500
message:
Makes the layout handle commend nodes better (and thus the KDE layouts).
modified:
libdbusmenu-glib/client.c
--
lp:dbusmenu
https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk
Your team ayatana-commits is subscribed to branch lp:dbusmenu.
To unsubscribe from this branch go to https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk/+edit-subscription
=== modified file 'libdbusmenu-glib/client.c'
--- libdbusmenu-glib/client.c 2010-07-20 20:20:21 +0000
+++ libdbusmenu-glib/client.c 2010-08-16 15:59:53 +0000
@@ -1126,6 +1126,9 @@
/* g_debug("Looking at child: %d", position); */
gint childid = parse_node_get_id(children);
if (childid < 0) {
+ /* Don't increment the position when there isn't a valid
+ node in the XML tree. It's probably a comment. */
+ position--;
continue;
}
DbusmenuMenuitem * childmi = NULL;
@@ -1143,11 +1146,17 @@
}
if (childmi == NULL) {
+ #ifdef MASSIVEDEBUGGING
+ g_debug("Building new menu item %d at position %d", childid, position);
+ #endif
/* If we can't recycle, then we build a new one */
childmi = parse_layout_new_child(childid, client, item);
dbusmenu_menuitem_child_add_position(item, childmi, position);
g_object_unref(childmi);
} else {
+ #ifdef MASSIVEDEBUGGING
+ g_debug("Recycling menu item %d at position %d", childid, position);
+ #endif
/* If we can recycle, make sure it's in the right place */
dbusmenu_menuitem_child_reorder(item, childmi, position);
parse_layout_update(childmi, client);
@@ -1175,6 +1184,19 @@
children = node->children;
GList * childmis = dbusmenu_menuitem_get_children(item);
while (children != NULL && childmis != NULL) {
+ gint xmlid = parse_node_get_id(children);
+ /* If this isn't a valid menu item we need to move on
+ until we have one. This avoids things like comments. */
+ if (xmlid < 0) {
+ children = children->next;
+ continue;
+ }
+
+ #ifdef MASSIVEDEBUGGING
+ gint miid = dbusmenu_menuitem_get_id(DBUSMENU_MENUITEM(childmis->data));
+ g_debug("Recursing parse_layout_xml. XML ID: %d MI ID: %d", xmlid, miid);
+ #endif
+
parse_layout_xml(client, children, DBUSMENU_MENUITEM(childmis->data), item, proxy);
children = children->next;