aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-01-21 15:57:18 -0600
committerTed Gould <ted@gould.cx>2010-01-21 15:57:18 -0600
commitaec55f7fae016a6d25f675a02ff42c981ec80c04 (patch)
tree1190d4256d82e8015fdae2d77ff027e8ea18c9b5 /libdbusmenu-glib
parent438443e863be28a23c9494281a2a10bea6a9b6fc (diff)
downloadlibdbusmenu-aec55f7fae016a6d25f675a02ff42c981ec80c04.tar.gz
libdbusmenu-aec55f7fae016a6d25f675a02ff42c981ec80c04.tar.bz2
libdbusmenu-aec55f7fae016a6d25f675a02ff42c981ec80c04.zip
Set the node ID to zero if the node is the root node.
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r--libdbusmenu-glib/menuitem.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c
index a03117c..3e06719 100644
--- a/libdbusmenu-glib/menuitem.c
+++ b/libdbusmenu-glib/menuitem.c
@@ -1060,12 +1060,17 @@ dbusmenu_menuitem_buildxml (DbusmenuMenuitem * mi, GPtrArray * array, gint revis
{
g_return_if_fail(DBUSMENU_IS_MENUITEM(mi));
+ guint id = 0;
+ if (!dbusmenu_menuitem_get_root(mi)) {
+ id = dbusmenu_menuitem_get_id(mi);
+ }
+
GList * children = dbusmenu_menuitem_get_children(mi);
/* TODO: Only put revision info in the root node. Save some bandwidth. */
if (children == NULL) {
- g_ptr_array_add(array, g_strdup_printf("<menu id=\"%d\" revision=\"%d\" />", dbusmenu_menuitem_get_id(mi), revision));
+ g_ptr_array_add(array, g_strdup_printf("<menu id=\"%d\" revision=\"%d\" />", id, revision));
} else {
- g_ptr_array_add(array, g_strdup_printf("<menu id=\"%d\" revision=\"%d\">", dbusmenu_menuitem_get_id(mi), revision));
+ g_ptr_array_add(array, g_strdup_printf("<menu id=\"%d\" revision=\"%d\">", id, revision));
for ( ; children != NULL; children = children->next) {
dbusmenu_menuitem_buildxml(DBUSMENU_MENUITEM(children->data), array, revision);
}