diff options
author | Ted Gould <ted@gould.cx> | 2010-02-09 22:14:47 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-02-09 22:14:47 -0600 |
commit | 02108a4b99cc120d0543c04e6c0067184ca53889 (patch) | |
tree | 4eb8e4d0d3b728c5fb9c30f019c6509557ecb637 /tests | |
parent | 532e1f0e65e1339b7ba1169065390b2c861e6ac6 (diff) | |
download | libdbusmenu-02108a4b99cc120d0543c04e6c0067184ca53889.tar.gz libdbusmenu-02108a4b99cc120d0543c04e6c0067184ca53889.tar.bz2 libdbusmenu-02108a4b99cc120d0543c04e6c0067184ca53889.zip |
Setting up a client, and handling root changes.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-glib-proxy-proxy.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test-glib-proxy-proxy.c b/tests/test-glib-proxy-proxy.c index 781c13c..93a4b7a 100644 --- a/tests/test-glib-proxy-proxy.c +++ b/tests/test-glib-proxy-proxy.c @@ -7,12 +7,28 @@ #include <libdbusmenu-glib/menuitem.h> #include <libdbusmenu-glib/server.h> +#include <libdbusmenu-glib/client.h> #include "test-glib-proxy.h" static DbusmenuServer * server = NULL; +static DbusmenuClient * client = NULL; static GMainLoop * mainloop = NULL; +void +root_changed (DbusmenuClient * client, DbusmenuMenuitem * newroot, gpointer user_data) +{ + if (newroot == NULL) { + g_debug("Root removed, exiting"); + g_main_loop_quit(mainloop); + return; + } + + DbusmenuMenuitem * pmi;// = dbusmenu_menuitem_proxy_new(newroot); + dbusmenu_server_set_root(server, DBUSMENU_MENUITEM(pmi)); + return; +} + int main (int argc, char ** argv) { @@ -47,6 +63,9 @@ main (int argc, char ** argv) } server = dbusmenu_server_new("/org/test"); + client = dbusmenu_client_new(myproxy, "/org/test"); + + g_signal_connect(client, DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED, G_CALLBACK(root_changed), server); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); |