aboutsummaryrefslogtreecommitdiff
path: root/src/libappindicator
diff options
context:
space:
mode:
Diffstat (limited to 'src/libappindicator')
-rw-r--r--src/libappindicator/app-indicator.c78
-rw-r--r--src/libappindicator/app-indicator.h8
2 files changed, 74 insertions, 12 deletions
diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c
index ad7eab7..f115068 100644
--- a/src/libappindicator/app-indicator.c
+++ b/src/libappindicator/app-indicator.c
@@ -63,6 +63,7 @@ struct _AppIndicatorPrivate {
AppIndicatorStatus status;
gchar *icon_name;
gchar *attention_icon_name;
+ gchar * icon_path;
DbusmenuServer *menuservice;
GtkWidget *menu;
@@ -91,6 +92,7 @@ enum {
PROP_STATUS,
PROP_ICON_NAME,
PROP_ATTENTION_ICON_NAME,
+ PROP_ICON_THEME_PATH,
PROP_MENU,
PROP_CONNECTED
};
@@ -101,6 +103,7 @@ enum {
#define PROP_STATUS_S "status"
#define PROP_ICON_NAME_S "icon-name"
#define PROP_ATTENTION_ICON_NAME_S "attention-icon-name"
+#define PROP_ICON_THEME_PATH_S "icon-theme-path"
#define PROP_MENU_S "menu"
#define PROP_CONNECTED_S "connected"
@@ -179,6 +182,14 @@ app_indicator_class_init (AppIndicatorClass *klass)
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property(object_class,
+ PROP_ICON_THEME_PATH,
+ g_param_spec_string (PROP_ICON_THEME_PATH_S,
+ "An additional path for custom icons.",
+ "An additional place to look for icon names that may be installed by the application.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY));
+
g_object_class_install_property(object_class,
PROP_MENU,
g_param_spec_string (PROP_MENU_S,
@@ -277,6 +288,7 @@ app_indicator_init (AppIndicator *self)
priv->status = APP_INDICATOR_STATUS_PASSIVE;
priv->icon_name = NULL;
priv->attention_icon_name = NULL;
+ priv->icon_path = NULL;
priv->menu = NULL;
priv->menuservice = NULL;
@@ -355,6 +367,11 @@ app_indicator_finalize (GObject *object)
priv->attention_icon_name = NULL;
}
+ if (priv->icon_path != NULL) {
+ g_free(priv->icon_path);
+ priv->icon_path = NULL;
+ }
+
G_OBJECT_CLASS (app_indicator_parent_class)->finalize (object);
return;
}
@@ -423,6 +440,13 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu
g_value_get_string (value));
break;
+ case PROP_ICON_THEME_PATH:
+ if (priv->icon_path != NULL) {
+ g_free(priv->icon_path);
+ }
+ priv->icon_path = g_value_dup_string(value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -462,6 +486,10 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa
g_value_set_string (value, priv->attention_icon_name);
break;
+ case PROP_ICON_THEME_PATH:
+ g_value_set_string (value, priv->icon_path);
+ break;
+
case PROP_MENU:
if (G_VALUE_HOLDS_STRING(value)) {
if (priv->menuservice != NULL) {
@@ -502,7 +530,7 @@ check_connect (AppIndicator *self)
GError * error = NULL;
priv->watcher_proxy = dbus_g_proxy_new_for_name_owner(priv->connection,
- INDICATOR_APPLICATION_DBUS_ADDR,
+ NOTIFICATION_WATCHER_DBUS_ADDR,
NOTIFICATION_WATCHER_DBUS_OBJ,
NOTIFICATION_WATCHER_DBUS_IFACE,
&error);
@@ -513,7 +541,7 @@ check_connect (AppIndicator *self)
return;
}
- org_ayatana_indicator_application_NotificationWatcher_register_service_async(priv->watcher_proxy, "/need/a/path", register_service_cb, self);
+ org_freedesktop_StatusNotifierWatcher_register_status_notifier_item_async(priv->watcher_proxy, "/need/a/path", register_service_cb, self);
return;
}
@@ -564,15 +592,45 @@ app_indicator_new (const gchar *id,
AppIndicatorCategory category)
{
AppIndicator *indicator = g_object_new (APP_INDICATOR_TYPE,
- "id", id,
- "category", category_from_enum (category),
- "icon-name", icon_name,
+ PROP_ID_S, id,
+ PROP_CATEGORY_S, category_from_enum (category),
+ PROP_ICON_NAME_S, icon_name,
NULL);
return indicator;
}
/**
+ app_indicator_new_with_path:
+ @id: The unique id of the indicator to create.
+ @icon_name: The icon name for this indicator
+ @category: The category of indicator.
+ @icon_path: A custom path for finding icons.
+
+ Creates a new #AppIndicator setting the properties:
+ #AppIndicator::id with @id, #AppIndicator::category
+ with @category, #AppIndicator::icon-name with
+ @icon_name and #AppIndicator::icon-theme-path with @icon_path.
+
+ Return value: A pointer to a new #AppIndicator object.
+ */
+AppIndicator *
+app_indicator_new_with_path (const gchar *id,
+ const gchar *icon_name,
+ AppIndicatorCategory category,
+ const gchar *icon_path)
+{
+ AppIndicator *indicator = g_object_new (APP_INDICATOR_TYPE,
+ PROP_ID_S, id,
+ PROP_CATEGORY_S, category_from_enum (category),
+ PROP_ICON_NAME_S, icon_name,
+ PROP_ICON_THEME_PATH_S, icon_path,
+ NULL);
+
+ return indicator;
+}
+
+/**
app_indicator_get_type:
Generates or returns the unique #GType for #AppIndicator.
@@ -640,14 +698,14 @@ app_indicator_set_icon (AppIndicator *self, const gchar *icon_name)
g_return_if_fail (IS_APP_INDICATOR (self));
g_return_if_fail (icon_name != NULL);
- if (g_strcmp0 (self->priv->attention_icon_name, icon_name) != 0)
+ if (g_strcmp0 (self->priv->icon_name, icon_name) != 0)
{
- if (self->priv->attention_icon_name)
- g_free (self->priv->attention_icon_name);
+ if (self->priv->icon_name)
+ g_free (self->priv->icon_name);
- self->priv->attention_icon_name = g_strdup (icon_name);
+ self->priv->icon_name = g_strdup (icon_name);
- g_signal_emit (self, signals[NEW_ATTENTION_ICON], 0, TRUE);
+ g_signal_emit (self, signals[NEW_ICON], 0, TRUE);
}
}
diff --git a/src/libappindicator/app-indicator.h b/src/libappindicator/app-indicator.h
index e966a49..a680c33 100644
--- a/src/libappindicator/app-indicator.h
+++ b/src/libappindicator/app-indicator.h
@@ -128,8 +128,8 @@ typedef enum { /*< prefix=APP_INDICATOR_CATEGORY >*/
These are the states that the indicator can be on in
the user's panel. The indicator by default starts
- in the state @APP_INDICATOR_STATUS_OFF and can be
- shown by setting it to @APP_INDICATOR_STATUS_ON.
+ in the state @APP_INDICATOR_STATUS_PASSIVE and can be
+ shown by setting it to @APP_INDICATOR_STATUS_ACTIVE.
*/
typedef enum { /*< prefix=APP_INDICATOR_STATUS >*/
APP_INDICATOR_STATUS_PASSIVE,
@@ -202,6 +202,10 @@ GType app_indicator_get_type (void) G_GNUC_C
AppIndicator *app_indicator_new (const gchar *id,
const gchar *icon_name,
AppIndicatorCategory category);
+AppIndicator *app_indicator_new_with_path (const gchar *id,
+ const gchar *icon_name,
+ AppIndicatorCategory category,
+ const gchar *icon_path);
/* Set properties */
void app_indicator_set_status (AppIndicator *self,