aboutsummaryrefslogtreecommitdiff
path: root/src/libappindicator/app-indicator.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libappindicator/app-indicator.c')
-rw-r--r--src/libappindicator/app-indicator.c41
1 files changed, 38 insertions, 3 deletions
diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c
index 84d9ebd..e3de406 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;
@@ -126,6 +127,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);
@@ -145,6 +148,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,
@@ -299,6 +306,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);
@@ -322,13 +331,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;
@@ -572,6 +589,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 */