Back to index

libindicate  12.10.0
show-hide-server.c
Go to the documentation of this file.
00001 /* From LP: #351537 */
00002 
00003 #include <glib.h>
00004 #include "libindicate/server.h"
00005 
00006 gboolean hidden = TRUE;
00007 
00008 static gboolean
00009 timeout_cb (gpointer data)
00010 {
00011     IndicateServer * server = INDICATE_SERVER(data);
00012 
00013        if (hidden) {
00014         g_debug("showing... ");
00015         indicate_server_show(server);
00016         g_debug("ok\n");
00017         hidden = FALSE;
00018        } else {
00019         g_debug("hiding... ");
00020         indicate_server_hide(server);
00021         g_debug("ok\n");
00022         hidden = TRUE;
00023        }
00024 
00025        return TRUE;
00026 }
00027 
00028 
00029 int
00030 main (int argc, char ** argv)
00031 {
00032        g_type_init();
00033 
00034        IndicateServer * server = indicate_server_ref_default();
00035        indicate_server_set_type(server, "message.im");
00036        indicate_server_set_desktop_file(server, "/usr/share/applications/empathy.desktop");
00037        g_timeout_add_seconds(1, timeout_cb, server);
00038 
00039        g_main_loop_run(g_main_loop_new(NULL, FALSE));
00040 
00041        return 0;
00042 }
00043