aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-08-25 13:18:47 -0500
committerTed Gould <ted@gould.cx>2010-08-25 13:18:47 -0500
commit15501ea22301d17dc7d193f1ece226ee657e59c3 (patch)
treeb74a4fc41e348fb53e9407722642d36be556318e /tests
parent878e149bd3f87034914ae050eacd0b52898f2cb8 (diff)
parent8156d1d7abd95d7f4c0cb564bb9e3c4921a87b60 (diff)
downloadlibdbusmenu-15501ea22301d17dc7d193f1ece226ee657e59c3.tar.gz
libdbusmenu-15501ea22301d17dc7d193f1ece226ee657e59c3.tar.bz2
libdbusmenu-15501ea22301d17dc7d193f1ece226ee657e59c3.zip
Show menus when a signal is sent from the menu item
Diffstat (limited to 'tests')
-rw-r--r--tests/test-gtk-submenu-client.c9
-rw-r--r--tests/test-gtk-submenu-server.c17
2 files changed, 24 insertions, 2 deletions
diff --git a/tests/test-gtk-submenu-client.c b/tests/test-gtk-submenu-client.c
index 2e1ef7a..ec46122 100644
--- a/tests/test-gtk-submenu-client.c
+++ b/tests/test-gtk-submenu-client.c
@@ -102,6 +102,12 @@ timer_func (gpointer data)
}
passed = TRUE;
+ return FALSE;
+}
+
+gboolean
+finished_func (gpointer user_data)
+{
g_main_loop_quit(mainloop);
return FALSE;
}
@@ -127,7 +133,8 @@ main (int argc, char ** argv)
gtk_window_set_title(GTK_WINDOW(window), "libdbusmenu-gtk test");
gtk_widget_show(window);
- g_timeout_add_seconds(1, timer_func, menuitem);
+ g_timeout_add_seconds(2, timer_func, menuitem);
+ g_timeout_add_seconds(6, finished_func, menuitem);
g_debug("Entering Mainloop");
mainloop = g_main_loop_new(NULL, FALSE);
diff --git a/tests/test-gtk-submenu-server.c b/tests/test-gtk-submenu-server.c
index ba3993e..11cede0 100644
--- a/tests/test-gtk-submenu-server.c
+++ b/tests/test-gtk-submenu-server.c
@@ -39,6 +39,17 @@ timer_func (gpointer data)
return FALSE;
}
+static gboolean
+show_item (gpointer pmi)
+{
+ DbusmenuMenuitem * mi = DBUSMENU_MENUITEM(pmi);
+ g_debug("Showing item");
+
+ dbusmenu_menuitem_show_to_user(mi, 0);
+
+ return FALSE;
+}
+
DbusmenuMenuitem *
add_item(DbusmenuMenuitem * parent, const char * label)
{
@@ -81,12 +92,16 @@ main (int argc, char ** argv)
add_item(item, "1.2");
add_item(item, "1.3");
+ g_timeout_add_seconds(2, show_item, item);
+
item = add_item(root, "Folder 2");
add_item(item, "2.1");
add_item(item, "2.2");
add_item(item, "2.3");
- g_timeout_add_seconds(3, timer_func, NULL);
+ g_timeout_add_seconds(4, show_item, item);
+
+ g_timeout_add_seconds(6, timer_func, NULL);
mainloop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(mainloop);