aboutsummaryrefslogtreecommitdiff
path: root/examples/show-hide-server.c
blob: 23c1ea16d7a1a2813009de5d1931961b071fab99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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;
}