aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-06 09:27:10 -0800
committerTed Gould <ted@gould.cx>2010-02-06 09:27:10 -0800
commitd004765bf7b546978e708f7ca43efc80e33f0d19 (patch)
treee561a0c1dccaf0074d32d404cef8c380dd0cecc4 /tests
parent39bf2cc8582537e85bf28992cae8450df8312b52 (diff)
downloadayatana-indicator-application-d004765bf7b546978e708f7ca43efc80e33f0d19.tar.gz
ayatana-indicator-application-d004765bf7b546978e708f7ca43efc80e33f0d19.tar.bz2
ayatana-indicator-application-d004765bf7b546978e708f7ca43efc80e33f0d19.zip
Now setting status ALOT
Diffstat (limited to 'tests')
-rw-r--r--tests/test-libappindicator-status-server.c30
1 files changed, 22 insertions, 8 deletions
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 <http://www.gnu.org/licenses/>.
#include <dbus/dbus-glib-lowlevel.h>
#include <glib.h>
#include <libappindicator/app-indicator.h>
-#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);