aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
+}
+