Back to index

libindicate  12.10.0
test-indicator-display-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 
00010 static void
00011 indicator_added (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gpointer data)
00012 {
00013        return indicate_listener_displayed(listener, server, indicator, TRUE);
00014 }
00015 
00016 static gboolean
00017 failed_cb (gpointer data)
00018 {
00019        g_debug("Done indicatating displayed");
00020        g_main_loop_quit(mainloop);
00021        return FALSE;
00022 }
00023 
00024 static void
00025 server_removed (void)
00026 {
00027        g_debug("Server went away, exiting.");
00028        g_main_loop_quit(mainloop);
00029        return;
00030 }
00031 
00032 int
00033 main (int argc, char * argv)
00034 {
00035        g_type_init();
00036 
00037        IndicateListener * listener = indicate_listener_ref_default();
00038 
00039        g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED, G_CALLBACK(indicator_added), NULL);
00040        g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_REMOVED, G_CALLBACK(server_removed), NULL);
00041 
00042        g_timeout_add_seconds(2, failed_cb, NULL);
00043 
00044        mainloop = g_main_loop_new(NULL, FALSE);
00045        g_main_loop_run(mainloop);
00046 
00047        return !passed;
00048 }