From a4e9c0bf6ee2b628dac8655cacd2841c87aae702 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 11 Mar 2011 15:42:22 -0600 Subject: If we're in the middle of a GetApplications and we get another signal, let's try again. --- src/indicator-application.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/indicator-application.c b/src/indicator-application.c index 1d074d6..73e8341 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -749,6 +749,21 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, GVariant * parameters, gpointer user_data) { IndicatorApplication * self = INDICATOR_APPLICATION(user_data); + IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(self); + + /* If we're in the middle of a GetApplications call and we get + any of these our state is probably going to just be confused. Let's + cancel the call we had and try again to try and get a clear answer */ + if (priv->get_apps_cancel != NULL) { + g_cancelable_cancel(priv->get_apps_cancel); + g_object_unref(priv->get_apps_cancel); + + priv->get_apps_cancel = g_cancellable_new(); + + g_dbus_proxy_call(priv->service_proxy, "GetApplications", NULL, + G_DBUS_CALL_FLAGS_NONE, -1, priv->get_apps_cancel, + get_applications, self); + } if (g_strcmp0(signal_name, "ApplicationAdded") == 0) { const gchar * iconname; -- cgit v1.2.3