Merge lp:~dbusmenu-team/libdbusmenu/ubuntu into lp:~ubuntu-desktop/libdbusmenu/ubuntu

Proposed by Ted Gould
Status: Merged
Merged at revision: not available
Proposed branch: lp:~dbusmenu-team/libdbusmenu/ubuntu
Merge into: lp:~ubuntu-desktop/libdbusmenu/ubuntu
Diff against target: 796 lines (+227/-61)
20 files modified
.bzrignore (+1/-0)
configure.ac (+3/-3)
debian/changelog (+11/-0)
debian/libdbusmenu-tools.install (+2/-0)
libdbusmenu-glib/client.c (+37/-1)
libdbusmenu-glib/dbus-menu.xml (+10/-7)
libdbusmenu-glib/menuitem.c (+57/-12)
libdbusmenu-glib/menuitem.h (+2/-1)
libdbusmenu-glib/server.c (+3/-1)
tests/Makefile.am (+6/-1)
tests/test-glib-layout-client.c (+7/-5)
tests/test-glib-layout-server.c (+2/-2)
tests/test-glib-layout.h (+11/-11)
tests/test-glib-objects.c (+25/-0)
tests/test-glib-properties-client.c (+7/-5)
tests/test-glib-properties-server.c (+3/-3)
tests/test-glib-properties.h (+6/-6)
tests/test-gtk-label.json (+2/-2)
tools/Makefile.am (+5/-1)
tools/README.dbusmenu-bench (+27/-0)
To merge this branch: bzr merge lp:~dbusmenu-team/libdbusmenu/ubuntu
Reviewer Review Type Date Requested Status
Sebastien Bacher Pending
Review via email: mp+18714@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

0.2.3

lp:~dbusmenu-team/libdbusmenu/ubuntu updated
63. By Sebastien Bacher

releasing version 0.2.3-0ubuntu1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2010-02-04 20:15:43 +0000
+++ .bzrignore 2010-02-05 19:30:27 +0000
@@ -59,3 +59,4 @@
59tests/test-glib-objects-test59tests/test-glib-objects-test
60tests/test-glib-objects.xml60tests/test-glib-objects.xml
61tools/testapp/dbusmenu-testapp61tools/testapp/dbusmenu-testapp
62libdbusmenu-glib/libdbusmenu_glib_la-client-menuitem.lo
6263
=== modified file 'configure.ac'
--- configure.ac 2010-02-04 20:15:43 +0000
+++ configure.ac 2010-02-05 19:30:27 +0000
@@ -1,11 +1,11 @@
11
2AC_INIT(libdbusmenu, 0.2.2, ted@canonical.com)2AC_INIT(libdbusmenu, 0.2.3, ted@canonical.com)
3AC_COPYRIGHT([Copyright 2009,2010 Canonical])3AC_COPYRIGHT([Copyright 2009,2010 Canonical])
44
5AC_PREREQ(2.53)5AC_PREREQ(2.53)
66
7AM_CONFIG_HEADER(config.h)7AM_CONFIG_HEADER(config.h)
8AM_INIT_AUTOMAKE(libdbusmenu, 0.2.2)8AM_INIT_AUTOMAKE(libdbusmenu, 0.2.3)
99
10AM_MAINTAINER_MODE10AM_MAINTAINER_MODE
1111
@@ -66,7 +66,7 @@
66###########################66###########################
6767
68LIBDBUSMENU_CURRENT=168LIBDBUSMENU_CURRENT=1
69LIBDBUSMENU_REVISION=069LIBDBUSMENU_REVISION=1
70LIBDBUSMENU_AGE=070LIBDBUSMENU_AGE=0
7171
72AC_SUBST(LIBDBUSMENU_CURRENT)72AC_SUBST(LIBDBUSMENU_CURRENT)
7373
=== modified file 'debian/changelog'
--- debian/changelog 2010-02-05 02:12:21 +0000
+++ debian/changelog 2010-02-05 19:30:27 +0000
@@ -1,3 +1,14 @@
1libdbusmenu (0.2.3-0ubuntu1~ppa1) lucid; urgency=low
2
3 * Upstream release 0.2.3
4 * Fixing handing of root IDs being zero
5 * Handling syncing of properties when reusing items
6 * Shipping new JSON files and READMEs for testing.
7 * libdbusmenu-tools.install: Add in json file and README so
8 that they're put in the right directories.
9
10 -- Ted Gould <ted@ubuntu.com> Fri, 05 Feb 2010 11:24:58 -0800
11
1libdbusmenu (0.2.2-0ubuntu3) lucid; urgency=low12libdbusmenu (0.2.2-0ubuntu3) lucid; urgency=low
213
3 * debian/control: 14 * debian/control:
415
=== modified file 'debian/libdbusmenu-tools.install'
--- debian/libdbusmenu-tools.install 2010-02-04 20:17:02 +0000
+++ debian/libdbusmenu-tools.install 2010-02-05 19:30:27 +0000
@@ -1,1 +1,3 @@
1debian/tmp/usr/lib/libdbusmenu/dbusmenu-*1debian/tmp/usr/lib/libdbusmenu/dbusmenu-*
2debian/tmp/usr/share/libdbusmenu/* /usr/share/libdbusmenu-tools/
3debian/tmp/usr/share/doc/libdbusmenu/README.dbusmenu-bench /usr/share/doc/libdbusmenu-tools/
24
=== modified file 'libdbusmenu-glib/client.c'
--- libdbusmenu-glib/client.c 2010-02-04 17:59:00 +0000
+++ libdbusmenu-glib/client.c 2010-02-05 19:30:27 +0000
@@ -339,6 +339,7 @@
339 g_return_if_fail(menuitem != NULL);339 g_return_if_fail(menuitem != NULL);
340340
341 dbusmenu_menuitem_property_set_value(menuitem, property, value);341 dbusmenu_menuitem_property_set_value(menuitem, property, value);
342
342 return;343 return;
343}344}
344345
@@ -569,6 +570,22 @@
569 return;570 return;
570}571}
571572
573static void
574menuitem_get_properties_replace_cb (DBusGProxy * proxy, GHashTable * properties, GError * error, gpointer data)
575{
576 GList * current_props = NULL;
577
578 for (current_props = dbusmenu_menuitem_properties_list(DBUSMENU_MENUITEM(data));
579 current_props != NULL ; current_props = g_list_next(current_props)) {
580 if (g_hash_table_lookup(properties, current_props->data) == NULL) {
581 dbusmenu_menuitem_property_remove(DBUSMENU_MENUITEM(data), (const gchar *)current_props->data);
582 }
583 }
584
585 menuitem_get_properties_cb(proxy, properties, error, data);
586 return;
587}
588
572/* This is a different get properites call back that also sends589/* This is a different get properites call back that also sends
573 new signals. It basically is a small wrapper around the original. */590 new signals. It basically is a small wrapper around the original. */
574static void591static void
@@ -647,6 +664,7 @@
647 #ifdef MASSIVEDEBUGGING664 #ifdef MASSIVEDEBUGGING
648 g_debug("Client looking at node with id: %d", id);665 g_debug("Client looking at node with id: %d", id);
649 #endif666 #endif
667 /* If we don't have any item, or the IDs don't match */
650 if (item == NULL || dbusmenu_menuitem_get_id(item) != id) {668 if (item == NULL || dbusmenu_menuitem_get_id(item) != id) {
651 if (item != NULL) {669 if (item != NULL) {
652 if (parent != NULL) {670 if (parent != NULL) {
@@ -675,7 +693,11 @@
675 } else {693 } else {
676 g_warning("Unable to allocate memory to get properties for menuitem. This menuitem will never be realized.");694 g_warning("Unable to allocate memory to get properties for menuitem. This menuitem will never be realized.");
677 }695 }
678 } 696 } else {
697 /* Refresh the properties */
698 gchar * properties[1] = {NULL}; /* This gets them all */
699 org_ayatana_dbusmenu_get_properties_async(proxy, id, (const gchar **)properties, menuitem_get_properties_replace_cb, item);
700 }
679701
680 xmlNodePtr children;702 xmlNodePtr children;
681 guint position;703 guint position;
@@ -736,6 +758,10 @@
736 xmlNodePtr root = xmlDocGetRootElement(xmldoc);758 xmlNodePtr root = xmlDocGetRootElement(xmldoc);
737759
738 DbusmenuMenuitem * oldroot = priv->root;760 DbusmenuMenuitem * oldroot = priv->root;
761 if (oldroot != NULL) {
762 g_object_ref(oldroot);
763 }
764
739 priv->root = parse_layout_xml(client, root, priv->root, NULL, priv->menuproxy);765 priv->root = parse_layout_xml(client, root, priv->root, NULL, priv->menuproxy);
740 xmlFreeDoc(xmldoc);766 xmlFreeDoc(xmldoc);
741767
@@ -747,6 +773,16 @@
747 #ifdef MASSIVEDEBUGGING773 #ifdef MASSIVEDEBUGGING
748 g_debug("Client signaling root changed.");774 g_debug("Client signaling root changed.");
749 #endif 775 #endif
776
777 /* Switch the root around */
778 g_object_ref(priv->root);
779 dbusmenu_menuitem_set_root(priv->root, TRUE);
780
781 if (oldroot != NULL) {
782 dbusmenu_menuitem_set_root(oldroot, FALSE);
783 g_object_unref(oldroot);
784 }
785
750 g_signal_emit(G_OBJECT(client), signals[ROOT_CHANGED], 0, priv->root, TRUE);786 g_signal_emit(G_OBJECT(client), signals[ROOT_CHANGED], 0, priv->root, TRUE);
751 }787 }
752788
753789
=== modified file 'libdbusmenu-glib/dbus-menu.xml'
--- libdbusmenu-glib/dbus-menu.xml 2010-02-02 01:44:14 +0000
+++ libdbusmenu-glib/dbus-menu.xml 2010-02-05 19:30:27 +0000
@@ -1,6 +1,6 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<!--2<!--
3A library to allow applictions to provide simple indications of3A library to allow applications to provide simple indications of
4information to be displayed to users of the application through the4information to be displayed to users of the application through the
5interface shell.5interface shell.
66
@@ -8,7 +8,7 @@
88
9Authors:9Authors:
10 Ted Gould <ted@canonical.com>10 Ted Gould <ted@canonical.com>
11 Aurelien Gateau <ted@canonical.com>11 Aurélien Gâteau <aurelien.gateau@canonical.com>
1212
13This program is free software: you can redistribute it and/or modify it 13This program is free software: you can redistribute it and/or modify it
14under the terms of either or both of the following licenses:14under the terms of either or both of the following licenses:
@@ -37,6 +37,9 @@
37 Items are represented with a unique numeric id and a dictionary of37 Items are represented with a unique numeric id and a dictionary of
38 properties.38 properties.
3939
40 To reduce the amount of DBus traffic, a property should only be returned
41 if its value is not the default value.
42
40 Available properties are:43 Available properties are:
4144
42 <table>45 <table>
@@ -151,13 +154,13 @@
151 XML syntax:154 XML syntax:
152155
153 @verbatim156 @verbatim
154<menu id="1" revision="2"> # Root container157<menu id="0"> # Root container
155 <menu id="2" revision="2"> # First level menu, for example "File"158 <menu id="1"> # First level menu, for example "File"
156 <menu id="3" revision="2"/> ~ Second level menu, for example "Open"159 <menu id="2"/> ~ Second level menu, for example "Open"
157 <menu id="4" revision="3"/>160 <menu id="3"/>
158 ...161 ...
159 </menu>162 </menu>
160 <menu id="5" revision="2"> # Another first level menu, say "Edit"163 <menu id="4"> # Another first level menu, say "Edit"
161 ...164 ...
162 </menu>165 </menu>
163 ...166 ...
164167
=== modified file 'libdbusmenu-glib/menuitem.c'
--- libdbusmenu-glib/menuitem.c 2010-02-04 17:59:00 +0000
+++ libdbusmenu-glib/menuitem.c 2010-02-05 19:30:27 +0000
@@ -80,6 +80,8 @@
80 PROP_ID,80 PROP_ID,
81};81};
8282
83#define PROP_ID_S "id"
84
83#define DBUSMENU_MENUITEM_GET_PRIVATE(o) \85#define DBUSMENU_MENUITEM_GET_PRIVATE(o) \
84(G_TYPE_INSTANCE_GET_PRIVATE ((o), DBUSMENU_TYPE_MENUITEM, DbusmenuMenuitemPrivate))86(G_TYPE_INSTANCE_GET_PRIVATE ((o), DBUSMENU_TYPE_MENUITEM, DbusmenuMenuitemPrivate))
8587
@@ -210,9 +212,9 @@
210 G_TYPE_NONE, 0, G_TYPE_NONE);212 G_TYPE_NONE, 0, G_TYPE_NONE);
211213
212 g_object_class_install_property (object_class, PROP_ID,214 g_object_class_install_property (object_class, PROP_ID,
213 g_param_spec_int("id", "ID for the menu item",215 g_param_spec_int(PROP_ID_S, "ID for the menu item",
214 "This is a unique indentifier for the menu item.",216 "This is a unique indentifier for the menu item.",
215 0, 30000, 0,217 -1, 30000, -1,
216 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));218 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
217219
218 /* Check transfer functions for GValue */220 /* Check transfer functions for GValue */
@@ -249,7 +251,7 @@
249 return;251 return;
250}252}
251253
252static gint menuitem_next_id = 0;254static gint menuitem_next_id = 1;
253255
254/* A small little function to both clear the insides of a 256/* A small little function to both clear the insides of a
255 value as well as the memory it itself uses. */257 value as well as the memory it itself uses. */
@@ -270,7 +272,7 @@
270{272{
271 DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(self);273 DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(self);
272274
273 priv->id = 0; 275 priv->id = -1;
274 priv->children = NULL;276 priv->children = NULL;
275277
276 priv->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, _g_value_free);278 priv->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, _g_value_free);
@@ -323,6 +325,9 @@
323 menuitem_next_id = priv->id + 1;325 menuitem_next_id = priv->id + 1;
324 }326 }
325 break;327 break;
328 default:
329 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, id, pspec);
330 break;
326 }331 }
327332
328 return;333 return;
@@ -335,7 +340,17 @@
335340
336 switch (id) {341 switch (id) {
337 case PROP_ID:342 case PROP_ID:
338 g_value_set_int(value, priv->id);343 if (priv->id == -1) {
344 priv->id = menuitem_next_id++;
345 }
346 if (dbusmenu_menuitem_get_root(DBUSMENU_MENUITEM(obj))) {
347 g_value_set_int(value, 0);
348 } else {
349 g_value_set_int(value, priv->id);
350 }
351 break;
352 default:
353 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, id, pspec);
339 break;354 break;
340 }355 }
341356
@@ -365,7 +380,7 @@
365DbusmenuMenuitem *380DbusmenuMenuitem *
366dbusmenu_menuitem_new (void)381dbusmenu_menuitem_new (void)
367{382{
368 return g_object_new(DBUSMENU_TYPE_MENUITEM, "id", menuitem_next_id++, NULL);383 return g_object_new(DBUSMENU_TYPE_MENUITEM, NULL);
369}384}
370385
371/**386/**
@@ -379,7 +394,7 @@
379DbusmenuMenuitem *394DbusmenuMenuitem *
380dbusmenu_menuitem_new_with_id (gint id)395dbusmenu_menuitem_new_with_id (gint id)
381{396{
382 DbusmenuMenuitem * mi = g_object_new(DBUSMENU_TYPE_MENUITEM, "id", id, NULL);397 DbusmenuMenuitem * mi = g_object_new(DBUSMENU_TYPE_MENUITEM, PROP_ID_S, id, NULL);
383 /* g_debug("New Menuitem id %d goal id %d", dbusmenu_menuitem_get_id(mi), id); */398 /* g_debug("New Menuitem id %d goal id %d", dbusmenu_menuitem_get_id(mi), id); */
384 return mi;399 return mi;
385}400}
@@ -392,15 +407,19 @@
392407
393 Return value: The ID of the @mi.408 Return value: The ID of the @mi.
394*/409*/
395guint410gint
396dbusmenu_menuitem_get_id (DbusmenuMenuitem * mi)411dbusmenu_menuitem_get_id (DbusmenuMenuitem * mi)
397{412{
398 g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), 0);413 g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), -1);
399414
400 GValue retval = {0};415 GValue retval = {0};
401 g_value_init(&retval, G_TYPE_UINT);416 g_value_init(&retval, G_TYPE_INT);
402 g_object_get_property(G_OBJECT(mi), "id", &retval);417 g_object_get_property(G_OBJECT(mi), PROP_ID_S, &retval);
403 return g_value_get_uint(&retval);418 gint ret = g_value_get_int(&retval);
419 #ifdef MASSIVEDEBUGGING
420 g_debug("Getting menuitem ID: %d", ret);
421 #endif
422 return ret;
404}423}
405424
406/**425/**
@@ -710,6 +729,12 @@
710dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id)729dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id)
711{730{
712 g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL);731 g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL);
732 if (id == 0) {
733 if (dbusmenu_menuitem_get_root(mi) == FALSE) {
734 g_warning("Getting a menuitem with id zero, but it's not set as root.");
735 }
736 return mi;
737 }
713 find_id_t find_id = {mi: NULL, id: id};738 find_id_t find_id = {mi: NULL, id: id};
714 find_id_helper(mi, &find_id);739 find_id_helper(mi, &find_id);
715 return find_id.mi;740 return find_id.mi;
@@ -963,6 +988,26 @@
963}988}
964989
965/**990/**
991 dbusmenu_menuitem_property_remove:
992 @mi: The #DbusmenuMenuitem to remove the property on.
993 @property: The property to look for.
994
995 Removes a property from the menuitem.
996*/
997void
998dbusmenu_menuitem_property_remove (DbusmenuMenuitem * mi, const gchar * property)
999{
1000 g_return_if_fail(DBUSMENU_IS_MENUITEM(mi));
1001 g_return_if_fail(property != NULL);
1002
1003 DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi);
1004
1005 g_hash_table_remove(priv->properties, property);
1006
1007 return;
1008}
1009
1010/**
966 dbusmenu_menuitem_properties_list:1011 dbusmenu_menuitem_properties_list:
967 @mi: #DbusmenuMenuitem to list the properties on1012 @mi: #DbusmenuMenuitem to list the properties on
9681013
9691014
=== modified file 'libdbusmenu-glib/menuitem.h'
--- libdbusmenu-glib/menuitem.h 2010-02-04 17:59:00 +0000
+++ libdbusmenu-glib/menuitem.h 2010-02-05 19:30:27 +0000
@@ -127,7 +127,7 @@
127127
128DbusmenuMenuitem * dbusmenu_menuitem_new (void) G_GNUC_WARN_UNUSED_RESULT;128DbusmenuMenuitem * dbusmenu_menuitem_new (void) G_GNUC_WARN_UNUSED_RESULT;
129DbusmenuMenuitem * dbusmenu_menuitem_new_with_id (gint id) G_GNUC_WARN_UNUSED_RESULT;129DbusmenuMenuitem * dbusmenu_menuitem_new_with_id (gint id) G_GNUC_WARN_UNUSED_RESULT;
130guint dbusmenu_menuitem_get_id (DbusmenuMenuitem * mi);130gint dbusmenu_menuitem_get_id (DbusmenuMenuitem * mi);
131131
132GList * dbusmenu_menuitem_get_children (DbusmenuMenuitem * mi);132GList * dbusmenu_menuitem_get_children (DbusmenuMenuitem * mi);
133GList * dbusmenu_menuitem_take_children (DbusmenuMenuitem * mi) G_GNUC_WARN_UNUSED_RESULT;133GList * dbusmenu_menuitem_take_children (DbusmenuMenuitem * mi) G_GNUC_WARN_UNUSED_RESULT;
@@ -152,6 +152,7 @@
152gboolean dbusmenu_menuitem_property_exist (DbusmenuMenuitem * mi, const gchar * property);152gboolean dbusmenu_menuitem_property_exist (DbusmenuMenuitem * mi, const gchar * property);
153GList * dbusmenu_menuitem_properties_list (DbusmenuMenuitem * mi) G_GNUC_WARN_UNUSED_RESULT;153GList * dbusmenu_menuitem_properties_list (DbusmenuMenuitem * mi) G_GNUC_WARN_UNUSED_RESULT;
154GHashTable * dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi);154GHashTable * dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi);
155void dbusmenu_menuitem_property_remove (DbusmenuMenuitem * mi, const gchar * property);
155156
156void dbusmenu_menuitem_set_root (DbusmenuMenuitem * mi, gboolean root);157void dbusmenu_menuitem_set_root (DbusmenuMenuitem * mi, gboolean root);
157gboolean dbusmenu_menuitem_get_root (DbusmenuMenuitem * mi);158gboolean dbusmenu_menuitem_get_root (DbusmenuMenuitem * mi);
158159
=== modified file 'libdbusmenu-glib/server.c'
--- libdbusmenu-glib/server.c 2010-02-04 20:12:17 +0000
+++ libdbusmenu-glib/server.c 2010-02-05 19:30:27 +0000
@@ -237,12 +237,14 @@
237 case PROP_ROOT_NODE:237 case PROP_ROOT_NODE:
238 if (priv->root != NULL) {238 if (priv->root != NULL) {
239 dbusmenu_menuitem_foreach(priv->root, menuitem_signals_remove, obj);239 dbusmenu_menuitem_foreach(priv->root, menuitem_signals_remove, obj);
240 dbusmenu_menuitem_set_root(priv->root, FALSE);
240 g_object_unref(G_OBJECT(priv->root));241 g_object_unref(G_OBJECT(priv->root));
241 priv->root = NULL;242 priv->root = NULL;
242 }243 }
243 priv->root = DBUSMENU_MENUITEM(g_value_get_object(value));244 priv->root = DBUSMENU_MENUITEM(g_value_get_object(value));
244 if (priv->root != NULL) {245 if (priv->root != NULL) {
245 g_object_ref(G_OBJECT(priv->root));246 g_object_ref(G_OBJECT(priv->root));
247 dbusmenu_menuitem_set_root(priv->root, TRUE);
246 dbusmenu_menuitem_foreach(priv->root, menuitem_signals_create, obj);248 dbusmenu_menuitem_foreach(priv->root, menuitem_signals_create, obj);
247 } else {249 } else {
248 g_debug("Setting root node to NULL");250 g_debug("Setting root node to NULL");
@@ -516,7 +518,7 @@
516_dbusmenu_server_get_children (DbusmenuServer * server, gint id, GPtrArray * properties, GPtrArray ** output, GError ** error)518_dbusmenu_server_get_children (DbusmenuServer * server, gint id, GPtrArray * properties, GPtrArray ** output, GError ** error)
517{519{
518 DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server);520 DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server);
519 DbusmenuMenuitem * mi = id == 0 ? priv->root : dbusmenu_menuitem_find_id(priv->root, id);521 DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id);
520522
521 if (mi == NULL) {523 if (mi == NULL) {
522 if (error != NULL) {524 if (error != NULL) {
523525
=== modified file 'tests/Makefile.am'
--- tests/Makefile.am 2009-12-23 02:57:36 +0000
+++ tests/Makefile.am 2010-02-05 19:30:27 +0000
@@ -231,10 +231,15 @@
231examples_DATA = \231examples_DATA = \
232 $(glib_server_nomenu_SOURCES)232 $(glib_server_nomenu_SOURCES)
233233
234jsondir = $(datadir)/${PACKAGE}/json/
235
236json_DATA = \
237 test-gtk-label.json
238
234EXTRA_DIST = \239EXTRA_DIST = \
235 $(examples_DATA) \240 $(examples_DATA) \
236 run-xvfb.sh \241 run-xvfb.sh \
237 test-gtk-label.json \242 $(json_DATA) \
238 dbusmenu-gtk/dbusMenuTest \243 dbusmenu-gtk/dbusMenuTest \
239 dbusmenu-gtk/mago_tests/dbusmenu.xml \244 dbusmenu-gtk/mago_tests/dbusmenu.xml \
240 dbusmenu-gtk/mago_tests/dbusmenu.py \245 dbusmenu-gtk/mago_tests/dbusmenu.py \
241246
=== modified file 'tests/test-glib-layout-client.c'
--- tests/test-glib-layout-client.c 2010-01-07 14:55:35 +0000
+++ tests/test-glib-layout-client.c 2010-02-05 19:30:27 +0000
@@ -36,8 +36,10 @@
36 g_debug("Verifying ID: %d", layout->id);36 g_debug("Verifying ID: %d", layout->id);
3737
38 if (layout->id != dbusmenu_menuitem_get_id(mi)) {38 if (layout->id != dbusmenu_menuitem_get_id(mi)) {
39 g_debug("Failed as ID %d is not equal to %d", layout->id, dbusmenu_menuitem_get_id(mi));39 if (!(dbusmenu_menuitem_get_root(mi) && dbusmenu_menuitem_get_id(mi) == 0)) {
40 return FALSE;40 g_debug("Failed as ID %d is not equal to %d", layout->id, dbusmenu_menuitem_get_id(mi));
41 return FALSE;
42 }
41 }43 }
4244
43 GList * children = dbusmenu_menuitem_get_children(mi);45 GList * children = dbusmenu_menuitem_get_children(mi);
@@ -55,13 +57,13 @@
55 }57 }
5658
57 guint i = 0;59 guint i = 0;
58 for (i = 0; children != NULL && layout->submenu[i].id != 0; children = g_list_next(children), i++) {60 for (i = 0; children != NULL && layout->submenu[i].id != -1; children = g_list_next(children), i++) {
59 if (!verify_root_to_layout(DBUSMENU_MENUITEM(children->data), &layout->submenu[i])) {61 if (!verify_root_to_layout(DBUSMENU_MENUITEM(children->data), &layout->submenu[i])) {
60 return FALSE;62 return FALSE;
61 }63 }
62 }64 }
6365
64 if (children == NULL && layout->submenu[i].id == 0) {66 if (children == NULL && layout->submenu[i].id == -1) {
65 return TRUE;67 return TRUE;
66 }68 }
6769
@@ -88,7 +90,7 @@
8890
89 layouton++;91 layouton++;
9092
91 if (layouts[layouton].id == 0) {93 if (layouts[layouton].id == -1) {
92 g_main_loop_quit(mainloop);94 g_main_loop_quit(mainloop);
93 }95 }
9496
9597
=== modified file 'tests/test-glib-layout-server.c'
--- tests/test-glib-layout-server.c 2010-01-07 14:55:35 +0000
+++ tests/test-glib-layout-server.c 2010-02-05 19:30:27 +0000
@@ -41,7 +41,7 @@
41 41
42 if (layout->submenu != NULL) {42 if (layout->submenu != NULL) {
43 guint count;43 guint count;
44 for (count = 0; layout->submenu[count].id != 0; count++) {44 for (count = 0; layout->submenu[count].id != -1; count++) {
45 DbusmenuMenuitem * child = layout2menuitem(&layout->submenu[count]);45 DbusmenuMenuitem * child = layout2menuitem(&layout->submenu[count]);
46 if (child != NULL) {46 if (child != NULL) {
47 dbusmenu_menuitem_child_append(local, child);47 dbusmenu_menuitem_child_append(local, child);
@@ -60,7 +60,7 @@
60static gboolean60static gboolean
61timer_func (gpointer data)61timer_func (gpointer data)
62{62{
63 if (layouts[layouton].id == 0) {63 if (layouts[layouton].id == -1) {
64 g_main_loop_quit(mainloop);64 g_main_loop_quit(mainloop);
65 return FALSE;65 return FALSE;
66 }66 }
6767
=== modified file 'tests/test-glib-layout.h'
--- tests/test-glib-layout.h 2009-05-12 13:38:58 +0000
+++ tests/test-glib-layout.h 2010-02-05 19:30:27 +0000
@@ -21,51 +21,51 @@
2121
22typedef struct _layout_t layout_t;22typedef struct _layout_t layout_t;
23struct _layout_t {23struct _layout_t {
24 guint id;24 gint id;
25 layout_t * submenu;25 layout_t * submenu;
26};26};
2727
28layout_t submenu_2[] = {28layout_t submenu_2[] = {
29 {id: 2, submenu: NULL},29 {id: 2, submenu: NULL},
30 {id: 3, submenu: NULL},30 {id: 3, submenu: NULL},
31 {id: 0, submenu: NULL}31 {id: -1, submenu: NULL}
32};32};
33layout_t submenu_3_1[] = {33layout_t submenu_3_1[] = {
34 {id: 3, submenu: NULL},34 {id: 3, submenu: NULL},
35 {id: 4, submenu: NULL},35 {id: 4, submenu: NULL},
36 {id: 5, submenu: NULL},36 {id: 5, submenu: NULL},
37 {id: 0, submenu: NULL}37 {id: -1, submenu: NULL}
38};38};
39layout_t submenu_3_2[] = {39layout_t submenu_3_2[] = {
40 {id: 7, submenu: NULL},40 {id: 7, submenu: NULL},
41 {id: 8, submenu: NULL},41 {id: 8, submenu: NULL},
42 {id: 9, submenu: NULL},42 {id: 9, submenu: NULL},
43 {id: 0, submenu: NULL}43 {id: -1, submenu: NULL}
44};44};
45layout_t submenu_3[] = {45layout_t submenu_3[] = {
46 {id: 2, submenu: submenu_3_1},46 {id: 2, submenu: submenu_3_1},
47 {id: 6, submenu: submenu_3_2},47 {id: 6, submenu: submenu_3_2},
48 {id: 0, submenu: NULL}48 {id: -1, submenu: NULL}
49};49};
50layout_t submenu_4_1[] = {50layout_t submenu_4_1[] = {
51 {id: 6, submenu: NULL},51 {id: 6, submenu: NULL},
52 {id: 0, submenu: NULL}52 {id: -1, submenu: NULL}
53};53};
54layout_t submenu_4_2[] = {54layout_t submenu_4_2[] = {
55 {id: 5, submenu: submenu_4_1},55 {id: 5, submenu: submenu_4_1},
56 {id: 0, submenu: NULL}56 {id: -1, submenu: NULL}
57};57};
58layout_t submenu_4_3[] = {58layout_t submenu_4_3[] = {
59 {id: 4, submenu: submenu_4_2},59 {id: 4, submenu: submenu_4_2},
60 {id: 0, submenu: NULL}60 {id: -1, submenu: NULL}
61};61};
62layout_t submenu_4_4[] = {62layout_t submenu_4_4[] = {
63 {id: 3, submenu: submenu_4_3},63 {id: 3, submenu: submenu_4_3},
64 {id: 0, submenu: NULL}64 {id: -1, submenu: NULL}
65};65};
66layout_t submenu_4_5[] = {66layout_t submenu_4_5[] = {
67 {id: 2, submenu: submenu_4_4},67 {id: 2, submenu: submenu_4_4},
68 {id: 0, submenu: NULL}68 {id: -1, submenu: NULL}
69};69};
7070
71layout_t layouts[] = {71layout_t layouts[] = {
@@ -73,6 +73,6 @@
73 {id: 1, submenu: submenu_2},73 {id: 1, submenu: submenu_2},
74 {id: 1, submenu: submenu_3},74 {id: 1, submenu: submenu_3},
75 {id: 1, submenu: submenu_4_5},75 {id: 1, submenu: submenu_4_5},
76 {id: 0, submenu: NULL}76 {id: -1, submenu: NULL}
77};77};
7878
7979
=== modified file 'tests/test-glib-objects.c'
--- tests/test-glib-objects.c 2009-12-23 02:51:37 +0000
+++ tests/test-glib-objects.c 2010-02-05 19:30:27 +0000
@@ -47,6 +47,30 @@
47 return;47 return;
48}48}
4949
50/* Check to make sure a new ID is bigger than 0 */
51static void
52test_object_menuitem_id (void)
53{
54 /* Build a menu item */
55 DbusmenuMenuitem * item = dbusmenu_menuitem_new();
56
57 /* Test to make sure it's a happy object */
58 g_assert(item != NULL);
59 g_assert(G_IS_OBJECT(item));
60 g_assert(DBUSMENU_IS_MENUITEM(item));
61
62 g_assert(dbusmenu_menuitem_get_id(item) > 0);
63
64 /* Set up a check to make sure it gets destroyed on unref */
65 g_object_add_weak_pointer(G_OBJECT(item), (gpointer *)&item);
66 g_object_unref(item);
67
68 /* Did it go away? */
69 g_assert(item == NULL);
70
71 return;
72}
73
50/* Set a string prop, make sure it's stored as one */74/* Set a string prop, make sure it's stored as one */
51static void75static void
52test_object_menuitem_props_string (void)76test_object_menuitem_props_string (void)
@@ -255,6 +279,7 @@
255test_glib_objects_suite (void)279test_glib_objects_suite (void)
256{280{
257 g_test_add_func ("/dbusmenu/glib/objects/menuitem/base", test_object_menuitem);281 g_test_add_func ("/dbusmenu/glib/objects/menuitem/base", test_object_menuitem);
282 g_test_add_func ("/dbusmenu/glib/objects/menuitem/id", test_object_menuitem_id);
258 g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_string", test_object_menuitem_props_string);283 g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_string", test_object_menuitem_props_string);
259 g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_int", test_object_menuitem_props_int);284 g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_int", test_object_menuitem_props_int);
260 g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_bool", test_object_menuitem_props_bool);285 g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_bool", test_object_menuitem_props_bool);
261286
=== modified file 'tests/test-glib-properties-client.c'
--- tests/test-glib-properties-client.c 2009-12-23 02:51:37 +0000
+++ tests/test-glib-properties-client.c 2010-02-05 19:30:27 +0000
@@ -60,8 +60,10 @@
60 g_debug("Verifying ID: %d", layout->id);60 g_debug("Verifying ID: %d", layout->id);
6161
62 if (layout->id != dbusmenu_menuitem_get_id(mi)) {62 if (layout->id != dbusmenu_menuitem_get_id(mi)) {
63 g_debug("\tFailed as ID %d is not equal to %d", layout->id, dbusmenu_menuitem_get_id(mi));63 if (!dbusmenu_menuitem_get_root(mi)) {
64 return FALSE;64 g_debug("\tFailed as ID %d is not equal to %d", layout->id, dbusmenu_menuitem_get_id(mi));
65 return FALSE;
66 }
65 }67 }
6668
67 if (!verify_props(mi, layout->properties)) {69 if (!verify_props(mi, layout->properties)) {
@@ -85,13 +87,13 @@
85 }87 }
8688
87 guint i = 0;89 guint i = 0;
88 for (i = 0; children != NULL && layout->submenu[i].id != 0; children = g_list_next(children), i++) {90 for (i = 0; children != NULL && layout->submenu[i].id != -1; children = g_list_next(children), i++) {
89 if (!verify_root_to_layout(DBUSMENU_MENUITEM(children->data), &layout->submenu[i])) {91 if (!verify_root_to_layout(DBUSMENU_MENUITEM(children->data), &layout->submenu[i])) {
90 return FALSE;92 return FALSE;
91 }93 }
92 }94 }
9395
94 if (children == NULL && layout->submenu[i].id == 0) {96 if (children == NULL && layout->submenu[i].id == -1) {
95 g_debug("\tPassed: %d", layout->id);97 g_debug("\tPassed: %d", layout->id);
96 return TRUE;98 return TRUE;
97 }99 }
@@ -140,7 +142,7 @@
140142
141 layouton++;143 layouton++;
142 144
143 if (layouts[layouton].id == 0) {145 if (layouts[layouton].id == -1) {
144 g_main_loop_quit(mainloop);146 g_main_loop_quit(mainloop);
145 }147 }
146148
147149
=== modified file 'tests/test-glib-properties-server.c'
--- tests/test-glib-properties-server.c 2009-06-18 19:11:42 +0000
+++ tests/test-glib-properties-server.c 2010-02-05 19:30:27 +0000
@@ -46,14 +46,14 @@
46static DbusmenuMenuitem *46static DbusmenuMenuitem *
47layout2menuitem (proplayout_t * layout)47layout2menuitem (proplayout_t * layout)
48{48{
49 if (layout == NULL || layout->id == 0) return NULL;49 if (layout == NULL || layout->id == -1) return NULL;
5050
51 DbusmenuMenuitem * local = dbusmenu_menuitem_new_with_id(layout->id);51 DbusmenuMenuitem * local = dbusmenu_menuitem_new_with_id(layout->id);
52 set_props(local, layout->properties);52 set_props(local, layout->properties);
53 53
54 if (layout->submenu != NULL) {54 if (layout->submenu != NULL) {
55 guint count;55 guint count;
56 for (count = 0; layout->submenu[count].id != 0; count++) {56 for (count = 0; layout->submenu[count].id != -1; count++) {
57 DbusmenuMenuitem * child = layout2menuitem(&layout->submenu[count]);57 DbusmenuMenuitem * child = layout2menuitem(&layout->submenu[count]);
58 if (child != NULL) {58 if (child != NULL) {
59 dbusmenu_menuitem_child_append(local, child);59 dbusmenu_menuitem_child_append(local, child);
@@ -72,7 +72,7 @@
72static gboolean72static gboolean
73timer_func (gpointer data)73timer_func (gpointer data)
74{74{
75 if (layouts[layouton].id == 0) {75 if (layouts[layouton].id == -1) {
76 g_main_loop_quit(mainloop);76 g_main_loop_quit(mainloop);
77 return FALSE;77 return FALSE;
78 }78 }
7979
=== modified file 'tests/test-glib-properties.h'
--- tests/test-glib-properties.h 2009-06-18 19:11:42 +0000
+++ tests/test-glib-properties.h 2010-02-05 19:30:27 +0000
@@ -24,7 +24,7 @@
2424
25typedef struct _proplayout_t proplayout_t;25typedef struct _proplayout_t proplayout_t;
26struct _proplayout_t {26struct _proplayout_t {
27 guint id;27 gint id;
28 gchar ** properties;28 gchar ** properties;
29 proplayout_t * submenu;29 proplayout_t * submenu;
30};30};
@@ -68,7 +68,7 @@
68 {id: 17, properties: props2, submenu: NULL},68 {id: 17, properties: props2, submenu: NULL},
69 {id: 18, properties: props2, submenu: NULL},69 {id: 18, properties: props2, submenu: NULL},
70 {id: 19, properties: props2, submenu: NULL},70 {id: 19, properties: props2, submenu: NULL},
71 {id: 0, properties: NULL, submenu: NULL}71 {id: -1, properties: NULL, submenu: NULL}
72};72};
7373
74proplayout_t submenu_4_2[] = {74proplayout_t submenu_4_2[] = {
@@ -82,7 +82,7 @@
82 {id: 27, properties: props2, submenu: NULL},82 {id: 27, properties: props2, submenu: NULL},
83 {id: 28, properties: props2, submenu: NULL},83 {id: 28, properties: props2, submenu: NULL},
84 {id: 29, properties: props2, submenu: NULL},84 {id: 29, properties: props2, submenu: NULL},
85 {id: 0, properties: NULL, submenu: NULL}85 {id: -1, properties: NULL, submenu: NULL}
86};86};
8787
88proplayout_t submenu_4_3[] = {88proplayout_t submenu_4_3[] = {
@@ -96,14 +96,14 @@
96 {id: 37, properties: props2, submenu: NULL},96 {id: 37, properties: props2, submenu: NULL},
97 {id: 38, properties: props2, submenu: NULL},97 {id: 38, properties: props2, submenu: NULL},
98 {id: 39, properties: props2, submenu: NULL},98 {id: 39, properties: props2, submenu: NULL},
99 {id: 0, properties: NULL, submenu: NULL}99 {id: -1, properties: NULL, submenu: NULL}
100};100};
101101
102proplayout_t submenu_4_0[] = {102proplayout_t submenu_4_0[] = {
103 {id: 1, properties: props2, submenu: submenu_4_1},103 {id: 1, properties: props2, submenu: submenu_4_1},
104 {id: 2, properties: props2, submenu: submenu_4_2},104 {id: 2, properties: props2, submenu: submenu_4_2},
105 {id: 3, properties: props2, submenu: submenu_4_3},105 {id: 3, properties: props2, submenu: submenu_4_3},
106 {id: 0, properties: NULL, submenu: NULL}106 {id: -1, properties: NULL, submenu: NULL}
107};107};
108108
109proplayout_t layouts[] = {109proplayout_t layouts[] = {
@@ -111,6 +111,6 @@
111 {id: 10, properties: props2, submenu: NULL},111 {id: 10, properties: props2, submenu: NULL},
112 {id: 20, properties: props3, submenu: NULL},112 {id: 20, properties: props3, submenu: NULL},
113 {id: 100, properties: props2, submenu: submenu_4_0},113 {id: 100, properties: props2, submenu: submenu_4_0},
114 {id: 0, properties: NULL, submenu: NULL}114 {id: -1, properties: NULL, submenu: NULL}
115};115};
116116
117117
=== modified file 'tests/test-gtk-label.json'
--- tests/test-gtk-label.json 2010-02-03 18:33:47 +0000
+++ tests/test-gtk-label.json 2010-02-05 19:30:27 +0000
@@ -198,7 +198,7 @@
198 {"id": 39, "type": "standard",198 {"id": 39, "type": "standard",
199 "label": "value39"}199 "label": "value39"}
200 ]200 ]
201 },201 }
202 ]202 ]
203 },203 },
204 {"id": 8, "type": "standard",204 {"id": 8, "type": "standard",
@@ -367,5 +367,5 @@
367 "toggle-state": -1367 "toggle-state": -1
368 }368 }
369 ]369 ]
370 },370 }
371]371]
372372
=== modified file 'tools/Makefile.am'
--- tools/Makefile.am 2010-02-04 19:34:58 +0000
+++ tools/Makefile.am 2010-02-05 19:30:27 +0000
@@ -16,4 +16,8 @@
16 ../libdbusmenu-glib/libdbusmenu-glib.la \16 ../libdbusmenu-glib/libdbusmenu-glib.la \
17 $(DBUSMENUGLIB_LIBS)17 $(DBUSMENUGLIB_LIBS)
1818
19EXTRA_DIST = dbusmenu-bench19doc_DATA = README.dbusmenu-bench
20
21EXTRA_DIST = \
22 $(doc_DATA) \
23 dbusmenu-bench
2024
=== added file 'tools/README.dbusmenu-bench'
--- tools/README.dbusmenu-bench 1970-01-01 00:00:00 +0000
+++ tools/README.dbusmenu-bench 2010-02-05 19:30:27 +0000
@@ -0,0 +1,27 @@
1# Introduction
2
3dbusmenu-bench measures the time it takes to call various DBusMenu methods and
4print the results on stdout. A test dbusmenu application must be started before
5running dbusmenu-bench.
6
7A GLib test application is included in this archive. libdbusmenu-qt provides an
8equivalent Qt test application. They both can load the same menu hierarchy from
9a JSON file.
10
11# Using it
12
131. Start dbusmenu-testapp:
14
15 dbusmenu-testapp /usr/share/libdbusmenu/json/test-gtk-label.json
16
172. Run dbusmenu-bench
18
19 dbusmenu-bench --count 1000
20
211000 is the number of times each DBusMenu method is called. Calling them 1000
22times helps getting meaningful average values.
23
243. Stop dbusmenu-testapp
25
26For debugging purpose, you can also run dbusmenu-bench with the "--dump"
27parameter, which will dump the output of the called methods.

Subscribers

People subscribed via source and target branches

to all changes: