aboutsummaryrefslogtreecommitdiff
path: root/tests/test-glib-proxy-client.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-19 15:12:21 -0600
committerTed Gould <ted@gould.cx>2010-02-19 15:12:21 -0600
commitfeada06b32e4bcf70a05de8a3669ff07449dc750 (patch)
tree567b95dc6c53f51699334fe0674694024bd8c29b /tests/test-glib-proxy-client.c
parent2ad7f9ec616163f8de67700a99b1dbdd5d6b003d (diff)
downloadlibdbusmenu-feada06b32e4bcf70a05de8a3669ff07449dc750.tar.gz
libdbusmenu-feada06b32e4bcf70a05de8a3669ff07449dc750.tar.bz2
libdbusmenu-feada06b32e4bcf70a05de8a3669ff07449dc750.zip
Putting the layout number on the root element
Diffstat (limited to 'tests/test-glib-proxy-client.c')
-rw-r--r--tests/test-glib-proxy-client.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/tests/test-glib-proxy-client.c b/tests/test-glib-proxy-client.c
index fc3eac6..5cdd7a1 100644
--- a/tests/test-glib-proxy-client.c
+++ b/tests/test-glib-proxy-client.c
@@ -30,6 +30,7 @@ static guint layouton = -2;
static GMainLoop * mainloop = NULL;
static gboolean passed = TRUE;
static guint death_timer = 0;
+static guint verify_timer = 0;
static gboolean
verify_props (DbusmenuMenuitem * mi, gchar ** properties)
@@ -118,24 +119,27 @@ layout_updated (DbusmenuClient * client, gpointer data)
g_debug("\tIgnored, no root");
return;
}
- layouton++;
- if (layouton != -1) {
- g_timeout_add (1500, layout_verify_timer, client);
- } else {
- DbusmenuMenuitem * mi = dbusmenu_client_get_root(client);
- GValue value = {0};
- g_value_init(&value, G_TYPE_INT);
- g_value_set_int(&value, 0);
- dbusmenu_menuitem_handle_event(mi, "clicked", &value, layouton);
+ if (verify_timer != 0) {
+ g_source_remove(verify_timer);
}
+ verify_timer = g_timeout_add (2500, layout_verify_timer, client);
+
+ DbusmenuMenuitem * mi = dbusmenu_client_get_root(client);
+ GValue value = {0};
+ g_value_init(&value, G_TYPE_INT);
+ g_value_set_int(&value, 0);
+ dbusmenu_menuitem_handle_event(mi, "clicked", &value, layouton);
return;
}
static gboolean
layout_verify_timer (gpointer data)
{
- g_debug("Verifing Layout: %d", layouton);
DbusmenuMenuitem * menuroot = dbusmenu_client_get_root(DBUSMENU_CLIENT(data));
+ layouton = dbusmenu_menuitem_property_get_int(menuroot, LAYOUT_ON);
+
+ g_debug("Verifing Layout: %d", layouton);
+ verify_timer = 0;
proplayout_t * layout = &layouts[layouton];
if (!verify_root_to_layout(menuroot, layout)) {
@@ -144,7 +148,7 @@ layout_verify_timer (gpointer data)
} else {
/* Extend our death */
g_source_remove(death_timer);
- death_timer = g_timeout_add_seconds(2, timer_func, data);
+ death_timer = g_timeout_add_seconds(4, timer_func, data);
}
if (layouts[layouton+1].id == -1) {
@@ -167,7 +171,7 @@ main (int argc, char ** argv)
DbusmenuClient * client = dbusmenu_client_new("test.proxy.first_proxy", "/org/test");
g_signal_connect(G_OBJECT(client), DBUSMENU_CLIENT_SIGNAL_LAYOUT_UPDATED, G_CALLBACK(layout_updated), NULL);
- death_timer = g_timeout_add_seconds(2, timer_func, client);
+ death_timer = g_timeout_add_seconds(4, timer_func, client);
mainloop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(mainloop);