aboutsummaryrefslogtreecommitdiff
path: root/examples/show-hide-server.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-04-20 09:34:10 -0500
committerTed Gould <ted@canonical.com>2009-04-20 09:34:10 -0500
commita1ccd1a94e3b2ec2c7ce60c5b6b8824a2bf04076 (patch)
treeeb4ad989bf2a8fa92cea21b0d9cea89005e9c138 /examples/show-hide-server.c
parent8270f15190ba2a22183b30c8ef39329918ca1191 (diff)
downloadlibayatana-indicator-a1ccd1a94e3b2ec2c7ce60c5b6b8824a2bf04076.tar.gz
libayatana-indicator-a1ccd1a94e3b2ec2c7ce60c5b6b8824a2bf04076.tar.bz2
libayatana-indicator-a1ccd1a94e3b2ec2c7ce60c5b6b8824a2bf04076.zip
Moving tests to examples
Diffstat (limited to 'examples/show-hide-server.c')
-rw-r--r--examples/show-hide-server.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/examples/show-hide-server.c b/examples/show-hide-server.c
new file mode 100644
index 0000000..23c1ea1
--- /dev/null
+++ b/examples/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;
+}
+