diff options
author | Ted Gould <ted@gould.cx> | 2010-02-19 12:46:47 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-02-19 12:46:47 -0600 |
commit | 981daa0d406ddf15038fc89da6f130cfa7093352 (patch) | |
tree | 4d0e94be8db5423fe9a0520ffda5e656d4cc33dc | |
parent | 2cb8193e66610f848e71e8217181c25ae55fc0e0 (diff) | |
download | libdbusmenu-981daa0d406ddf15038fc89da6f130cfa7093352.tar.gz libdbusmenu-981daa0d406ddf15038fc89da6f130cfa7093352.tar.bz2 libdbusmenu-981daa0d406ddf15038fc89da6f130cfa7093352.zip |
Changing from a timeout to a signal of change.
-rw-r--r-- | tests/test-glib-proxy-server.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/test-glib-proxy-server.c b/tests/test-glib-proxy-server.c index cba8ec7..7dcae52 100644 --- a/tests/test-glib-proxy-server.c +++ b/tests/test-glib-proxy-server.c @@ -71,7 +71,7 @@ static DbusmenuServer * server = NULL; static GMainLoop * mainloop = NULL; static gboolean -timer_func (gpointer data) +layout_change (DbusmenuMenuitem * oldroot, guint timestamp, gpointer data) { if (layouts[layouton].id == -1) { g_main_loop_quit(mainloop); @@ -80,6 +80,7 @@ timer_func (gpointer data) g_debug("Updating to Layout %d", layouton); DbusmenuMenuitem * mi = layout2menuitem(&layouts[layouton]); + g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(layout_change), NULL); dbusmenu_server_set_root(server, mi); g_object_unref(G_OBJECT(mi)); layouton++; @@ -112,8 +113,9 @@ main (int argc, char ** argv) server = dbusmenu_server_new("/org/test"); - timer_func(NULL); - g_timeout_add(2500, timer_func, NULL); + DbusmenuMenuitem * root = dbusmenu_menuitem_new(); + g_signal_connect(G_OBJECT(root), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(layout_change), NULL); + dbusmenu_server_set_root(server, root); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); |