ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #01913
[Merge] lp:~ted/indicator-appmenu/dbus-api-migration into lp:indicator-appmenu
Ted Gould has proposed merging lp:~ted/indicator-appmenu/dbus-api-migration into lp:indicator-appmenu.
Requested reviews:
Indicator Applet Developers (indicator-applet-developers)
This migrates Indicator Appmenu over to the "AppMenu" Dbus API.
--
https://code.launchpad.net/~ted/indicator-appmenu/dbus-api-migration/+merge/30474
Your team ayatana-commits is subscribed to branch lp:indicator-appmenu.
=== modified file 'scripts/menu-pusher.c'
--- scripts/menu-pusher.c 2010-06-21 20:42:00 +0000
+++ scripts/menu-pusher.c 2010-07-20 21:51:16 +0000
@@ -79,7 +79,7 @@
DBusGProxy * proxy = dbus_g_proxy_new_for_name_owner(session, DBUS_NAME, REG_OBJECT, REG_IFACE, NULL);
g_return_val_if_fail(proxy != NULL, 1);
- org_ayatana_WindowMenu_Registrar_register_window(proxy, 0, "/this/is/a/long/object/path", NULL);
+ org_ayatana_AppMenu_Registrar_register_window(proxy, 0, "/this/is/a/long/object/path", NULL);
gtk_main();
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2010-06-01 16:38:23 +0000
+++ src/Makefile.am 2010-07-20 21:51:16 +0000
@@ -35,7 +35,7 @@
######################################
DBUS_SPECS = \
- application-menu-debug.xml \
+ application-menu-renderer.xml \
application-menu-registrar.xml
%-client.h: %.xml
=== modified file 'src/application-menu-registrar.xml'
--- src/application-menu-registrar.xml 2010-05-07 09:14:49 +0000
+++ src/application-menu-registrar.xml 2010-07-20 21:51:16 +0000
@@ -1,13 +1,83 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<node name="/">
- <interface name="org.ayatana.WindowMenu.Registrar">
-
-<!-- Methods -->
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node xmlns:dox="http://www.ayatana.org/dbus/dox.dtd">
+ <dox:d><![CDATA[
+ @mainpage
+ Â
+ An interface to register menus that are associated with a window in an application. The
+ main interface is docuemented here: @ref org::ayatana::AppMenu::Registrar.
+ Â Â Â Â
+ The actual menus are transported using the dbusmenu protocol which is available
+ here: @ref org::ayatana::dbusmenu.
+ ]]></dox:d>
+ <interface name="org.ayatana.AppMenu.Registrar">
+ <dox:d>
+ An interface to register a menu from an application's window to be displayed in another
+ window. This manages that association between XWindow Window IDs and the dbus
+ address and object that provides the menu using the dbusmenu dbus interface.
+ </dox:d>
<method name="RegisterWindow">
<annotation name="org.freedesktop.DBus.GLib.Async" value="true" />
- <arg type="u" name="windowID" direction="in" />
- <arg type="o" name="path" direction="in" />
- </method>
-
+ <dox:d><![CDATA[
+ Associates a dbusmenu with a window
+ Â Â Â Â Â
+ /note this method assumes that the connection from the caller is the DBus connection
+ to use for the object. Applications that use multiple DBus connections will need to
+ ensure this method is called with the same connection that implmenets the object.
+ ]]></dox:d>
+ <arg name="windowId" type="u" direction="in">
+ <dox:d>The XWindow ID of the window</dox:d>
+ </arg>
+ <arg name="menuObjectPath" type="o" direction="in">
+ <dox:d>The object on the dbus interface implementing the dbusmenu interface</dox:d>
+ </arg>
+ </method>
+ <method name="UnregisterWindow">
+ <dox:d>
+ A method to allow removing a window from the database. Windows will also be removed
+ when the client drops off DBus so this is not required. It is polite though. And
+ important for testing.
+ </dox:d>
+ <arg name="windowId" type="u" direction="in">
+ <dox:d>The XWindow ID of the window</dox:d>
+ </arg>
+ </method>
+ <method name="GetMenuForWindow">
+ <dox:d>Gets the registered menu for a given window ID.</dox:d>
+ <arg name="windowId" type="u" direction="in">
+ <dox:d>The XWindow ID of the window to get</dox:d>
+ </arg>
+ <arg name="service" type="s" direction="out">
+ <dox:d>The address of the connection on DBus (e.g. :1.23 or org.example.service)</dox:d>
+ </arg>
+ <arg name="menuObjectPath" type="o" direction="out">
+ <dox:d>The path to the object which implements the org.ayatana.dbusmenu interface.</dox:d>
+ </arg>
+ </method>
+ <method name="GetMenus">
+ <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MenuInfoList"/>
+ <dox:d>Gets the information on all menus that the registrar knows about. This
+ is useful for debugging or bringing up a new renderer.</dox:d>
+ <arg name="menus" type="a(uso)" direction="out">
+ <dox:d>An array of structures containing the same parameters as @GetMenuForWindow. Window ID, Service and ObjectPath.</dox:d>
+ </arg>
+ </method>
+ <signal name="WindowRegistered">
+ <dox:d>Signals when the registrar gets a new menu registered</dox:d>
+ <arg name="windowId" type="u" direction="out">
+ <dox:d>The XWindow ID of the window</dox:d>
+ </arg>
+ <arg name="service" type="s" direction="out">
+ <dox:d>The address of the connection on DBus (e.g. :1.23 or org.example.service)</dox:d>
+ </arg>
+ <arg name="menuObjectPath" type="o" direction="out">
+ <dox:d>The path to the object which implements the org.ayatana.dbusmenu interface.</dox:d>
+ </arg>
+ </signal>
+ <signal name="WindowUnregistered">
+ <dox:d>Signals when the registrar removes a menu registration</dox:d>
+ <arg name="windowId" type="u" direction="out">
+ <dox:d>The XWindow ID of the window</dox:d>
+ </arg>
+ </signal>
</interface>
</node>
=== renamed file 'src/application-menu-debug.xml' => 'src/application-menu-renderer.xml'
--- src/application-menu-debug.xml 2010-07-01 18:16:57 +0000
+++ src/application-menu-renderer.xml 2010-07-20 21:51:16 +0000
@@ -1,20 +1,61 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<node name="/">
- <interface name="org.ayatana.AppMenu.Debug">
-
-<!-- Methods -->
- <method name="CurrentMenu">
- <arg type="u" name="windowID" direction="out" />
- <arg type="o" name="path" direction="out" />
- <arg type="s" name="address" direction="out" />
- </method>
- <method name="AllMenus">
- <arg type="a(uos)" name="menus" direction="out" />
- </method>
- <method name="JSONDump">
- <arg type="u" name="windowID" direction="in" />
- <arg type="s" name="menu-json" direction="out" />
- </method>
-
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node name="/org/ayatana/AppMenu/Renderer">
+ <dox:d><![CDATA[
+ @mainpage
+ Â
+ A representation of the process used to render a menu into something visible
+ to the user. Many times this will be combined with a Registrar
+ (@ref org::ayatana::AppMenu::Registrar) but that is not required. The interface
+ implemented by the Renderer is here: @ref org::ayatana::AppMenu::Registrar and
+ used mostly for debugging the status of and testing the renderers.
+ Â Â Â Â
+ The actual menus are transported using the dbusmenu protocol which is available
+ here: @ref org::ayatana::dbusmenu.
+ ]]></dox:d>
+ <interface name="org.ayatana.AppMenu.Renderer">
+ <dox:d>
+ An interface to register a menu from an application's window to be displayed in another
+ window. This manages that association between XWindow Window IDs and the dbus
+ address and object that provides the menu using the dbusmenu dbus interface.
+ </dox:d>
+ <method name="GetCurrentMenu">
+ <dox:d>Get the location of the menu currently being displayed to the user.</dox:d>
+ <arg name="service" type="s" direction="out">
+ <dox:d>The address of the connection on DBus (e.g. :1.23 or org.example.service)</dox:d>
+ </arg>
+ <arg name="menuObjectPath" type="o" direction="out">
+ <dox:d>The path to the object which implements the org.ayatana.dbusmenu interface.</dox:d>
+ </arg>
+ </method>
+ <method name="ActivateMenuItem">
+ <dox:d>Activate menus via DBus</dox:d>
+ <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QList<int>"/>
+ <arg name="menuItemPath" type="ai" direction="in">
+ <dox:d>
+ An array of indexes of how to get to the menu item to activate. The list only
+ includes menu items that are visible to the user. So if the array was something
+ like [1, 2] it would be the first submenu, second item as if you looked at the
+ menu using a mouse.
+ </dox:d>
+ </arg>
+ </method>
+ <method name="DumpCurrentMenu">
+ <dox:d>Turns the currently displayed menu into a JSON representation</dox:d>
+ <arg name="json" type="s" direction="out">
+ <dox:d>
+ JSON describing the menu structure rendered by the renderer. The format is
+ described in the website https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationMenuXdTests#JSON%20format
+ </dox:d>
+ </arg>
+ </method>
+ <method name="DumpMenu">
+ <dox:d>Dumps JSON data describing the menus from a specific window.</dox:d>
+ <arg name="windowId" type="u" direction="in">
+ <dox:d>The XWindow ID of the window to get</dox:d>
+ </arg>
+ <arg name="json" type="s" direction="out">
+ <dox:d>JSON describing the menu structure rendered by the renderer. Look at @DumpCurrentMenu for more information.</dox:d>
+ </arg>
+ </method>
</interface>
</node>
=== modified file 'src/dbus-shared.h'
--- src/dbus-shared.h 2010-06-01 16:28:51 +0000
+++ src/dbus-shared.h 2010-07-20 21:51:16 +0000
@@ -20,11 +20,11 @@
*/
-#define DBUS_NAME "org.ayatana.WindowMenu.Registrar"
-
-#define REG_IFACE "org.ayatana.WindowMenu.Registrar"
-#define REG_OBJECT "/org/ayatana/WindowMenu/Registrar"
-
-#define DEBUG_IFACE "org.ayatana.AppMenu.Debug"
-#define DEBUG_OBJECT "/org/ayatana/AppMenu/Debug"
+#define DBUS_NAME "org.ayatana.AppMenu.Registrar"
+
+#define REG_IFACE "org.ayatana.AppMenu.Registrar"
+#define REG_OBJECT "/org/ayatana/AppMenu/Registrar"
+
+#define DEBUG_IFACE "org.ayatana.AppMenu.Renderer"
+#define DEBUG_OBJECT "/org/ayatana/AppMenu/Renderer"
=== modified file 'src/indicator-appmenu-marshal.list'
--- src/indicator-appmenu-marshal.list 2010-05-07 08:49:13 +0000
+++ src/indicator-appmenu-marshal.list 2010-07-20 21:51:16 +0000
@@ -1,1 +1,2 @@
-VOID: UINT, STRING
+VOID: UINT, STRING, BOXED
+VOID: UINT
=== modified file 'src/indicator-appmenu.c'
--- src/indicator-appmenu.c 2010-07-10 04:40:29 +0000
+++ src/indicator-appmenu.c 2010-07-20 21:51:16 +0000
@@ -63,8 +63,8 @@
struct _IndicatorAppmenuClass {
IndicatorObjectClass parent_class;
- void (*window_registered) (IndicatorAppmenu * iapp, guint wid, gchar * path, gpointer user_data);
- void (*window_unregistered) (IndicatorAppmenu * iapp, guint wid, gchar * path, gpointer user_data);
+ void (*window_registered) (IndicatorAppmenu * iapp, guint wid, gchar * address, gpointer path, gpointer user_data);
+ void (*window_unregistered) (IndicatorAppmenu * iapp, guint wid, gpointer user_data);
};
struct _IndicatorAppmenu {
@@ -129,6 +129,17 @@
guint windowid,
const gchar * objectpath,
DBusGMethodInvocation * method);
+static gboolean _application_menu_registrar_server_unregister_window (IndicatorAppmenu * iapp,
+ guint windowid,
+ GError ** error);
+static gboolean _application_menu_registrar_server_get_menu_for_window (IndicatorAppmenu * iapp,
+ guint windowid,
+ gchar ** objectpath,
+ gchar ** address,
+ GError ** error);
+static gboolean _application_menu_registrar_server_get_menus (IndicatorAppmenu * iapp,
+ GPtrArray ** entries,
+ GError ** error);
static void request_name_cb (DBusGProxy *proxy,
guint result,
GError *error,
@@ -143,24 +154,34 @@
BamfView * oldview,
BamfView * newview,
gpointer user_data);
-static gboolean _application_menu_debug_server_current_menu (IndicatorAppmenuDebug * iappd,
- guint * windowid,
+static gboolean _application_menu_renderer_server_get_current_menu (IndicatorAppmenuDebug * iappd,
gchar ** objectpath,
gchar ** address,
GError ** error);
-static gboolean _application_menu_debug_server_all_menus (IndicatorAppmenuDebug * iappd,
- GPtrArray ** entries,
- GError ** error);
-static gboolean _application_menu_debug_server_j_so_ndump (IndicatorAppmenuDebug * iappd,
+static gboolean _application_menu_renderer_server_activate_menu_item (IndicatorAppmenuDebug * iappd,
+ GArray * menulist,
+ GError ** error);
+static gboolean _application_menu_renderer_server_dump_current_menu (IndicatorAppmenuDebug * iappd,
+ gchar ** jsondata,
+ GError ** error);
+static gboolean _application_menu_renderer_server_dump_menu (IndicatorAppmenuDebug * iappd,
guint windowid,
gchar ** jsondata,
GError ** error);
+static GQuark error_quark (void);
+
+/* Unique error codes for debug interface */
+enum {
+ ERROR_NO_APPLICATIONS,
+ ERROR_NO_DEFAULT_APP,
+ ERROR_WINDOW_NOT_FOUND
+};
/**********************
DBus Interfaces
**********************/
#include "application-menu-registrar-server.h"
-#include "application-menu-debug-server.h"
+#include "application-menu-renderer-server.h"
enum {
WINDOW_REGISTERED,
@@ -191,15 +212,15 @@
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicatorAppmenuClass, window_registered),
NULL, NULL,
- _indicator_appmenu_marshal_VOID__UINT_STRING,
- G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING);
+ _indicator_appmenu_marshal_VOID__UINT_STRING_BOXED,
+ G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_STRING, DBUS_TYPE_G_OBJECT_PATH);
signals[WINDOW_UNREGISTERED] = g_signal_new("window-unregistered",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (IndicatorAppmenuClass, window_unregistered),
NULL, NULL,
- _indicator_appmenu_marshal_VOID__UINT_STRING,
- G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING);
+ _indicator_appmenu_marshal_VOID__UINT,
+ G_TYPE_NONE, 1, G_TYPE_UINT);
dbus_g_object_type_install_info(INDICATOR_APPMENU_TYPE, &dbus_glib__application_menu_registrar_server_object_info);
@@ -320,7 +341,7 @@
static void
indicator_appmenu_debug_class_init (IndicatorAppmenuDebugClass *klass)
{
- dbus_g_object_type_install_info(INDICATOR_APPMENU_DEBUG_TYPE, &dbus_glib__application_menu_debug_server_object_info);
+ dbus_g_object_type_install_info(INDICATOR_APPMENU_DEBUG_TYPE, &dbus_glib__application_menu_renderer_server_object_info);
return;
}
@@ -674,17 +695,18 @@
static gboolean
_application_menu_registrar_server_register_window (IndicatorAppmenu * iapp, guint windowid, const gchar * objectpath, DBusGMethodInvocation * method)
{
- g_debug("Registering window ID %d with path %s from %s", windowid, objectpath, dbus_g_method_get_sender(method));
+ const gchar * sender = dbus_g_method_get_sender(method);
+ g_debug("Registering window ID %d with path %s from %s", windowid, objectpath, sender);
if (g_hash_table_lookup(iapp->apps, GUINT_TO_POINTER(windowid)) == NULL && windowid != 0) {
- WindowMenus * wm = window_menus_new(windowid, dbus_g_method_get_sender(method), objectpath);
+ WindowMenus * wm = window_menus_new(windowid, sender, objectpath);
g_return_val_if_fail(wm != NULL, FALSE);
g_signal_connect(G_OBJECT(wm), WINDOW_MENUS_SIGNAL_DESTROY, G_CALLBACK(menus_destroyed), iapp);
g_hash_table_insert(iapp->apps, GUINT_TO_POINTER(windowid), wm);
- g_signal_emit(G_OBJECT(iapp), signals[WINDOW_REGISTERED], 0, windowid, objectpath, TRUE);
+ g_signal_emit(G_OBJECT(iapp), signals[WINDOW_REGISTERED], 0, windowid, sender, objectpath, TRUE);
/* Note: Does not cause ref */
BamfWindow * win = bamf_matcher_get_active_window(iapp->matcher);
@@ -692,9 +714,9 @@
active_window_changed(iapp->matcher, NULL, BAMF_VIEW(win), iapp);
} else {
if (windowid == 0) {
- g_warning("Can't build windows for a NULL window ID %d with path %s from %s", windowid, objectpath, dbus_g_method_get_sender(method));
+ g_warning("Can't build windows for a NULL window ID %d with path %s from %s", windowid, objectpath, sender);
} else {
- g_warning("Already have a menu for window ID %d with path %s from %s", windowid, objectpath, dbus_g_method_get_sender(method));
+ g_warning("Already have a menu for window ID %d with path %s from %s", windowid, objectpath, sender);
}
}
@@ -702,6 +724,80 @@
return TRUE;
}
+/* Kindly remove an entry from our DB */
+static gboolean
+_application_menu_registrar_server_unregister_window (IndicatorAppmenu * iapp, guint windowid, GError ** error)
+{
+ /* TODO: Do it */
+
+ return FALSE;
+}
+
+/* Grab the menu information for a specific window */
+static gboolean
+_application_menu_registrar_server_get_menu_for_window (IndicatorAppmenu * iapp, guint windowid, gchar ** objectpath, gchar ** address, GError ** error)
+{
+ WindowMenus * wm = NULL;
+
+ if (windowid == 0) {
+ wm = iapp->default_app;
+ } else {
+ wm = WINDOW_MENUS(g_hash_table_lookup(iapp->apps, GUINT_TO_POINTER(windowid)));
+ }
+
+ if (wm == NULL) {
+ g_set_error_literal(error, error_quark(), ERROR_WINDOW_NOT_FOUND, "Window not found");
+ return FALSE;
+ }
+
+ *objectpath = window_menus_get_path(wm);
+ *address = window_menus_get_address(wm);
+
+ return TRUE;
+}
+
+/* Get all the menus we have */
+static gboolean
+_application_menu_registrar_server_get_menus (IndicatorAppmenu * iapp, GPtrArray ** entries, GError ** error)
+{
+ if (iapp->apps == NULL) {
+ g_set_error_literal(error, error_quark(), ERROR_NO_APPLICATIONS, "No applications are registered");
+ return FALSE;
+ }
+
+ *entries = g_ptr_array_new();
+
+ GList * appkeys = NULL;
+ for (appkeys = g_hash_table_get_keys(iapp->apps); appkeys != NULL; appkeys = g_list_next(appkeys)) {
+ GValueArray * structval = g_value_array_new(3);
+ gpointer hash_val = g_hash_table_lookup(iapp->apps, appkeys->data);
+
+ if (hash_val == NULL) { continue; }
+
+ GValue winid = {0};
+ g_value_init(&winid, G_TYPE_UINT);
+ g_value_set_uint(&winid, window_menus_get_xid(WINDOW_MENUS(hash_val)));
+ g_value_array_append(structval, &winid);
+ g_value_unset(&winid);
+
+ GValue path = {0};
+ g_value_init(&path, DBUS_TYPE_G_OBJECT_PATH);
+ g_value_take_boxed(&path, window_menus_get_path(WINDOW_MENUS(hash_val)));
+ g_value_array_append(structval, &path);
+ g_value_unset(&path);
+
+ GValue address = {0};
+ g_value_init(&address, G_TYPE_STRING);
+ g_value_take_string(&address, window_menus_get_address(WINDOW_MENUS(hash_val)));
+ g_value_array_append(structval, &address);
+ g_value_unset(&address);
+
+ g_ptr_array_add(*entries, structval);
+ }
+
+ return TRUE;
+}
+
/* Response to whether we got our name or not */
static void
request_name_cb (DBusGProxy *proxy, guint result, GError * inerror, gpointer userdata)
@@ -763,75 +859,6 @@
return error_quark;
}
-/* Unique error codes for debug interface */
-enum {
- ERROR_NO_APPLICATIONS,
- ERROR_NO_DEFAULT_APP,
- ERROR_WINDOW_NOT_FOUND
-};
-
-/* Get the current menu */
-static gboolean
-_application_menu_debug_server_current_menu (IndicatorAppmenuDebug * iappd, guint * windowid, gchar ** objectpath, gchar ** address, GError ** error)
-{
- IndicatorAppmenu * iapp = iappd->appmenu;
-
- if (iapp->default_app == NULL) {
- g_set_error_literal(error, error_quark(), ERROR_NO_DEFAULT_APP, "Not currently showing an application");
- return FALSE;
- }
-
- *windowid = window_menus_get_xid(iapp->default_app);
- *objectpath = window_menus_get_path(iapp->default_app);
- *address = window_menus_get_address(iapp->default_app);
-
- return TRUE;
-}
-
-/* Get all the menus we have */
-static gboolean
-_application_menu_debug_server_all_menus(IndicatorAppmenuDebug * iappd, GPtrArray ** entries, GError ** error)
-{
- IndicatorAppmenu * iapp = iappd->appmenu;
-
- if (iapp->apps == NULL) {
- g_set_error_literal(error, error_quark(), ERROR_NO_APPLICATIONS, "No applications are registered");
- return FALSE;
- }
-
- *entries = g_ptr_array_new();
-
- GList * appkeys = NULL;
- for (appkeys = g_hash_table_get_keys(iapp->apps); appkeys != NULL; appkeys = g_list_next(appkeys)) {
- GValueArray * structval = g_value_array_new(3);
- gpointer hash_val = g_hash_table_lookup(iapp->apps, appkeys->data);
-
- if (hash_val == NULL) { continue; }
-
- GValue winid = {0};
- g_value_init(&winid, G_TYPE_UINT);
- g_value_set_uint(&winid, window_menus_get_xid(WINDOW_MENUS(hash_val)));
- g_value_array_append(structval, &winid);
- g_value_unset(&winid);
-
- GValue path = {0};
- g_value_init(&path, DBUS_TYPE_G_OBJECT_PATH);
- g_value_take_boxed(&path, window_menus_get_path(WINDOW_MENUS(hash_val)));
- g_value_array_append(structval, &path);
- g_value_unset(&path);
-
- GValue address = {0};
- g_value_init(&address, G_TYPE_STRING);
- g_value_take_string(&address, window_menus_get_address(WINDOW_MENUS(hash_val)));
- g_value_array_append(structval, &address);
- g_value_unset(&address);
-
- g_ptr_array_add(*entries, structval);
- }
-
- return TRUE;
-}
-
/* Looks to see if we can find an accel label to steal the
closure from */
static void
@@ -1040,9 +1067,42 @@
return;
}
-/* Make JSON out of our menus */
-static gboolean
-_application_menu_debug_server_j_so_ndump (IndicatorAppmenuDebug * iappd, guint windowid, gchar ** jsondata, GError ** error)
+/* Grab the location of the dbusmenu of the current menu */
+static gboolean
+_application_menu_renderer_server_get_current_menu (IndicatorAppmenuDebug * iappd, gchar ** objectpath, gchar ** address, GError ** error)
+{
+ IndicatorAppmenu * iapp = iappd->appmenu;
+
+ if (iapp->default_app == NULL) {
+ g_set_error_literal(error, error_quark(), ERROR_NO_DEFAULT_APP, "Not currently showing an application");
+ return FALSE;
+ }
+
+ *objectpath = window_menus_get_path(iapp->default_app);
+ *address = window_menus_get_address(iapp->default_app);
+
+ return TRUE;
+}
+
+/* Activate menu items through a script given as a parameter */
+static gboolean
+_application_menu_renderer_server_activate_menu_item (IndicatorAppmenuDebug * iappd, GArray * menulist, GError ** error)
+{
+ /* TODO: Do it */
+
+ return FALSE;
+}
+
+/* Dump the current menu to a JSON file */
+static gboolean
+_application_menu_renderer_server_dump_current_menu (IndicatorAppmenuDebug * iappd, gchar ** jsondata, GError ** error)
+{
+ return _application_menu_renderer_server_dump_menu(iappd, 0, jsondata, error);
+}
+
+/* Dump a specific window's menus to a JSON file */
+static gboolean
+_application_menu_renderer_server_dump_menu (IndicatorAppmenuDebug * iappd, guint windowid, gchar ** jsondata, GError ** error)
{
IndicatorAppmenu * iapp = iappd->appmenu;
WindowMenus * wm = NULL;
@@ -1109,3 +1169,4 @@
return TRUE;
}
+
=== modified file 'tools/mock-json-app.c'
--- tools/mock-json-app.c 2010-06-29 22:17:00 +0000
+++ tools/mock-json-app.c 2010-07-20 21:51:16 +0000
@@ -57,7 +57,7 @@
return;
}
- org_ayatana_WindowMenu_Registrar_register_window_async(registrar, GDK_WINDOW_XID (gtk_widget_get_window (window)), MENU_PATH, register_cb, NULL);
+ org_ayatana_AppMenu_Registrar_register_window_async(registrar, GDK_WINDOW_XID (gtk_widget_get_window (window)), MENU_PATH, register_cb, NULL);
return;
}
@@ -75,7 +75,7 @@
registrar = dbus_g_proxy_new_for_name(session_bus, DBUS_NAME, REG_OBJECT, REG_IFACE);
g_return_val_if_fail(registrar != NULL, FALSE);
- org_ayatana_WindowMenu_Registrar_register_window_async(registrar, GDK_WINDOW_XID (gtk_widget_get_window (window)), MENU_PATH, register_cb, NULL);
+ org_ayatana_AppMenu_Registrar_register_window_async(registrar, GDK_WINDOW_XID (gtk_widget_get_window (window)), MENU_PATH, register_cb, NULL);
DBusGProxy * dbus_proxy = dbus_g_proxy_new_for_name(session_bus,
DBUS_SERVICE_DBUS,
Follow ups