diff options
author | Ted Gould <ted@canonical.com> | 2008-11-12 21:49:27 -0600 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2008-11-12 21:49:27 -0600 |
commit | b63286e253aea5a176439efbc69efae18112528b (patch) | |
tree | 9eb30f3f37fb7705af08bd6a9a78edcc42bc00b7 /src/menu-dbus.c | |
parent | b4b7ab38fd5990567da2713638e8edcd055e3eec (diff) | |
download | libayatana-indicator-b63286e253aea5a176439efbc69efae18112528b.tar.gz libayatana-indicator-b63286e253aea5a176439efbc69efae18112528b.tar.bz2 libayatana-indicator-b63286e253aea5a176439efbc69efae18112528b.zip |
Starting to build functions to handle the menu spec over DBus
Diffstat (limited to 'src/menu-dbus.c')
-rw-r--r-- | src/menu-dbus.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/menu-dbus.c b/src/menu-dbus.c new file mode 100644 index 0000000..cb4d531 --- /dev/null +++ b/src/menu-dbus.c @@ -0,0 +1,56 @@ + +#include "menu-dbus.h" + +GtkWidget * +_dbus_menu_make_menuitem_val (DBusGProxy * proxy, guint id) +{ + + + +} + +GtkWidget * +_dbus_menu_make_menuitem_recurse (DBusGProxy * proxy, guint id) +{ + GError * error = NULL; + GArray * items = NULL; + gboolean proxyret; + + /* TODO: switch to begin_call */ + proxyret = dbus_g_proxy_call (proxy, "GetSubmenuItems", &error, + G_TYPE_UINT, id, + G_TYPE_INVALID, + DBUS_TYPE_G_UINT_ARRAY, &items, + G_TYPE_INVALID); + + if (!proxyret) { + /* TODO: clear error */ + return NULL; + } + + GtkWidget * menu = gtk_menu_new(); + gint i; + for (i = 0; i < items->len; i++) { + guint id = g_array_index(items, guint, i); + GtkWidget * item = _dbus_menu_make_menuitem_val(proxy, id); + if (item != NULL) { + gtk_menu_append(menu, item); + gtk_widget_show(item); + } + } + + return menu; +} + +GtkWidget * +dbus_menu_make_menuitem (DBusGConnection * bus, const char * name, const char * object, guint menu_id) +{ + DBusGProxy * iface = dbus_g_proxy_new_for_name_owner (bus, name, object, "com.canonical.menu", NULL); + if (iface == NULL) { + return NULL; + } + + return _dbus_menu_make_menuitem_recurse(iface, menu_id); +} + + |