diff options
| author | Ted Gould <ted@gould.cx> | 2010-02-19 15:46:04 -0600 |
|---|---|---|
| committer | Ted Gould <ted@gould.cx> | 2010-02-19 15:46:04 -0600 |
| commit | 65c5a32322681c563d197788fc7f324da70df483 (patch) | |
| tree | 7d248eb29ec4d108fbc7402520af389b4dbcf03c /tests/test-glib-proxy-server.c | |
| parent | 2cb8193e66610f848e71e8217181c25ae55fc0e0 (diff) | |
| parent | cba26859bdea6cfeb19d3e9b2ceb7a40ab7cb470 (diff) | |
| download | libdbusmenu-65c5a32322681c563d197788fc7f324da70df483.tar.gz libdbusmenu-65c5a32322681c563d197788fc7f324da70df483.tar.bz2 libdbusmenu-65c5a32322681c563d197788fc7f324da70df483.zip | |
Updates to make the proxy test more reliable
Diffstat (limited to 'tests/test-glib-proxy-server.c')
| -rw-r--r-- | tests/test-glib-proxy-server.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/tests/test-glib-proxy-server.c b/tests/test-glib-proxy-server.c index cba8ec7..f32b426 100644 --- a/tests/test-glib-proxy-server.c +++ b/tests/test-glib-proxy-server.c @@ -69,22 +69,39 @@ layout2menuitem (proplayout_t * layout) static guint layouton = 0; static DbusmenuServer * server = NULL; static GMainLoop * mainloop = NULL; +static guint death_timer = 0; static gboolean timer_func (gpointer data) { + g_debug("Death timer. Oops. Got to: %d", layouton); + g_main_loop_quit(mainloop); + return FALSE; +} + +static void +layout_change (DbusmenuMenuitem * oldroot, guint timestamp, gpointer data) +{ if (layouts[layouton].id == -1) { g_main_loop_quit(mainloop); - return FALSE; + return; } 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_menuitem_property_set_int(mi, LAYOUT_ON, layouton); dbusmenu_server_set_root(server, mi); g_object_unref(G_OBJECT(mi)); layouton++; - return TRUE; + /* Extend our death */ + if (death_timer != 0) { + g_source_remove(death_timer); + } + death_timer = g_timeout_add_seconds(4, timer_func, data); + + return; } int @@ -111,9 +128,7 @@ main (int argc, char ** argv) } server = dbusmenu_server_new("/org/test"); - - timer_func(NULL); - g_timeout_add(2500, timer_func, NULL); + layout_change(NULL, 0, NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); |
