Back to index

libindicate  12.10.0
test-indicator-display-half-server.c
Go to the documentation of this file.
00001 
00002 #include <glib.h>
00003 #include "libindicate/listener.h"
00004 #include "test-max-indicators-list.h"
00005 
00006 static gboolean passed = TRUE;
00007 static GMainLoop * mainloop = NULL;
00008 
00009 gboolean doit = TRUE;
00010 
00011 static void
00012 indicator_added (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gpointer data)
00013 {
00014        if (doit) {
00015               indicate_listener_displayed(listener, server, indicator, TRUE);
00016               doit = FALSE;
00017        } else {
00018               doit = TRUE;
00019        }
00020        return;
00021 }
00022 
00023 static gboolean
00024 failed_cb (gpointer data)
00025 {
00026        g_debug("Done indicatating displayed");
00027        g_main_loop_quit(mainloop);
00028        return FALSE;
00029 }
00030 
00031 static void
00032 server_removed (void)
00033 {
00034        g_debug("Server went away, exiting.");
00035        g_main_loop_quit(mainloop);
00036        return;
00037 }
00038 
00039 int
00040 main (int argc, char * argv)
00041 {
00042        g_type_init();
00043 
00044        IndicateListener * listener = indicate_listener_ref_default();
00045 
00046        g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED, G_CALLBACK(indicator_added), NULL);
00047        g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_REMOVED, G_CALLBACK(server_removed), NULL);
00048 
00049        g_timeout_add_seconds(2, failed_cb, NULL);
00050 
00051        mainloop = g_main_loop_new(NULL, FALSE);
00052        g_main_loop_run(mainloop);
00053 
00054        return !passed;
00055 }