aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app-indicator.c49
-rw-r--r--src/app-indicator.h11
2 files changed, 56 insertions, 4 deletions
diff --git a/src/app-indicator.c b/src/app-indicator.c
index 32f512f..137c4c4 100644
--- a/src/app-indicator.c
+++ b/src/app-indicator.c
@@ -88,6 +88,7 @@ enum {
NEW_ATTENTION_ICON,
NEW_STATUS,
CONNECTION_CHANGED,
+ NEW_PATH,
LAST_SIGNAL
};
@@ -347,6 +348,21 @@ app_indicator_class_init (AppIndicatorClass *klass)
g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN, G_TYPE_NONE);
+ /**
+ AppIndicator::new-icon:
+ @arg0: The #AppIndicator object
+
+ Signaled when there is a new icon set for the
+ object.
+ */
+ signals[NEW_PATH] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_PATH,
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (AppIndicatorClass, new_path),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0, G_TYPE_NONE);
+
/* Initialize the object as a DBus type */
dbus_g_object_type_install_info(APP_INDICATOR_TYPE,
&dbus_glib__notification_item_server_object_info);
@@ -557,10 +573,9 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu
break;
case PROP_ICON_THEME_PATH:
- if (priv->icon_path != NULL) {
- g_free(priv->icon_path);
- }
- priv->icon_path = g_value_dup_string(value);
+ app_indicator_set_icon_path (APP_INDICATOR (object),
+ g_value_get_string (value));
+ check_connect (self);
break;
default:
@@ -1134,6 +1149,32 @@ app_indicator_set_icon (AppIndicator *self, const gchar *icon_name)
return;
}
+/**
+ app_indicator_set_icon_theme:
+ @self: The #AppIndicator object to use
+ @icon_path: The icon theme path to set.
+
+ Sets the path to use when searching for icons.
+**/
+void
+app_indicator_set_icon_path (AppIndicator *self, const gchar *icon_path)
+{
+ g_return_if_fail (IS_APP_INDICATOR (self));
+ g_return_if_fail (icon_path != NULL);
+
+ if (g_strcmp0 (self->priv->icon_path, icon_path) != 0)
+ {
+ if (self->priv->icon_path != NULL)
+ g_free(self->priv->icon_path);
+
+ self->priv->icon_path = g_strdup(icon_path);
+
+ g_signal_emit (self, signals[NEW_PATH], 0, TRUE);
+ }
+
+ return;
+}
+
static void
activate_menuitem (DbusmenuMenuitem *mi, guint timestamp, gpointer user_data)
{
diff --git a/src/app-indicator.h b/src/app-indicator.h
index e37abd4..a5ee4d6 100644
--- a/src/app-indicator.h
+++ b/src/app-indicator.h
@@ -69,6 +69,7 @@ G_BEGIN_DECLS
Gets a pointer to the #AppIndicatorClass for the object @obj.
*/
+
#define APP_INDICATOR_TYPE (app_indicator_get_type ())
#define APP_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APP_INDICATOR_TYPE, AppIndicator))
#define APP_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APP_INDICATOR_TYPE, AppIndicatorClass))
@@ -96,10 +97,16 @@ G_BEGIN_DECLS
String identifier for the #AppIndicator::connection-changed signal.
*/
+/**
+ APP_INDICATOR_SIGNAL_NEW_PATH:
+
+ String identifier for the #AppIndicator::new-path signal.
+*/
#define APP_INDICATOR_SIGNAL_NEW_ICON "new-icon"
#define APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON "new-attention-icon"
#define APP_INDICATOR_SIGNAL_NEW_STATUS "new-status"
#define APP_INDICATOR_SIGNAL_CONNECTION_CHANGED "connection-changed"
+#define APP_INDICATOR_SIGNAL_NEW_PATH "new-path"
/**
AppIndicatorCategory:
@@ -170,6 +177,8 @@ struct _AppIndicatorClass {
void (* new_status) (AppIndicator *indicator,
const gchar *status,
gpointer user_data);
+ void (* new_path) (AppIndicator *indicator,
+ gpointer user_data);
/* Local Signals */
void (* connection_changed) (AppIndicator * indicator,
@@ -226,6 +235,8 @@ void app_indicator_set_menu (AppIndicator
GtkMenu *menu);
void app_indicator_set_icon (AppIndicator *self,
const gchar *icon_name);
+void app_indicator_set_icon_path (AppIndicator *self,
+ const gchar *icon_path);
/* Get properties */
const gchar * app_indicator_get_id (AppIndicator *self);