aboutsummaryrefslogtreecommitdiff
path: root/src/libappindicator/app-indicator.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2009-12-20 22:18:24 -0600
committerTed Gould <ted@gould.cx>2009-12-20 22:18:24 -0600
commit28d5faef89e4838418149d17c1deafba99e48ec0 (patch)
tree6bf6894a772f4c8b9e6f444aa1531c16eb066834 /src/libappindicator/app-indicator.c
parent75de7c2ea6df3d7a4b5f245a0e7fea706a8a93ee (diff)
parentcd57997811b56c369eb3891ff0d92bc0cf503133 (diff)
downloadlibayatana-appindicator-28d5faef89e4838418149d17c1deafba99e48ec0.tar.gz
libayatana-appindicator-28d5faef89e4838418149d17c1deafba99e48ec0.tar.bz2
libayatana-appindicator-28d5faef89e4838418149d17c1deafba99e48ec0.zip
Adding in icon path support.
Diffstat (limited to 'src/libappindicator/app-indicator.c')
-rw-r--r--src/libappindicator/app-indicator.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c
index bb68cb2..d22161c 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_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_PATH_S "icon-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_PATH,
+ g_param_spec_string (PROP_ICON_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_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_PATH:
+ g_value_set_string (value, priv->icon_path);
+ break;
+
case PROP_MENU:
if (G_VALUE_HOLDS_STRING(value)) {
if (priv->menuservice != NULL) {
@@ -573,6 +601,36 @@ app_indicator_new (const gchar *id,
}
/**
+ 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-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,
+ "id", id,
+ "category", category_from_enum (category),
+ "icon-name", icon_name,
+ "icon-path", icon_path,
+ NULL);
+
+ return indicator;
+}
+
+/**
app_indicator_get_type:
Generates or returns the unique #GType for #AppIndicator.