From d8c7246f702c687b4f532cfb66c5eeb545aa175d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 11 Jan 2010 14:05:24 -0600 Subject: Setting the fallback functions so that we can go round trip on setting up this API. --- src/libappindicator/app-indicator.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 7560a97..9f0ca54 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -64,8 +64,9 @@ struct _AppIndicatorPrivate { gchar *icon_name; gchar *attention_icon_name; gchar * icon_path; - DbusmenuServer *menuservice; - GtkWidget *menu; + DbusmenuServer *menuservice; + GtkWidget *menu; + GtkStatusIcon * status_icon; /* Fun stuff */ DBusGProxy *watcher_proxy; @@ -122,6 +123,8 @@ static void app_indicator_get_property (GObject * object, guint prop_id, GValue /* Other stuff */ static void check_connect (AppIndicator * self); static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer data); +static GtkStatusIcon * fallback (AppIndicator * self); +static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon); /* GObject type */ G_DEFINE_TYPE (AppIndicator, app_indicator, G_TYPE_OBJECT); @@ -141,6 +144,10 @@ app_indicator_class_init (AppIndicatorClass *klass) object_class->set_property = app_indicator_set_property; object_class->get_property = app_indicator_get_property; + /* Our own funcs */ + klass->fallback = fallback; + klass->unfallback = unfallback; + /* Properties */ g_object_class_install_property (object_class, PROP_ID, @@ -568,6 +575,24 @@ category_from_enum (AppIndicatorCategory category) return value->value_nick; } +/* Creates a StatusIcon that can be used when the application + indicator area isn't available. */ +static GtkStatusIcon * +fallback (AppIndicator * self) +{ + + return NULL; +} + +/* Removes the status icon as the application indicator area + is now up and running again. */ +static void +unfallback (AppIndicator * self, GtkStatusIcon * status_icon) +{ + + return; +} + /* ************************* */ /* Public Functions */ -- cgit v1.2.3 From f8d6a7d026be10ea4cdb486cfa945ad697403f26 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 11 Jan 2010 16:27:19 -0600 Subject: Initing and destroying the status_icon variable --- src/libappindicator/app-indicator.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 9f0ca54..2650342 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -302,6 +302,8 @@ app_indicator_init (AppIndicator *self) priv->watcher_proxy = NULL; priv->connection = NULL; + priv->status_icon = NULL; + /* Put the object on DBus */ GError * error = NULL; priv->connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); @@ -325,13 +327,21 @@ app_indicator_init (AppIndicator *self) static void app_indicator_dispose (GObject *object) { - AppIndicator *self = APP_INDICATOR (object); + AppIndicator *self = APP_INDICATOR (object); AppIndicatorPrivate *priv = self->priv; if (priv->status != APP_INDICATOR_STATUS_PASSIVE) { app_indicator_set_status(self, APP_INDICATOR_STATUS_PASSIVE); } + if (priv->status_icon != NULL) { + AppIndicatorClass * class = APP_INDICATOR_CLASS(object); + if (class->unfallback != NULL) { + class->unfallback(self, priv->status_icon); + } + priv->status_icon = NULL; + } + if (priv->menu != NULL) { g_object_unref(G_OBJECT(priv->menu)); priv->menu = NULL; -- cgit v1.2.3 From 40d3056382d3856f8e22d0bd6d2a4f4a411917f2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 11:40:50 -0600 Subject: Start timer fallback --- src/libappindicator/app-indicator.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index e3de406..63f69c9 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -127,6 +127,7 @@ static void app_indicator_get_property (GObject * object, guint prop_id, GValue /* Other stuff */ static void check_connect (AppIndicator * self); static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer data); +static void start_fallback_timer (AppIndicator * self, gboolean do_it_now); static GtkStatusIcon * fallback (AppIndicator * self); static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon); @@ -557,8 +558,8 @@ check_connect (AppIndicator *self) &error); if (error != NULL) { g_warning("Unable to create Ayatana Watcher proxy! %s", error->message); - /* TODO: This is where we should start looking at fallbacks */ g_error_free(error); + start_fallback_timer(self, FALSE); return; } @@ -576,6 +577,7 @@ register_service_cb (DBusGProxy * proxy, GError * error, gpointer data) g_warning("Unable to connect to the Notification Watcher: %s", error->message); g_object_unref(G_OBJECT(priv->watcher_proxy)); priv->watcher_proxy = NULL; + start_fallback_timer(APP_INDICATOR(data), TRUE); } return; } @@ -587,6 +589,18 @@ category_from_enum (AppIndicatorCategory category) value = g_enum_get_value ((GEnumClass *)g_type_class_ref (APP_INDICATOR_TYPE_INDICATOR_CATEGORY), category); return value->value_nick; +} + +/* A function that will start the fallback timer if it's not + already started. It sets up the DBus watcher to see if + there is a change. Also, provides an override mode for cases + where it's unlikely that a timer will help anything. */ +static void +start_fallback_timer (AppIndicator * self, gboolean do_it_now) +{ + + + } /* Creates a StatusIcon that can be used when the application -- cgit v1.2.3 From 7e5e095f25954857936213bd7136fb1e18583819 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 11:55:35 -0600 Subject: Some comments --- src/libappindicator/app-indicator.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 63f69c9..b28a876 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -568,12 +568,16 @@ check_connect (AppIndicator *self) return; } +/* Responce from the DBus command to register a service + with a NotificationWatcher. */ static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer data) { AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(data); if (error != NULL) { + /* They didn't respond, ewww. Not sure what they could + be doing */ g_warning("Unable to connect to the Notification Watcher: %s", error->message); g_object_unref(G_OBJECT(priv->watcher_proxy)); priv->watcher_proxy = NULL; @@ -582,6 +586,8 @@ register_service_cb (DBusGProxy * proxy, GError * error, gpointer data) return; } +/* A helper function to get the nick out of a given + category enum value. */ static const gchar * category_from_enum (AppIndicatorCategory category) { -- cgit v1.2.3 From 9518459fda51ce675794115b401e36cb2f4306f5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 13:37:40 -0600 Subject: Fallback timer pointer lifecycle. --- src/libappindicator/app-indicator.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index b28a876..687ce21 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -66,7 +66,9 @@ struct _AppIndicatorPrivate { gchar * icon_path; DbusmenuServer *menuservice; GtkWidget *menu; + GtkStatusIcon * status_icon; + gint fallback_timer; /* Fun stuff */ DBusGProxy *watcher_proxy; @@ -116,6 +118,9 @@ enum { #define DEFAULT_ITEM_PATH "/org/ayatana/NotificationItem" #define DEFAULT_MENU_PATH "/org/ayatana/NotificationItem/Menu" +/* More constants */ +#define DEFAULT_FALLBACK_TIMER 100 /* in milliseconds */ + /* Boiler plate */ static void app_indicator_class_init (AppIndicatorClass *klass); static void app_indicator_init (AppIndicator *self); @@ -308,6 +313,7 @@ app_indicator_init (AppIndicator *self) priv->connection = NULL; priv->status_icon = NULL; + priv->fallback_timer = 0; /* Put the object on DBus */ GError * error = NULL; @@ -347,6 +353,11 @@ app_indicator_dispose (GObject *object) priv->status_icon = NULL; } + if (priv->fallback_timer != 0) { + g_source_remove(priv->fallback_timer); + priv->fallback_timer = 0; + } + if (priv->menu != NULL) { g_object_unref(G_OBJECT(priv->menu)); priv->menu = NULL; @@ -583,6 +594,9 @@ register_service_cb (DBusGProxy * proxy, GError * error, gpointer data) priv->watcher_proxy = NULL; start_fallback_timer(APP_INDICATOR(data), TRUE); } + + /* TODO: Unfallback here */ + return; } @@ -604,7 +618,13 @@ category_from_enum (AppIndicatorCategory category) static void start_fallback_timer (AppIndicator * self, gboolean do_it_now) { + AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(self); + if (priv->fallback_timer != 0) { + /* The timer is set, let's just be happy with the one + we've already got running */ + return; + } } -- cgit v1.2.3 From 36d47b56783c1b1ea3356d532e00a13f61f174df Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 14:05:33 -0600 Subject: Setup the fallback timer and flesh out it's actions. --- src/libappindicator/app-indicator.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 687ce21..b33a51d 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -133,6 +133,7 @@ static void app_indicator_get_property (GObject * object, guint prop_id, GValue static void check_connect (AppIndicator * self); static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer data); 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); @@ -626,7 +627,37 @@ start_fallback_timer (AppIndicator * self, gboolean do_it_now) return; } + /* TODO: Setup what we need to check things out */ + if (do_it_now) { + fallback_timer_expire(self); + } else { + priv->fallback_timer = g_timeout_add(DEFAULT_FALLBACK_TIMER, fallback_timer_expire, self); + } + + return; +} + +/* A function that gets executed when we want to change the + state of the fallback. */ +static gboolean +fallback_timer_expire (gpointer data) +{ + AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(data); + AppIndicatorClass * class = APP_INDICATOR_CLASS(data); + + if (priv->status_icon == NULL) { + if (class->fallback != NULL) { + priv->status_icon = class->fallback(APP_INDICATOR(data)); + } + } else { + if (class->unfallback != NULL) { + class->unfallback(APP_INDICATOR(data), priv->status_icon); + priv->status_icon = NULL; + } + } + + return FALSE; } /* Creates a StatusIcon that can be used when the application -- cgit v1.2.3 From bded6da0bb607eac38bb7f32bb74df0543a3de1b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 16:55:39 -0600 Subject: Wrong class function --- src/libappindicator/app-indicator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index b33a51d..c1b9bf8 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -644,7 +644,7 @@ static gboolean fallback_timer_expire (gpointer data) { AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(data); - AppIndicatorClass * class = APP_INDICATOR_CLASS(data); + AppIndicatorClass * class = APP_INDICATOR_GET_CLASS(data); if (priv->status_icon == NULL) { if (class->fallback != NULL) { -- cgit v1.2.3 From 7e0feb2329d04007a4b98104f1d76a5e6d4384b4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jan 2010 21:12:46 -0600 Subject: Setting up a dbus proxy and starting to look at owner change events on it when we don't have a NotificationWatcher to look at. --- src/libappindicator/app-indicator.c | 53 ++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index c1b9bf8..4018083 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -73,6 +73,7 @@ struct _AppIndicatorPrivate { /* Fun stuff */ DBusGProxy *watcher_proxy; DBusGConnection *connection; + DBusGProxy * dbus_proxy; }; /* Signals Stuff */ @@ -312,6 +313,7 @@ app_indicator_init (AppIndicator *self) priv->watcher_proxy = NULL; priv->connection = NULL; + priv->dbus_proxy = NULL; priv->status_icon = NULL; priv->fallback_timer = 0; @@ -364,6 +366,11 @@ app_indicator_dispose (GObject *object) priv->menu = NULL; } + if (priv->dbus_proxy != NULL) { + g_object_unref(G_OBJECT(priv->dbus_proxy)); + priv->dbus_proxy = NULL; + } + if (priv->watcher_proxy != NULL) { dbus_g_connection_flush(priv->connection); g_object_unref(G_OBJECT(priv->watcher_proxy)); @@ -612,6 +619,40 @@ category_from_enum (AppIndicatorCategory category) return value->value_nick; } +/* Watching the dbus owner change events to see if someone + we care about pops up! */ +static void +dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, gpointer data) +{ + if (new == NULL || new[0] == '\0') { + /* We only care about folks coming on the bus. Exit quickly otherwise. */ + return; + } + + if (g_strcmp0(name, NOTIFICATION_WATCHER_DBUS_ADDR)) { + /* We only care about this address, reject all others. */ + return; + } + + /* Woot, there's a new notification watcher in town. */ + + AppIndicatorPrivate * priv = APP_INDICATOR_GET_PRIVATE(data); + + if (priv->fallback_timer != 0) { + /* Stop a timer */ + g_source_remove(priv->fallback_timer); + + /* Stop listening to bus events */ + g_object_unref(G_OBJECT(priv->dbus_proxy)); + priv->dbus_proxy = NULL; + } + + /* Let's start from the very beginning */ + check_connect(APP_INDICATOR(data)); + + return; +} + /* A function that will start the fallback timer if it's not already started. It sets up the DBus watcher to see if there is a change. Also, provides an override mode for cases @@ -627,7 +668,17 @@ start_fallback_timer (AppIndicator * self, gboolean do_it_now) return; } - /* TODO: Setup what we need to check things out */ + if (priv->dbus_proxy == NULL) { + priv->dbus_proxy = dbus_g_proxy_new_for_name(priv->connection, + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS); + dbus_g_proxy_add_signal(priv->dbus_proxy, "NameOwnerChanged", + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal(priv->dbus_proxy, "NameOwnerChanged", + G_CALLBACK(dbus_owner_change), self, NULL); + } if (do_it_now) { fallback_timer_expire(self); -- cgit v1.2.3 From 5739297b7d0a67be588044a4be2163fb5cafbb78 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 08:33:04 -0600 Subject: Calling the unfallback function if we're doing this for the second time. --- src/libappindicator/app-indicator.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 4018083..7ade413 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -603,7 +603,13 @@ register_service_cb (DBusGProxy * proxy, GError * error, gpointer data) start_fallback_timer(APP_INDICATOR(data), TRUE); } - /* TODO: Unfallback here */ + if (priv->status_icon) { + AppIndicatorClass * class = APP_INDICATOR_GET_CLASS(data); + if (class->unfallback != NULL) { + class->unfallback(APP_INDICATOR(data), priv->status_icon); + priv->status_icon = NULL; + } + } return; } -- cgit v1.2.3 From 06a6bb7fcbbd703bade0aaff06ab2349b3644724 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 08:38:14 -0600 Subject: Removing a warning. --- src/libappindicator/app-indicator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 7ade413..31b6c6b 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -576,7 +576,8 @@ check_connect (AppIndicator *self) NOTIFICATION_WATCHER_DBUS_IFACE, &error); if (error != NULL) { - g_warning("Unable to create Ayatana Watcher proxy! %s", error->message); + /* Unable to get proxy, but we're handling that now so + it's not a warning anymore. */ g_error_free(error); start_fallback_timer(self, FALSE); return; -- cgit v1.2.3 From c959db1f7d3f188f86c34076637949582b7e9f6b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 09:29:55 -0600 Subject: Adding a function to watch if the watcher proxy gets destroyed. --- src/libappindicator/app-indicator.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/libappindicator/app-indicator.c') 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 -- cgit v1.2.3 From 89aa4a7b791024085162be440d2ec79afedf1b7d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 10:03:06 -0600 Subject: Clear the fallback timer pointer after using it. --- src/libappindicator/app-indicator.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 3fff6df..6bff61a 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -730,6 +730,7 @@ fallback_timer_expire (gpointer data) } } + priv->fallback_timer = 0; return FALSE; } -- cgit v1.2.3 From 88c99aca2e2a95a3dc540285f7dc53d020f526d0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 11:21:31 -0600 Subject: Getting the class the proper way --- src/libappindicator/app-indicator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 6bff61a..259ba3e 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -350,7 +350,7 @@ app_indicator_dispose (GObject *object) } if (priv->status_icon != NULL) { - AppIndicatorClass * class = APP_INDICATOR_CLASS(object); + AppIndicatorClass * class = APP_INDICATOR_GET_CLASS(object); if (class->unfallback != NULL) { class->unfallback(self, priv->status_icon); } -- cgit v1.2.3 From b1b9134542bd3bcfa6b5492f0a7f1b83cf0ec32f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Jan 2010 12:25:49 -0600 Subject: Fleshing out the fallback function, so it should create an icon. --- src/libappindicator/app-indicator.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/libappindicator/app-indicator.c') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 259ba3e..a3ad1ee 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -739,6 +739,24 @@ fallback_timer_expire (gpointer data) static GtkStatusIcon * fallback (AppIndicator * self) { + GtkStatusIcon * icon = gtk_status_icon_new(); + + gtk_status_icon_set_title(icon, app_indicator_get_id(self)); + + switch (app_indicator_get_status(self)) { + case APP_INDICATOR_STATUS_PASSIVE: + gtk_status_icon_set_visible(icon, FALSE); + gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self)); + break; + case APP_INDICATOR_STATUS_ACTIVE: + gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self)); + gtk_status_icon_set_visible(icon, TRUE); + break; + case APP_INDICATOR_STATUS_ATTENTION: + gtk_status_icon_set_from_icon_name(icon, app_indicator_get_attention_icon(self)); + gtk_status_icon_set_visible(icon, TRUE); + break; + }; return NULL; } @@ -748,7 +766,7 @@ fallback (AppIndicator * self) static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon) { - + g_object_unref(G_OBJECT(status_icon)); return; } -- cgit v1.2.3