aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdbusmenu-glib/Makefile.am1
-rw-r--r--libdbusmenu-glib/client.c3
-rw-r--r--libdbusmenu-glib/dbus-menu.xml120
-rw-r--r--libdbusmenu-glib/menuitem-private.h40
-rw-r--r--libdbusmenu-glib/menuitem.c1
-rw-r--r--libdbusmenu-glib/menuitem.h2
-rw-r--r--libdbusmenu-glib/server.c1
7 files changed, 138 insertions, 30 deletions
diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am
index e74b9ab..fc37019 100644
--- a/libdbusmenu-glib/Makefile.am
+++ b/libdbusmenu-glib/Makefile.am
@@ -22,6 +22,7 @@ libdbusmenu_glib_la_SOURCES = \
menuitem.c \
menuitem-marshal.h \
menuitem-marshal.c \
+ menuitem-private.h \
server.h \
server.c \
server-marshal.h \
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c
index 61f1ccf..eb3b42b 100644
--- a/libdbusmenu-glib/client.c
+++ b/libdbusmenu-glib/client.c
@@ -34,6 +34,7 @@ License version 3 and version 2.1 along with this program. If not, see
#include <libxml/tree.h>
#include "client.h"
+#include "menuitem.h"
#include "dbusmenu-client.h"
#include "server-marshal.h"
@@ -606,7 +607,7 @@ menuitem_get_properties_new_cb (DBusGProxy * proxy, GHashTable * properties, GEr
const gchar * type;
DbusmenuClientTypeHandler newfunc = NULL;
- type = dbusmenu_menuitem_property_get(propdata->item, "type");
+ type = dbusmenu_menuitem_property_get(propdata->item, DBUSMENU_MENUITEM_PROP_TYPE);
if (type != NULL) {
newfunc = g_hash_table_lookup(priv->type_handlers, type);
} else {
diff --git a/libdbusmenu-glib/dbus-menu.xml b/libdbusmenu-glib/dbus-menu.xml
index 345c736..e2d872b 100644
--- a/libdbusmenu-glib/dbus-menu.xml
+++ b/libdbusmenu-glib/dbus-menu.xml
@@ -32,8 +32,22 @@ License version 3 and version 2.1 along with this program. If not, see
<!-- 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,73 +62,123 @@ XML syntax:
...
</menu>
-->
- <property name="layout" type="s" access="read"/>
-
-<!-- Functions -->
+ <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>
<!--
-Each menu item has a set of properties. Property keys are in menuitem.h:
+Returns the list of items which are children of @a parentId.
-- visible
-- sensitive
-- label
-- icon
-- icon-data
-- type
+@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.
-"type" property is an enum which can take the following values (client.h):
+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
-- menuitem
-- separator
-- imageitem
+-->
+ <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:
+
+@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="value" direction="out" />
+ <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="a{ss}" name="properties" direction="out" />
+ <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="s" name="value" 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/menuitem-private.h b/libdbusmenu-glib/menuitem-private.h
new file mode 100644
index 0000000..0120435
--- /dev/null
+++ b/libdbusmenu-glib/menuitem-private.h
@@ -0,0 +1,40 @@
+/*
+A library to communicate a menu object set accross DBus and
+track updates and maintain consistency.
+
+Copyright 2009 Canonical Ltd.
+
+Authors:
+ Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of either or both of the following licenses:
+
+1) the GNU Lesser General Public License version 3, as published by the
+Free Software Foundation; and/or
+2) the GNU Lesser General Public License version 2.1, as published by
+the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the applicable version of the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of both the GNU Lesser General Public
+License version 3 and version 2.1 along with this program. If not, see
+<http://www.gnu.org/licenses/>
+*/
+
+#ifndef __DBUSMENU_MENUITEM_PRIVATE_H__
+#define __DBUSMENU_MENUITEM_PRIVATE_H__
+
+#include "menuitem.h"
+
+G_BEGIN_DECLS
+
+void dbusmenu_menuitem_buildxml (DbusmenuMenuitem * mi, GPtrArray * array, gint revision);
+
+G_END_DECLS
+
+#endif
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c
index fdf5608..d486b53 100644
--- a/libdbusmenu-glib/menuitem.c
+++ b/libdbusmenu-glib/menuitem.c
@@ -31,6 +31,7 @@ License version 3 and version 2.1 along with this program. If not, see
#endif
#include "menuitem.h"
#include "menuitem-marshal.h"
+#include "menuitem-private.h"
#ifdef MASSIVEDEBUGGING
#define LABEL(x) dbusmenu_menuitem_property_get(DBUSMENU_MENUITEM(x), DBUSMENU_MENUITEM_PROP_LABEL)
diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h
index 6c3c265..27a86a2 100644
--- a/libdbusmenu-glib/menuitem.h
+++ b/libdbusmenu-glib/menuitem.h
@@ -50,6 +50,7 @@ G_BEGIN_DECLS
#define DBUSMENU_MENUITEM_SIGNAL_REALIZED "realized"
#define DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID (g_signal_lookup(DBUSMENU_MENUITEM_SIGNAL_REALIZED, DBUSMENU_TYPE_MENUITEM))
+#define DBUSMENU_MENUITEM_PROP_TYPE "type"
#define DBUSMENU_MENUITEM_PROP_VISIBLE "visible"
#define DBUSMENU_MENUITEM_PROP_SENSITIVE "sensitive"
#define DBUSMENU_MENUITEM_PROP_LABEL "label"
@@ -136,7 +137,6 @@ GHashTable * dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi);
void dbusmenu_menuitem_set_root (DbusmenuMenuitem * mi, gboolean root);
gboolean dbusmenu_menuitem_get_root (DbusmenuMenuitem * mi);
-void dbusmenu_menuitem_buildxml (DbusmenuMenuitem * mi, GPtrArray * array, gint revision);
void dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem * mi, gpointer data), gpointer data);
void dbusmenu_menuitem_activate (DbusmenuMenuitem * mi);
diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c
index 84bfffe..7ad9c46 100644
--- a/libdbusmenu-glib/server.c
+++ b/libdbusmenu-glib/server.c
@@ -30,6 +30,7 @@ License version 3 and version 2.1 along with this program. If not, see
#include "config.h"
#endif
+#include "menuitem-private.h"
#include "server.h"
#include "server-marshal.h"