aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-01-13 09:29:55 -0600
committerTed Gould <ted@gould.cx>2010-01-13 09:29:55 -0600
commitc959db1f7d3f188f86c34076637949582b7e9f6b (patch)
tree42e2b967c7e563b607ff3636b7caa4916aeb76c1 /src
parent06a6bb7fcbbd703bade0aaff06ab2349b3644724 (diff)
downloadayatana-indicator-application-c959db1f7d3f188f86c34076637949582b7e9f6b.tar.gz
ayatana-indicator-application-c959db1f7d3f188f86c34076637949582b7e9f6b.tar.bz2
ayatana-indicator-application-c959db1f7d3f188f86c34076637949582b7e9f6b.zip
Adding a function to watch if the watcher proxy gets destroyed.
Diffstat (limited to 'src')
-rw-r--r--src/libappindicator/app-indicator.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c
index 31b6c6b..3fff6df 100644
--- a/src/libappindicator/app-indicator.c
+++ b/src/libappindicator/app-indicator.c
@@ -137,6 +137,7 @@ static void start_fallback_timer (AppIndicator * self, gboolean do_it_now);
static gboolean fallback_timer_expire (gpointer data);
static GtkStatusIcon * fallback (AppIndicator * self);
static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon);
+static void watcher_proxy_destroyed (GObject * object, gpointer data);
/* GObject type */
G_DEFINE_TYPE (AppIndicator, app_indicator, G_TYPE_OBJECT);
@@ -559,7 +560,7 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa
static void
check_connect (AppIndicator *self)
{
- AppIndicatorPrivate *priv = self->priv;
+ AppIndicatorPrivate *priv = self->priv;
/* We're alreadying connecting or trying to connect. */
if (priv->watcher_proxy != NULL) return;
@@ -583,11 +584,25 @@ check_connect (AppIndicator *self)
return;
}
+ g_signal_connect(G_OBJECT(priv->watcher_proxy), "destroy", G_CALLBACK(watcher_proxy_destroyed), self);
org_freedesktop_StatusNotifierWatcher_register_status_notifier_item_async(priv->watcher_proxy, DEFAULT_ITEM_PATH, register_service_cb, self);
return;
}
+/* A function that gets called when the watcher dies. Like
+ dies dies. Not our friend anymore. */
+static void
+watcher_proxy_destroyed (GObject * object, gpointer data)
+{
+ AppIndicator * self = APP_INDICATOR(data);
+ g_return_if_fail(self != NULL);
+
+ self->priv->watcher_proxy = NULL;
+ start_fallback_timer(self, FALSE);
+ return;
+}
+
/* Responce from the DBus command to register a service
with a NotificationWatcher. */
static void