diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2013-01-30 11:06:26 +0000 |
---|---|---|
committer | Tarmac <Unknown> | 2013-01-30 11:06:26 +0000 |
commit | bd333ad26f451f27f0d412f8a42f42459377bd7c (patch) | |
tree | 88817c7c7f21fc3c63395767e9c42acd588eefef /tests/test-libappindicator-status-server.c | |
parent | ee33a9adfc9c657c3be11a8bcaf25e687fdde026 (diff) | |
parent | 3e9b3f1cd28e9c9e1263796297f5d648a163be9e (diff) | |
download | libayatana-appindicator-bd333ad26f451f27f0d412f8a42f42459377bd7c.tar.gz libayatana-appindicator-bd333ad26f451f27f0d412f8a42f42459377bd7c.tar.bz2 libayatana-appindicator-bd333ad26f451f27f0d412f8a42f42459377bd7c.zip |
This is a continuation of ~mathieu-tl/libappindicator/fix-test-merge/ which adds fixes for bug #1102589, bug #1102595, bug #1109128, and bug #1103087, which should get it finally passing CI. Fixes: https://bugs.launchpad.net/bugs/1102589, https://bugs.launchpad.net/bugs/1102595, https://bugs.launchpad.net/bugs/1103087, https://bugs.launchpad.net/bugs/1109128.
Approved by Ted Gould, PS Jenkins bot.
Diffstat (limited to 'tests/test-libappindicator-status-server.c')
-rw-r--r-- | tests/test-libappindicator-status-server.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/tests/test-libappindicator-status-server.c b/tests/test-libappindicator-status-server.c index 8cd5571..9674f61 100644 --- a/tests/test-libappindicator-status-server.c +++ b/tests/test-libappindicator-status-server.c @@ -22,34 +22,39 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <stdlib.h> -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-lowlevel.h> #include <glib.h> #include <app-indicator.h> static GMainLoop * mainloop = NULL; static gboolean active = FALSE; static guint toggle_count = 0; +static GDBusConnection * connection = NULL; + +static gboolean +times_up (gpointer unused G_GNUC_UNUSED) +{ + g_dbus_connection_flush_sync (connection, NULL, NULL); + g_clear_object (&connection); + + g_main_loop_quit (mainloop); + return G_SOURCE_REMOVE; +} gboolean toggle (gpointer userdata) { - if (active) { - app_indicator_set_status (APP_INDICATOR(userdata), APP_INDICATOR_STATUS_ATTENTION); - active = FALSE; - } else { - app_indicator_set_status (APP_INDICATOR(userdata), APP_INDICATOR_STATUS_ACTIVE); - active = TRUE; - } - - toggle_count++; + const AppIndicatorStatus new_status = active ? APP_INDICATOR_STATUS_ATTENTION + : APP_INDICATOR_STATUS_ACTIVE; + app_indicator_set_status (APP_INDICATOR(userdata), new_status); + ++toggle_count; + active = !active; if (toggle_count == 100) { - g_main_loop_quit(mainloop); - return FALSE; + g_timeout_add (100, times_up, NULL); + return G_SOURCE_REMOVE; } - return TRUE; + return G_SOURCE_CONTINUE; } gint @@ -59,7 +64,8 @@ main (gint argc, gchar * argv[]) g_usleep(100000); - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); + connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); + g_debug("DBus Name: %s", g_dbus_connection_get_unique_name (connection)); AppIndicator * ci = app_indicator_new ("my-id", "my-icon-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); app_indicator_set_attention_icon (ci, "my-attention-icon"); @@ -76,6 +82,7 @@ main (gint argc, gchar * argv[]) g_main_loop_run(mainloop); g_object_unref(G_OBJECT(ci)); + g_debug("Quiting"); return 0; |