aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorseb128 <seb128@seb128-desktop>2009-04-08 10:57:41 +0200
committerseb128 <seb128@seb128-desktop>2009-04-08 10:57:41 +0200
commitdf604ba78746b932c269d6c5b1b455ef28e2a319 (patch)
treef9c8b374a13391d0935aa6474eb5db9113382437 /tests
parent4134dd03ae290419bfab493afc8c71ceab9a5d75 (diff)
parent746b6aa32390dc97bebf371f5b36b2fa24a288c6 (diff)
downloadlibayatana-indicator-df604ba78746b932c269d6c5b1b455ef28e2a319.tar.gz
libayatana-indicator-df604ba78746b932c269d6c5b1b455ef28e2a319.tar.bz2
libayatana-indicator-df604ba78746b932c269d6c5b1b455ef28e2a319.zip
releasing version 0.1.5-0ubuntu1
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am14
-rw-r--r--tests/im-client.c14
-rw-r--r--tests/listen-and-print.c5
-rw-r--r--tests/show-hide-server.c44
4 files changed, 76 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/im-client.c b/tests/im-client.c
index 1b5a86b..bf2fbb2 100644
--- a/tests/im-client.c
+++ b/tests/im-client.c
@@ -65,6 +65,18 @@ server_display (IndicateServer * server, gpointer data)
g_debug("Ah, my server has been displayed");
}
+static void
+interest_added (IndicateServer * server, IndicateInterests interest)
+{
+ g_debug("Oh, someone is interested in my for: %d", interest);
+}
+
+void
+interest_removed (IndicateServer * server, IndicateInterests interest)
+{
+ g_debug("Someone is no longer interested in my for: %d", interest);
+}
+
int
main (int argc, char ** argv)
{
@@ -74,6 +86,8 @@ main (int argc, char ** argv)
indicate_server_set_type(server, "message.im");
indicate_server_set_desktop_file(server, "/usr/share/applications/empathy.desktop");
g_signal_connect(G_OBJECT(server), INDICATE_SERVER_SIGNAL_SERVER_DISPLAY, G_CALLBACK(server_display), NULL);
+ g_signal_connect(G_OBJECT(server), INDICATE_SERVER_SIGNAL_INTEREST_ADDED, G_CALLBACK(interest_added), NULL);
+ g_signal_connect(G_OBJECT(server), INDICATE_SERVER_SIGNAL_INTEREST_REMOVED, G_CALLBACK(interest_removed), NULL);
IndicateIndicatorMessage * indicator;
diff --git a/tests/listen-and-print.c b/tests/listen-and-print.c
index 2535160..dcad92b 100644
--- a/tests/listen-and-print.c
+++ b/tests/listen-and-print.c
@@ -111,6 +111,11 @@ server_added (IndicateListener * listener, IndicateListenerServer * server, gcha
g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
indicate_listener_server_get_type(listener, server, type_cb, NULL);
indicate_listener_server_get_desktop(listener, server, desktop_cb, NULL);
+
+ indicate_listener_server_show_interest(listener, server, INDICATE_INTEREST_SERVER_DISPLAY);
+ indicate_listener_server_show_interest(listener, server, INDICATE_INTEREST_INDICATOR_DISPLAY);
+
+ return;
}
static void
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;
+}
+