aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-04-07 17:34:45 -0500
committerTed Gould <ted@canonical.com>2009-04-07 17:34:45 -0500
commit596a5dbe3fce033ed7465b514d49c4485884bc02 (patch)
tree313567f48e4cc0dc2264af401239187ea99f3e82 /tests
parent7f23e1134f1696700e815433eb65a22c73b8fc66 (diff)
downloadlibayatana-indicator-596a5dbe3fce033ed7465b514d49c4485884bc02.tar.gz
libayatana-indicator-596a5dbe3fce033ed7465b514d49c4485884bc02.tar.bz2
libayatana-indicator-596a5dbe3fce033ed7465b514d49c4485884bc02.zip
Adding show hide server test from Eitan on bug 351537
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am14
-rw-r--r--tests/show-hide-server.c44
2 files changed, 57 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4a8f962..862046e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,7 +3,8 @@ libexec_PROGRAMS = \
indicate-and-crash \
indicate-alot \
listen-and-print \
- im-client
+ im-client \
+ show-hide-server
indicate_and_crash_SOURCES = \
indicate-and-crash.c
@@ -49,6 +50,17 @@ im_client_LDADD = \
../libindicate/libindicate.la \
$(LIBINDICATE_LIBS)
+show_hide_server_SOURCES = \
+ show-hide-server.c
+
+show_hide_server_CFLAGS = \
+ -I $(srcdir)/.. \
+ $(LIBINDICATE_CFLAGS)
+
+show_hide_server_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
examplesdir = $(docdir)/examples/
examples_DATA = \
diff --git a/tests/show-hide-server.c b/tests/show-hide-server.c
new file mode 100644
index 0000000..23c1ea1
--- /dev/null
+++ b/tests/show-hide-server.c
@@ -0,0 +1,44 @@
+/* From LP: #351537 */
+
+#include <glib.h>
+#include "libindicate/server.h"
+#include "libindicate/indicator-message.h"
+
+gboolean hidden = TRUE;
+
+static gboolean
+timeout_cb (gpointer data)
+{
+ IndicateServer * server = INDICATE_SERVER(data);
+
+ if (hidden) {
+ printf("showing... ");
+ indicate_server_show(server);
+ printf("ok\n");
+ hidden = FALSE;
+ } else {
+ printf("hiding... ");
+ indicate_server_hide(server);
+ printf("ok\n");
+ hidden = TRUE;
+ }
+
+ return TRUE;
+}
+
+
+int
+main (int argc, char ** argv)
+{
+ g_type_init();
+
+ IndicateServer * server = indicate_server_ref_default();
+ indicate_server_set_type(server, "message.im");
+ indicate_server_set_desktop_file(server, "/usr/share/applications/empathy.desktop");
+ g_timeout_add_seconds(1, timeout_cb, server);
+
+ g_main_loop_run(g_main_loop_new(NULL, FALSE));
+
+ return 0;
+}
+