diff options
Diffstat (limited to 'tests/service-manager-connect.c')
-rw-r--r-- | tests/service-manager-connect.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/service-manager-connect.c b/tests/service-manager-connect.c index c252542..91d2bad 100644 --- a/tests/service-manager-connect.c +++ b/tests/service-manager-connect.c @@ -15,8 +15,22 @@ timeout (gpointer data) } void -connection (void) +connection (IndicatorServiceManager * sm, gboolean connected, gpointer user_data) { + static gboolean has_connected = FALSE; + + if (has_connected && connected) { + g_warning("We got two connected signals. FAIL."); + passed = FALSE; + return; + } + + if (!connected) { + g_debug("Not connected"); + return; + } + + has_connected = TRUE; g_debug("Connection"); passed = TRUE; g_main_loop_quit(mainloop); @@ -30,13 +44,15 @@ main (int argc, char ** argv) g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL); IndicatorServiceManager * is = indicator_service_manager_new("org.ayatana.test"); - g_signal_connect(G_OBJECT(is), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, connection, NULL); + g_signal_connect(G_OBJECT(is), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection), NULL); g_timeout_add_seconds(1, timeout, NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); + g_object_unref(is); + g_debug("Quiting"); if (passed) { g_debug("Passed"); |