From 3fb0e1143677f16976fa991098dc009a0a7b1a79 Mon Sep 17 00:00:00 2001 From: C10uD Date: Thu, 22 Jul 2010 15:04:52 +0200 Subject: forgot some files --- src/app-indicator.c | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) (limited to 'src/app-indicator.c') 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) { -- cgit v1.2.3 From 0bbee36d1c080b247d14c5131666c7436761ece6 Mon Sep 17 00:00:00 2001 From: Sense Hofstede Date: Thu, 22 Jul 2010 16:51:10 +0200 Subject: Clean-up and renaming variables and functions everywhere to use icon_theme_path for the sake of consistency. Doesn't seem to do antyhing, though. --- src/app-indicator.c | 63 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 24 deletions(-) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index 137c4c4..91b0ecd 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -69,7 +69,7 @@ struct _AppIndicatorPrivate { AppIndicatorStatus status; gchar *icon_name; gchar *attention_icon_name; - gchar * icon_path; + gchar *icon_theme_path; DbusmenuServer *menuservice; GtkWidget *menu; @@ -88,7 +88,7 @@ enum { NEW_ATTENTION_ICON, NEW_STATUS, CONNECTION_CHANGED, - NEW_PATH, + NEW_ICON_THEME_PATH, LAST_SIGNAL }; @@ -349,16 +349,16 @@ app_indicator_class_init (AppIndicatorClass *klass) G_TYPE_NONE, 1, G_TYPE_BOOLEAN, G_TYPE_NONE); /** - AppIndicator::new-icon: + AppIndicator::new-icon-theme-path: @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, + signals[NEW_ICON_THEME_PATH] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (AppIndicatorClass, new_path), + G_STRUCT_OFFSET (AppIndicatorClass, new_icon_theme_path), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE); @@ -381,7 +381,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->icon_theme_path = NULL; priv->menu = NULL; priv->menuservice = NULL; @@ -503,9 +503,9 @@ app_indicator_finalize (GObject *object) priv->attention_icon_name = NULL; } - if (priv->icon_path != NULL) { - g_free(priv->icon_path); - priv->icon_path = NULL; + if (priv->icon_theme_path != NULL) { + g_free(priv->icon_theme_path); + priv->icon_theme_path = NULL; } G_OBJECT_CLASS (app_indicator_parent_class)->finalize (object); @@ -573,7 +573,7 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu break; case PROP_ICON_THEME_PATH: - app_indicator_set_icon_path (APP_INDICATOR (object), + app_indicator_set_icon_theme_path (APP_INDICATOR (object), g_value_get_string (value)); check_connect (self); break; @@ -618,7 +618,7 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa break; case PROP_ICON_THEME_PATH: - g_value_set_string (value, priv->icon_path); + g_value_set_string (value, priv->icon_theme_path); break; case PROP_MENU: @@ -1040,12 +1040,12 @@ app_indicator_new (const gchar *id, @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. + @icon_theme_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. + @icon_name and #AppIndicator:icon-theme-path with @icon_theme_path. Return value: A pointer to a new #AppIndicator object. */ @@ -1053,13 +1053,13 @@ AppIndicator * app_indicator_new_with_path (const gchar *id, const gchar *icon_name, AppIndicatorCategory category, - const gchar *icon_path) + const gchar *icon_theme_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, + PROP_ICON_THEME_PATH_S, icon_theme_path, NULL); return indicator; @@ -1150,26 +1150,25 @@ app_indicator_set_icon (AppIndicator *self, const gchar *icon_name) } /** - app_indicator_set_icon_theme: + app_indicator_set_icon_theme_path: @self: The #AppIndicator object to use - @icon_path: The icon theme path to set. + @icon_theme_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) +app_indicator_set_icon_theme_path (AppIndicator *self, const gchar *icon_theme_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 (g_strcmp0 (self->priv->icon_theme_path, icon_theme_path) != 0) { - if (self->priv->icon_path != NULL) - g_free(self->priv->icon_path); + if (self->priv->icon_theme_path != NULL) + g_free(self->priv->icon_theme_path); - self->priv->icon_path = g_strdup(icon_path); + self->priv->icon_theme_path = g_strdup(icon_theme_path); - g_signal_emit (self, signals[NEW_PATH], 0, TRUE); + g_signal_emit (self, signals[NEW_ICON_THEME_PATH], 0, TRUE); } return; @@ -1666,6 +1665,22 @@ app_indicator_get_icon (AppIndicator *self) return self->priv->icon_name; } +/** + app_indicator_get_icon_theme_path: + @self: The #AppIndicator object to use + + Wrapper function for property #AppIndicator:icon-theme-path. + + Return value: The current icon theme path. +*/ +const gchar * +app_indicator_get_icon_theme_path (AppIndicator *self) +{ + g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + + return self->priv->icon_theme_path; +} + /** app_indicator_get_attention_icon: @self: The #AppIndicator object to use -- cgit v1.2.3 From 0a8c09e4f8ce284788845f465dcc826a67602cd0 Mon Sep 17 00:00:00 2001 From: Sense Hofstede Date: Thu, 22 Jul 2010 17:36:12 +0200 Subject: Fixed two G_PARAM_SPECS and made it even more possible to remove the custom icon theme path. --- src/app-indicator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index 91b0ecd..7b74495 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -230,7 +230,7 @@ app_indicator_class_init (AppIndicatorClass *klass) "An icon for the indicator", "The default icon that is shown for the indicator.", NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT)); /** AppIndicator:attention-icon-name: @@ -257,7 +257,7 @@ app_indicator_class_init (AppIndicatorClass *klass) "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_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT)); /** AppIndicator:menu: -- cgit v1.2.3 From 247e5a1ac3f714f831bea27fa87170b0ac7fec64 Mon Sep 17 00:00:00 2001 From: Sense Egbert Hofstede Date: Thu, 5 Aug 2010 15:51:53 +0200 Subject: Passing the updated icon theme path along with the DBus signal, saving a DBus call. --- src/app-indicator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index 7b74495..fdfcc23 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -360,8 +360,8 @@ app_indicator_class_init (AppIndicatorClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (AppIndicatorClass, new_icon_theme_path), NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0, G_TYPE_NONE); + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, G_TYPE_STRING); /* Initialize the object as a DBus type */ dbus_g_object_type_install_info(APP_INDICATOR_TYPE, @@ -1168,7 +1168,7 @@ app_indicator_set_icon_theme_path (AppIndicator *self, const gchar *icon_theme_p self->priv->icon_theme_path = g_strdup(icon_theme_path); - g_signal_emit (self, signals[NEW_ICON_THEME_PATH], 0, TRUE); + g_signal_emit (self, signals[NEW_ICON_THEME_PATH], 0, g_strdup(self->priv->icon_theme_path)); } return; -- cgit v1.2.3