diff options
author | C10uD <c10ud.dev@gmail.com> | 2010-07-22 15:04:52 +0200 |
---|---|---|
committer | C10uD <c10ud.dev@gmail.com> | 2010-07-22 15:04:52 +0200 |
commit | 3fb0e1143677f16976fa991098dc009a0a7b1a79 (patch) | |
tree | 2ec2fecd0988defb0891c5ce9002a78998bb0c1b | |
parent | 47806177db55300ada6d5f6bf543eb77d765f0f3 (diff) | |
download | libayatana-appindicator-3fb0e1143677f16976fa991098dc009a0a7b1a79.tar.gz libayatana-appindicator-3fb0e1143677f16976fa991098dc009a0a7b1a79.tar.bz2 libayatana-appindicator-3fb0e1143677f16976fa991098dc009a0a7b1a79.zip |
forgot some files
-rw-r--r-- | bindings/python/appindicator.defs | 9 | ||||
-rw-r--r-- | src/app-indicator.c | 49 | ||||
-rw-r--r-- | src/app-indicator.h | 11 |
3 files changed, 65 insertions, 4 deletions
diff --git a/bindings/python/appindicator.defs b/bindings/python/appindicator.defs index 98abe4c..b4740ce 100644 --- a/bindings/python/appindicator.defs +++ b/bindings/python/appindicator.defs @@ -89,6 +89,15 @@ ) ) +(define-method set_icon_path + (of-object "AppIndicator") + (c-name "app_indicator_set_icon_path") + (return-type "none") + (parameters + '("const-gchar*" "icon_path") + ) +) + (define-method get_id (of-object "AppIndicator") (c-name "app_indicator_get_id") 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); |