aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-01-13 20:25:33 -0600
committerTed Gould <ted@gould.cx>2010-01-13 20:25:33 -0600
commitc303c0c49f7ab1b0747e5cb12111f8b3ac4cd46e (patch)
tree6b075e52d4c04f6d048aace6e1df29922c10b979
parentc26cab9055e9d909babb509e606b35ec47574c78 (diff)
downloadlibayatana-appindicator-c303c0c49f7ab1b0747e5cb12111f8b3ac4cd46e.tar.gz
libayatana-appindicator-c303c0c49f7ab1b0747e5cb12111f8b3ac4cd46e.tar.bz2
libayatana-appindicator-c303c0c49f7ab1b0747e5cb12111f8b3ac4cd46e.zip
Realized that we didn't really use the 'notify' signal... now using the better ones anyway.
-rw-r--r--src/libappindicator/app-indicator.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c
index f66888f..e1b332a 100644
--- a/src/libappindicator/app-indicator.c
+++ b/src/libappindicator/app-indicator.c
@@ -136,7 +136,8 @@ static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer da
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 status_icon_changes (GObject * icon, GParamSpec * pspec, gpointer data);
+static void status_icon_status_wrapper (AppIndicator * self, const gchar * status, gpointer data);
+static void status_icon_changes (AppIndicator * self, gpointer data);
static void status_icon_activate (GtkStatusIcon * icon, gpointer data);
static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon);
static void watcher_proxy_destroyed (GObject * object, gpointer data);
@@ -752,27 +753,34 @@ fallback (AppIndicator * self)
gtk_status_icon_set_title(icon, app_indicator_get_id(self));
- g_signal_connect(G_OBJECT(self), "notify::" PROP_STATUS_S,
+ g_signal_connect(G_OBJECT(self), APP_INDICATOR_SIGNAL_NEW_STATUS,
G_CALLBACK(status_icon_changes), icon);
- g_signal_connect(G_OBJECT(self), "notify::" PROP_ICON_NAME_S,
+ g_signal_connect(G_OBJECT(self), APP_INDICATOR_SIGNAL_NEW_ICON,
G_CALLBACK(status_icon_changes), icon);
- g_signal_connect(G_OBJECT(self), "notify::" PROP_ATTENTION_ICON_NAME_S,
+ g_signal_connect(G_OBJECT(self), APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON,
G_CALLBACK(status_icon_changes), icon);
- status_icon_changes(G_OBJECT(icon), NULL, self);
+ status_icon_changes(self, icon);
g_signal_connect(G_OBJECT(icon), "activate", G_CALLBACK(status_icon_activate), self);
return NULL;
}
+/* A wrapper as the status update prototype is a little
+ bit different, but we want to handle it the same. */
+static void
+status_icon_status_wrapper (AppIndicator * self, const gchar * status, gpointer data)
+{
+ return status_icon_changes(self, data);
+}
+
/* This tracks changes to either the status or the icons
that are associated with the app indicator */
static void
-status_icon_changes (GObject * oicon, GParamSpec * pspec, gpointer data)
+status_icon_changes (AppIndicator * self, gpointer data)
{
- AppIndicator * self = APP_INDICATOR(data);
- GtkStatusIcon * icon = GTK_STATUS_ICON(oicon);
+ GtkStatusIcon * icon = GTK_STATUS_ICON(data);
switch (app_indicator_get_status(self)) {
case APP_INDICATOR_STATUS_PASSIVE:
@@ -817,6 +825,7 @@ status_icon_activate (GtkStatusIcon * icon, gpointer data)
static void
unfallback (AppIndicator * self, GtkStatusIcon * status_icon)
{
+ g_signal_handlers_disconnect_by_func(G_OBJECT(self), status_icon_status_wrapper, status_icon);
g_signal_handlers_disconnect_by_func(G_OBJECT(self), status_icon_changes, status_icon);
g_object_unref(G_OBJECT(status_icon));
return;