aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdbusmenu-glib/client.c10
-rw-r--r--libdbusmenu-glib/dbus-menu.xml115
-rw-r--r--libdbusmenu-glib/server.c6
-rw-r--r--tests/Makefile.am58
-rw-r--r--tests/run-xvfb.sh7
5 files changed, 137 insertions, 59 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c
index c0ea0d7..eb3b42b 100644
--- a/libdbusmenu-glib/client.c
+++ b/libdbusmenu-glib/client.c
@@ -352,7 +352,7 @@ id_update (DBusGProxy * proxy, guint id, DbusmenuClient * client)
DbusmenuMenuitem * menuitem = dbusmenu_menuitem_find_id(priv->root, id);
g_return_if_fail(menuitem != NULL);
- org_freedesktop_dbusmenu_get_properties_async(proxy, id, menuitem_get_properties_cb, menuitem);
+ org_ayatana_dbusmenu_get_properties_async(proxy, id, menuitem_get_properties_cb, menuitem);
return;
}
@@ -473,7 +473,7 @@ build_proxies (DbusmenuClient * client)
priv->menuproxy = dbus_g_proxy_new_for_name_owner(priv->session_bus,
priv->dbus_name,
priv->dbus_object,
- "org.freedesktop.dbusmenu",
+ "org.ayatana.dbusmenu",
&error);
if (error != NULL) {
g_warning("Unable to get dbusmenu proxy for %s on %s: %s", priv->dbus_name, priv->dbus_object, error->message);
@@ -648,7 +648,7 @@ static void
menuitem_activate (DbusmenuMenuitem * mi, DbusmenuClient * client)
{
DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client);
- org_freedesktop_dbusmenu_call_async (priv->menuproxy, dbusmenu_menuitem_get_id(mi), menuitem_call_cb, mi);
+ org_ayatana_dbusmenu_call_async (priv->menuproxy, dbusmenu_menuitem_get_id(mi), menuitem_call_cb, mi);
return;
}
@@ -690,7 +690,7 @@ parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * it
propdata->item = item;
propdata->parent = parent;
- org_freedesktop_dbusmenu_get_properties_async(proxy, id, menuitem_get_properties_new_cb, propdata);
+ org_ayatana_dbusmenu_get_properties_async(proxy, id, menuitem_get_properties_new_cb, propdata);
} else {
g_warning("Unable to allocate memory to get properties for menuitem. This menuitem will never be realized.");
}
@@ -830,7 +830,7 @@ update_layout (DbusmenuClient * client)
update_layout_cb,
client,
NULL,
- G_TYPE_STRING, "org.freedesktop.dbusmenu",
+ G_TYPE_STRING, "org.ayatana.dbusmenu",
G_TYPE_STRING, "layout",
G_TYPE_INVALID, G_TYPE_VALUE, G_TYPE_INVALID);
diff --git a/libdbusmenu-glib/dbus-menu.xml b/libdbusmenu-glib/dbus-menu.xml
index a198554..e2d872b 100644
--- a/libdbusmenu-glib/dbus-menu.xml
+++ b/libdbusmenu-glib/dbus-menu.xml
@@ -28,12 +28,26 @@ License version 3 and version 2.1 along with this program. If not, see
<http://www.gnu.org/licenses/>
-->
<node name="/">
- <interface name="org.freedesktop.dbusmenu">
+ <interface name="org.ayatana.dbusmenu">
<!-- Properties -->
<!--
+Provides the version of the DBusmenu API that this API is
+implementing.
+-->
+ <property name="version" type="u" access="read"/>
+
+<!-- Functions -->
+
+<!--
Provides an XML representation of the menu hierarchy
+@param parentId The ID of the parent node for the layout. For
+ grabbing the layout from the root node use zero.
+@param revision The revision number of the layout. For matching
+ with layoutUpdated signals.
+@param layout The layout as an XML string of IDs.
+
XML syntax:
<menu id="1" revision="2"> # Root container
@@ -48,76 +62,123 @@ XML syntax:
...
</menu>
-->
+ <method name="GetLayout">
+ <arg type="u" name="parentId" direction="in" />
+ <arg type="u" name="revision" direction="out" />
+ <arg type="s" name="layout" direction="out" />
+ </method>
- <property name="layout" type="s" access="read"/>
+<!--
+Returns the list of items which are children of @a parentId.
- <property name="version" type="u" access="read"/>
+@param Ids A list of ids that we should be finding the properties
+ on. If the list is empty, all menu items should be sent.
+@param propertyNames list of string the list of item properties we
+ are interested in. If there are no entries in the list all of
+ the properties will be sent.
-<!-- Functions -->
+An item is represented as a struct following this format:
+@li id unsigned the item id
+@li properties map(string => variant) the requested item properties
+
+-->
+ <method name="GetGroupProperties">
+ <arg type="au" name="Ids" direction="in" />
+ <arg type="as" name="propertyNames" direction="in" />
+ <arg type="a(ua{sv})" name="properties" direction="out" />
+ </method>
<!--
Each menu item has a set of properties. Property keys are in menuitem.h:
-- visible
-- sensitive
-- label
-- icon
-- icon-data
-- type
-
-"type" property is an enum which can take the following values (client.h):
-
-- menuitem
-- separator
-- imageitem
+@li type string Type of the item (see below)
+@li label string Text of the item
+@li icon-data binary Raw data of the icon (TODO: define format)
+@li icon string Icon name of the item, following icon spec
+@li sensitive boolean Whether the item can be activated or not
+@li visible boolean Whether the item is visible or not (XXX: Is this necessary?)
+@li checked boolean Whether a checkbox or radio item is checked
+@li shortcut string The keyboard shortcut
+
+@c type property is an enum which can take the following values (client.h):
+
+@li action An item which can be clicked to trigger an action
+@li checkbox An item which can be checked or unchecked
+@li radio An item which can be checked or unchecked as part of a group
+@li separator A separator
+@li menu An item which contains more items
-->
<method name="GetProperty">
<arg type="u" name="id" direction="in" />
- <arg type="s" name="property" direction="in" />
+ <arg type="s" name="name" direction="in" />
<arg type="v" name="value" direction="out" />
</method>
<!--
-Convenience method to retrieve all properties in one call (more efficient)
+Returns multiple properties in one call. This is more efficient than
+GetProperty.
+
+@param id unsigned the item whose properties we want to retrieve.
+@param propertyNames list of string name of the properties we want. If the list contains no entries, all properties are sent.
-->
<method name="GetProperties">
+ <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
<arg type="u" name="id" direction="in" />
+ <arg type="as" name="propertyNames" direction="in" />
<arg type="a{sv}" name="properties" direction="out" />
</method>
<!--
-This is called by the display to notify the application it should trigger
-the action associated with a specific menu id
+This is called by the applet to notify the application an event happened on a
+menu item.
+
+@param id the id of the item which received the event
+@param type the type of event
+@param data event-specific data
+
+@a type can be one of the following:
+
+@li "clicked"
+@li "hovered"
+
+Vendor specific events can be added by prefixing them with "x-<vendor>-"
-->
- <method name="Call">
+ <method name="Event">
<arg type="u" name="id" direction="in" />
+ <arg type="s" name="eventId" direction="in" />
+ <arg type="v" name="data" direction="in" />
</method>
<!-- Signals -->
<!--
-Triggered by the application to notify display that the property prop from menu id
-as changed to value.
+Triggered by the application to notify the applet that the property @a property
+from item @a id has changed to @a value.
-->
- <signal name="IdPropUpdate">
+ <signal name="ItemPropertyUpdated">
<arg type="u" name="id" direction="out" />
<arg type="s" name="prop" direction="out" />
<arg type="v" name="value" direction="out" />
</signal>
<!--
-Triggered by the application to notify display that all properties of menu id
-should be considered outdated
+Triggered by the application to notify the applet that all properties of item
+@a id should be considered outdated
-->
- <signal name="IdUpdate">
+ <signal name="ItemUpdated">
<arg type="u" name="id" direction="out" />
</signal>
<!--
Triggered by the application to notify display of a layout update, up to
revision
+@param revsion The revision of the layout that we're currently on
+@param parent If the layout update is only of a subtree, this is the parent
+ item for the entries that have changed. It is zero if the
+ whole layout should be considered invalid.
-->
<signal name="LayoutUpdate">
<arg type="i" name="revision" direction="out" />
+ <arg type="u" name="parent" direction="out" />
</signal>
<!-- End of interesting stuff -->
diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c
index 38ff7fa..7ad9c46 100644
--- a/libdbusmenu-glib/server.c
+++ b/libdbusmenu-glib/server.c
@@ -162,7 +162,7 @@ dbusmenu_server_class_init (DbusmenuServerClass *class)
g_object_class_install_property (object_class, PROP_DBUS_OBJECT,
g_param_spec_string(DBUSMENU_SERVER_PROP_DBUS_OBJECT, "DBus object path",
"The object that represents this set of menus on DBus",
- "/org/freedesktop/dbusmenu",
+ "/org/ayatana/dbusmenu",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class, PROP_ROOT_NODE,
g_param_spec_object(DBUSMENU_SERVER_PROP_ROOT_NODE, "Root menu node",
@@ -473,7 +473,7 @@ _dbusmenu_server_call (DbusmenuServer * server, guint id, GError ** error)
Creates a new #DbusmenuServer object with a specific object
path on DBus. If @object is set to NULL the default object
- name of "/org/freedesktop/dbusmenu" will be used.
+ name of "/org/ayatana/dbusmenu" will be used.
Return value: A brand new #DbusmenuServer
*/
@@ -481,7 +481,7 @@ DbusmenuServer *
dbusmenu_server_new (const gchar * object)
{
if (object == NULL) {
- object = "/org/freedesktop/dbusmenu";
+ object = "/org/ayatana/dbusmenu";
}
DbusmenuServer * self = g_object_new(DBUSMENU_TYPE_SERVER,
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 10fe857..f54aa6b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -2,12 +2,12 @@
DBUS_RUNNER=dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf
TESTS = \
- test-mago \
test-glib-layout \
test-glib-properties \
- test-gtk-label \
test-glib-simple-items \
- test-gtk-reorder
+ test-gtk-label \
+ test-gtk-reorder \
+ test-mago
check_PROGRAMS = \
glib-server-nomenu \
@@ -20,6 +20,12 @@ check_PROGRAMS = \
test-glib-simple-items \
test-gtk-reorder-server
+XVFB_RUN=". $(srcdir)/run-xvfb.sh"
+
+######################
+# Test GLib server
+######################
+
glib_server_nomenu_SOURCES = \
glib-server-nomenu.c
@@ -36,9 +42,9 @@ glib_server_nomenu_LDADD = \
######################
test-glib-layout: test-glib-layout-client test-glib-layout-server Makefile.am
- @echo "#!/bin/sh" > test-glib-layout
- @echo $(DBUS_RUNNER) --task ./test-glib-layout-client --task-name Client --task ./test-glib-layout-server --task-name Server --ignore-return >> test-glib-layout
- @chmod +x test-glib-layout
+ @echo "#!/bin/bash" > $@
+ @echo $(DBUS_RUNNER) --task ./test-glib-layout-client --task-name Client --task ./test-glib-layout-server --task-name Server --ignore-return >> $@
+ @chmod +x $@
test_glib_layout_server_SOURCES = \
test-glib-layout.h \
@@ -70,9 +76,9 @@ test_glib_layout_client_LDADD = \
######################
test-glib-properties: test-glib-properties-client test-glib-properties-server Makefile.am
- @echo "#!/bin/sh" > test-glib-properties
- @echo $(DBUS_RUNNER) --task ./test-glib-properties-client --task-name Client --task ./test-glib-properties-server --task-name Server --ignore-return >> test-glib-properties
- @chmod +x test-glib-properties
+ @echo "#!/bin/bash" > $@
+ @echo $(DBUS_RUNNER) --task ./test-glib-properties-client --task-name Client --task ./test-glib-properties-server --task-name Server --ignore-return >> $@
+ @chmod +x $@
test_glib_properties_server_SOURCES = \
test-glib-properties.h \
@@ -118,9 +124,10 @@ test_glib_simple_items_LDADD = \
#########################
test-gtk-label: test-gtk-label-client test-gtk-label-server test-gtk-label.json Makefile.am
- @echo "#!/bin/sh" > test-gtk-label
- @echo $(DBUS_RUNNER) --task ./test-gtk-label-client --task-name Client --task ./test-gtk-label-server --parameter $(srcdir)/test-gtk-label.json --task-name Server --ignore-return >> test-gtk-label
- @chmod +x test-gtk-label
+ @echo "#!/bin/bash" > $@
+ @echo $(XVFB_RUN) >> $@
+ @echo $(DBUS_RUNNER) --task ./test-gtk-label-client --task-name Client --task ./test-gtk-label-server --parameter $(srcdir)/test-gtk-label.json --task-name Server --ignore-return >> $@
+ @chmod +x $@
test_gtk_label_server_SOURCES = \
test-gtk-label-server.c
@@ -157,9 +164,10 @@ test_gtk_label_client_LDADD = \
#########################
test-gtk-reorder: test-gtk-label-client test-gtk-reorder-server Makefile.am
- @echo "#!/bin/sh" > test-gtk-reorder
- @echo $(DBUS_RUNNER) --task ./test-gtk-label-client --task-name Client --task ./test-gtk-reorder-server --parameter $(srcdir)/test-gtk-label.json --task-name Server --ignore-return >> test-gtk-reorder
- @chmod +x test-gtk-reorder
+ @echo "#!/bin/bash" > $@
+ @echo $(XVFB_RUN) >> $@
+ @echo $(DBUS_RUNNER) --task ./test-gtk-label-client --task-name Client --task ./test-gtk-reorder-server --parameter $(srcdir)/test-gtk-label.json --task-name Server --ignore-return >> $@
+ @chmod +x $@
test_gtk_reorder_server_SOURCES = \
test-gtk-reorder-server.c
@@ -181,13 +189,15 @@ test_gtk_reorder_server_LDADD = \
#########################
test-mago: test-gtk-label-client test-gtk-label-server $(srcdir)/dbusmenu-gtk/mago_tests/dbusmenu.xml Makefile.am
- @echo "#!/bin/sh" > test-mago
- @echo cd $(srcdir)/dbusmenu-gtk >> test-mago
- @echo echo Mago Results dir: $(abs_builddir)/mago.results >> test-mago
- @echo echo PYTHONPATH=$(abs_srcdir)/dbusmenu-gtk/mago_tests >> test-mago
- @echo export INDICATOR_BUILD_DIR=$(abs_builddir) >> test-mago
- @echo PYTHONPATH=$(abs_srcdir)/dbusmenu-gtk/mago_tests mago -f dbusmenu.xml -t $(abs_builddir)/mago.results --log-level=debug >> test-mago
- @chmod +x test-mago
+ @echo "#!/bin/bash" > $@
+ @echo $(XVFB_RUN) >> $@
+ @echo cd $(srcdir)/dbusmenu-gtk >> $@
+ @echo /usr/lib/at-spi/at-spi-registryd \& >> $@
+ @echo echo Mago Results dir: $(abs_builddir)/mago.results >> $@
+ @echo echo PYTHONPATH=$(abs_srcdir)/dbusmenu-gtk/mago_tests >> $@
+ @echo export INDICATOR_BUILD_DIR=$(abs_builddir) >> $@
+ @echo PYTHONPATH=$(abs_srcdir)/dbusmenu-gtk/mago_tests mago -f dbusmenu.xml -t $(abs_builddir)/mago.results --log-level=debug >> $@
+ @chmod +x $@
#########################
# Other
@@ -200,6 +210,7 @@ examples_DATA = \
EXTRA_DIST = \
$(examples_DATA) \
+ run-xvfb.sh \
test-gtk-label.json \
dbusmenu-gtk/dbusMenuTest \
dbusmenu-gtk/mago_tests/dbusmenu.xml \
@@ -222,11 +233,10 @@ EXTRA_DIST = \
dbusmenu-gtk/mago_tests/data/test-gtk-label.json
CLEANFILES = \
- dbusmenu-gtk/mago_tests/dbusmenu.xml \
dbusmenu-gtk/mago_tests/dbusmenu.pyc
distclean-local:
- -rm -rf $(builddir)/dbusmenu-gtk/mago.results
+ -rm -rf $(builddir)/mago.results
DISTCLEANFILES = \
$(TESTS)
diff --git a/tests/run-xvfb.sh b/tests/run-xvfb.sh
new file mode 100644
index 0000000..3622dbf
--- /dev/null
+++ b/tests/run-xvfb.sh
@@ -0,0 +1,7 @@
+if [ "$DISPLAY" == "" ]; then
+Xvfb -ac -noreset -screen 0 800x600x16 -help 2>/dev/null 1>&2
+XID=`for id in 101 102 103 104 105 106 107 197 199 211 223 227 293 307 308 309 310 311 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 4703 4721 4723 4729 4733 4751 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 ; do test -e /tmp/.X$id-lock || { echo $id; exit 0; }; done; exit 1`
+{ Xvfb -ac -noreset -screen 0 800x600x16 :$XID -screen 0 800x600x16 -nolisten tcp -auth /dev/null >/dev/null 2>&1 & trap "kill -15 $! " 0 HUP INT QUIT TRAP USR1 PIPE TERM ; } || { echo "Gtk+Tests:ERROR: Failed to start Xvfb environment for X11 target tests."; exit 1; }
+DISPLAY=:$XID
+export DISPLAY
+fi