Merge lp:~ted/libdbusmenu/remove-revision-from-xml into lp:libdbusmenu/0.5

Proposed by Ted Gould
Status: Merged
Merged at revision: not available
Proposed branch: lp:~ted/libdbusmenu/remove-revision-from-xml
Merge into: lp:libdbusmenu/0.5
Prerequisite: lp:~ted/libdbusmenu/bug510887
Diff against target: 149 lines (+14/-45)
5 files modified
libdbusmenu-glib/client.c (+1/-30)
libdbusmenu-glib/dbus-menu.xml (+5/-5)
libdbusmenu-glib/menuitem-private.h (+1/-1)
libdbusmenu-glib/menuitem.c (+4/-6)
libdbusmenu-glib/server.c (+3/-3)
To merge this branch: bzr merge lp:~ted/libdbusmenu/remove-revision-from-xml
Reviewer Review Type Date Requested Status
Cody Russell (community) Approve
Review via email: mp+17858@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

This removes the revision property from the XML file representing the layout.

Revision history for this message
Cody Russell (bratsche) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libdbusmenu-glib/client.c'
2--- libdbusmenu-glib/client.c 2010-01-07 05:27:49 +0000
3+++ libdbusmenu-glib/client.c 2010-01-21 23:29:11 +0000
4@@ -514,34 +514,6 @@
5 return;
6 }
7
8-/* Get the "revision" attribute of the node, parse it and
9- return it. Also we're checking to ensure the node
10- is a 'menu' here. */
11-static gint
12-parse_node_get_revision (xmlNodePtr node)
13-{
14- if (g_strcmp0((gchar *)node->name, "menu") != 0) {
15- /* This kills some nodes early */
16- g_warning("XML Node is not 'menu' it is '%s'", node->name);
17- return 0;
18- }
19-
20- xmlAttrPtr attrib;
21- for (attrib = node->properties; attrib != NULL; attrib = attrib->next) {
22- if (g_strcmp0((gchar *)attrib->name, "revision") == 0) {
23- if (attrib->children != NULL) {
24- guint revision = (guint)g_ascii_strtoull((gchar *)attrib->children->content, NULL, 10);
25- /* g_debug ("Found ID: %d", id); */
26- return revision;
27- }
28- break;
29- }
30- }
31-
32- g_warning("Unable to find a revision on the node");
33- return 0;
34-}
35-
36 /* Get the ID attribute of the node, parse it and
37 return it. Also we're checking to ensure the node
38 is a 'menu' here. */
39@@ -764,7 +736,6 @@
40 xmldoc = xmlReadMemory(layout, g_utf8_strlen(layout, 16*1024), "dbusmenu.xml", NULL, 0);
41
42 xmlNodePtr root = xmlDocGetRootElement(xmldoc);
43- gint revision = parse_node_get_revision(root);
44
45 DbusmenuMenuitem * oldroot = priv->root;
46 priv->root = parse_layout_xml(client, root, priv->root, NULL, priv->menuproxy);
47@@ -781,7 +752,7 @@
48 g_signal_emit(G_OBJECT(client), signals[ROOT_CHANGED], 0, priv->root, TRUE);
49 }
50
51- return revision;
52+ return 1;
53 }
54
55 /* When the layout property returns, here's where we take care of that. */
56
57=== modified file 'libdbusmenu-glib/dbus-menu.xml'
58--- libdbusmenu-glib/dbus-menu.xml 2009-12-24 10:31:16 +0000
59+++ libdbusmenu-glib/dbus-menu.xml 2010-01-21 23:29:11 +0000
60@@ -50,13 +50,13 @@
61
62 XML syntax:
63
64-<menu id="1" revision="2"> # Root container
65- <menu id="2" revision="2"> # First level menu, for example "File"
66- <menu id="3" revision="2"/> ~ Second level menu, for example "Open"
67- <menu id="4" revision="3"/>
68+<menu id="1"> # Root container
69+ <menu id="2"> # First level menu, for example "File"
70+ <menu id="3"/> ~ Second level menu, for example "Open"
71+ <menu id="4"/>
72 ...
73 </menu>
74- <menu id="5" revision="2"> # Another first level menu, say "Edit"
75+ <menu id="5"> # Another first level menu, say "Edit"
76 ...
77 </menu>
78 ...
79
80=== modified file 'libdbusmenu-glib/menuitem-private.h'
81--- libdbusmenu-glib/menuitem-private.h 2009-11-13 18:02:08 +0000
82+++ libdbusmenu-glib/menuitem-private.h 2010-01-21 23:29:11 +0000
83@@ -33,7 +33,7 @@
84
85 G_BEGIN_DECLS
86
87-void dbusmenu_menuitem_buildxml (DbusmenuMenuitem * mi, GPtrArray * array, gint revision);
88+void dbusmenu_menuitem_buildxml (DbusmenuMenuitem * mi, GPtrArray * array);
89
90 G_END_DECLS
91
92
93=== modified file 'libdbusmenu-glib/menuitem.c'
94--- libdbusmenu-glib/menuitem.c 2010-01-21 23:29:11 +0000
95+++ libdbusmenu-glib/menuitem.c 2010-01-21 23:29:11 +0000
96@@ -1047,7 +1047,6 @@
97 dbusmenu_menuitem_buildxml:
98 @mi: #DbusmenuMenuitem to represent in XML
99 @array: A list of string that will be turned into an XML file
100- @revision: The revision of the layout to embed in the XML
101
102 This function will add strings to the array @array. It will put
103 at least one entry if this menu item has no children. If it has
104@@ -1056,7 +1055,7 @@
105 children to place their own tags in the array in between those two.
106 */
107 void
108-dbusmenu_menuitem_buildxml (DbusmenuMenuitem * mi, GPtrArray * array, gint revision)
109+dbusmenu_menuitem_buildxml (DbusmenuMenuitem * mi, GPtrArray * array)
110 {
111 g_return_if_fail(DBUSMENU_IS_MENUITEM(mi));
112
113@@ -1066,13 +1065,12 @@
114 }
115
116 GList * children = dbusmenu_menuitem_get_children(mi);
117- /* TODO: Only put revision info in the root node. Save some bandwidth. */
118 if (children == NULL) {
119- g_ptr_array_add(array, g_strdup_printf("<menu id=\"%d\" revision=\"%d\" />", id, revision));
120+ g_ptr_array_add(array, g_strdup_printf("<menu id=\"%d\"/>", id));
121 } else {
122- g_ptr_array_add(array, g_strdup_printf("<menu id=\"%d\" revision=\"%d\">", id, revision));
123+ g_ptr_array_add(array, g_strdup_printf("<menu id=\"%d\">", id));
124 for ( ; children != NULL; children = children->next) {
125- dbusmenu_menuitem_buildxml(DBUSMENU_MENUITEM(children->data), array, revision);
126+ dbusmenu_menuitem_buildxml(DBUSMENU_MENUITEM(children->data), array);
127 }
128 g_ptr_array_add(array, g_strdup("</menu>"));
129 }
130
131=== modified file 'libdbusmenu-glib/server.c'
132--- libdbusmenu-glib/server.c 2009-12-24 10:31:16 +0000
133+++ libdbusmenu-glib/server.c 2010-01-21 23:29:11 +0000
134@@ -376,13 +376,13 @@
135 if (parent == 0) {
136 if (priv->root == NULL) {
137 /* g_debug("Getting layout without root node!"); */
138- g_ptr_array_add(xmlarray, g_strdup_printf("<menu revision=\"%d\" />", priv->layout_revision));
139+ g_ptr_array_add(xmlarray, g_strdup("<menu/>"));
140 } else {
141- dbusmenu_menuitem_buildxml(priv->root, xmlarray, priv->layout_revision);
142+ dbusmenu_menuitem_buildxml(priv->root, xmlarray);
143 }
144 } else {
145 DbusmenuMenuitem * item = dbusmenu_menuitem_find_id(priv->root, parent);
146- dbusmenu_menuitem_buildxml(item, xmlarray, priv->layout_revision);
147+ dbusmenu_menuitem_buildxml(item, xmlarray);
148 }
149 g_ptr_array_add(xmlarray, NULL);
150

Subscribers

People subscribed via source and target branches