From d004765bf7b546978e708f7ca43efc80e33f0d19 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sat, 6 Feb 2010 09:27:10 -0800 Subject: Now setting status ALOT --- tests/test-libappindicator-status-server.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/test-libappindicator-status-server.c b/tests/test-libappindicator-status-server.c index cc072aa..f2984cd 100644 --- a/tests/test-libappindicator-status-server.c +++ b/tests/test-libappindicator-status-server.c @@ -25,15 +25,30 @@ with this program. If not, see . #include #include #include -#include "test-defines.h" static GMainLoop * mainloop = NULL; +static gboolean active = FALSE; +static guint toggle_count = 0; gboolean -kill_func (gpointer userdata) +toggle (gpointer userdata) { - g_main_loop_quit(mainloop); - return FALSE; + if (active) { + app_indicator_set_status (APP_INDICATOR(userdata), APP_INDICATOR_STATUS_ATTENTION); + active = FALSE; + } else { + app_indicator_set_status (APP_INDICATOR(userdata), APP_INDICATOR_STATUS_ACTIVE); + active = TRUE; + } + + toggle_count++; + + if (toggle_count == 1000) { + g_main_loop_quit(mainloop); + return FALSE; + } + + return TRUE; } gint @@ -43,11 +58,10 @@ main (gint argc, gchar * argv[]) g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); - AppIndicator * ci = app_indicator_new (TEST_ID, TEST_ICON_NAME, TEST_CATEGORY); - app_indicator_set_status (ci, TEST_STATE); - app_indicator_set_attention_icon (ci, TEST_ATTENTION_ICON_NAME); + AppIndicator * ci = app_indicator_new ("my-id", "my-icon-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); + app_indicator_set_attention_icon (ci, "my-attention-icon"); - g_timeout_add_seconds(2, kill_func, NULL); + g_idle_add(toggle, ci); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); -- cgit v1.2.3