From d6bb68c1ba7e9c0d3cfe1f7f4aeeacd01f3af55b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 1 Apr 2010 11:26:22 -0500 Subject: No timer if we're already in fallback. --- src/libappindicator/app-indicator.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 4076334..d7c8a8d 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -781,6 +781,11 @@ start_fallback_timer (AppIndicator * self, gboolean disable_timeout) return; } + if (priv->status_icon != NULL) { + /* We're already fallen back. Let's not do it again. */ + return; + } + if (priv->dbus_proxy == NULL) { /* NOTE: Read the comment on setup_name_owner_proxy */ g_idle_add(setup_name_owner_proxy, self); -- cgit v1.2.3 From 5aa064c48d946062b84ea4fe70572cee087766ec Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 1 Apr 2010 13:26:53 -0500 Subject: Make it so that we don't store the panel-suffix icons but we do use them with the status icon. --- src/libappindicator/app-indicator.c | 53 +++++++++++++++---------------------- 1 file changed, 22 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index 4076334..11a9b1c 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -458,8 +458,6 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu { AppIndicator *self = APP_INDICATOR (object); AppIndicatorPrivate *priv = self->priv; - gchar *long_name; - const gchar *instr; GEnumValue *enum_val; switch (prop_id) { @@ -502,26 +500,15 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu break; case PROP_ICON_NAME: - instr = g_value_get_string (value); - - if (g_strcmp0 (priv->icon_name, instr) != 0) - { - if (priv->icon_name) - g_free (priv->icon_name); - - long_name = append_panel_icon_suffix (instr); - priv->icon_name = long_name; - - g_signal_emit (self, signals[NEW_ICON], 0, TRUE); - } - + app_indicator_set_icon (APP_INDICATOR (object), + g_value_get_string (value)); check_connect (self); break; case PROP_ATTENTION_ICON_NAME: app_indicator_set_attention_icon (APP_INDICATOR (object), g_value_get_string (value)); - break; + break; case PROP_ICON_THEME_PATH: if (priv->icon_path != NULL) { @@ -867,30 +854,36 @@ status_icon_changes (AppIndicator * self, gpointer data) { GtkStatusIcon * icon = GTK_STATUS_ICON(data); GIcon *themed_icon = NULL; + gchar *longname = NULL; switch (app_indicator_get_status(self)) { case APP_INDICATOR_STATUS_PASSIVE: - themed_icon = - g_themed_icon_new_with_default_fallbacks (app_indicator_get_icon (self)); + longname = append_panel_icon_suffix(app_indicator_get_icon(self)); + themed_icon = g_themed_icon_new_with_default_fallbacks (longname); gtk_status_icon_set_visible(icon, FALSE); gtk_status_icon_set_from_gicon(icon, themed_icon); break; case APP_INDICATOR_STATUS_ACTIVE: - themed_icon = - g_themed_icon_new_with_default_fallbacks (app_indicator_get_icon (self)); + longname = append_panel_icon_suffix(app_indicator_get_icon(self)); + themed_icon = g_themed_icon_new_with_default_fallbacks (longname); gtk_status_icon_set_from_gicon(icon, themed_icon); gtk_status_icon_set_visible(icon, TRUE); break; case APP_INDICATOR_STATUS_ATTENTION: - themed_icon = - g_themed_icon_new_with_default_fallbacks (app_indicator_get_attention_icon (self)); + longname = append_panel_icon_suffix(app_indicator_get_attention_icon(self)); + themed_icon = g_themed_icon_new_with_default_fallbacks (longname); gtk_status_icon_set_from_gicon(icon, themed_icon); gtk_status_icon_set_visible(icon, TRUE); break; }; - if (themed_icon) + if (themed_icon) { g_object_unref (themed_icon); + } + + if (longname) { + g_free(longname); + } return; } @@ -1045,8 +1038,6 @@ app_indicator_set_status (AppIndicator *self, AppIndicatorStatus status) void app_indicator_set_attention_icon (AppIndicator *self, const gchar *icon_name) { - gchar *long_name; - g_return_if_fail (IS_APP_INDICATOR (self)); g_return_if_fail (icon_name != NULL); @@ -1055,11 +1046,12 @@ app_indicator_set_attention_icon (AppIndicator *self, const gchar *icon_name) if (self->priv->attention_icon_name) g_free (self->priv->attention_icon_name); - long_name = append_panel_icon_suffix (icon_name); - self->priv->attention_icon_name = long_name; + self->priv->attention_icon_name = g_strdup(icon_name); g_signal_emit (self, signals[NEW_ATTENTION_ICON], 0, TRUE); } + + return; } /** @@ -1074,8 +1066,6 @@ app_indicator_set_attention_icon (AppIndicator *self, const gchar *icon_name) void app_indicator_set_icon (AppIndicator *self, const gchar *icon_name) { - gchar *long_name; - g_return_if_fail (IS_APP_INDICATOR (self)); g_return_if_fail (icon_name != NULL); @@ -1084,11 +1074,12 @@ app_indicator_set_icon (AppIndicator *self, const gchar *icon_name) if (self->priv->icon_name) g_free (self->priv->icon_name); - long_name = append_panel_icon_suffix (icon_name); - self->priv->icon_name = long_name; + self->priv->icon_name = g_strdup(icon_name); g_signal_emit (self, signals[NEW_ICON], 0, TRUE); } + + return; } static void -- cgit v1.2.3 From 14aebe465a014d42381f73b8dea3386357d14098 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 1 Apr 2010 13:32:42 -0500 Subject: Adding in documentation for the private structure. --- src/libappindicator/app-indicator.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libappindicator/app-indicator.h b/src/libappindicator/app-indicator.h index 03656ce..d490c8c 100644 --- a/src/libappindicator/app-indicator.h +++ b/src/libappindicator/app-indicator.h @@ -189,6 +189,7 @@ struct _AppIndicatorClass { /** AppIndicator: @parent: Parent object. + @priv: Internal data. A application indicator represents the values that are needed to show a unique status in the panel for an application. In general, applications @@ -198,7 +199,7 @@ struct _AppIndicatorClass { struct _AppIndicator { GObject parent; - AppIndicatorPrivate *priv; + AppIndicatorPrivate *priv; }; /* GObject Stuff */ -- cgit v1.2.3 From ba28468540c9e9b45d66ad0fbba59c5e86ce2fd5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 1 Apr 2010 15:23:36 -0500 Subject: Moving field documentation into a different comment block so that they're private --- src/libappindicator/app-indicator.c | 9 ++++++--- src/libappindicator/app-indicator.h | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index f82587e..132e279 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -47,6 +47,11 @@ License version 3 and version 2.1 along with this program. If not, see /** AppIndicatorPrivate: + + All of the private data in an instance of a + application indicator. +*/ +/* Private Fields @id: The ID of the indicator. Maps to AppIndicator::id. @category: Which category the indicator is. Maps to AppIndicator::category. @status: The status of the indicator. Maps to AppIndicator::status. @@ -54,11 +59,9 @@ License version 3 and version 2.1 along with this program. If not, see @attention_icon_name: The name of the attention icon to use. Maps to AppIndicator::attention-icon-name. @menu: The menu for this indicator. Maps to AppIndicator::menu @watcher_proxy: The proxy connection to the watcher we're connected to. If we're not connected to one this will be #NULL. - - All of the private data in an instance of a - application indicator. */ struct _AppIndicatorPrivate { + /*< Private >*/ /* Properties */ gchar *id; gchar *clean_id; diff --git a/src/libappindicator/app-indicator.h b/src/libappindicator/app-indicator.h index d490c8c..549ab35 100644 --- a/src/libappindicator/app-indicator.h +++ b/src/libappindicator/app-indicator.h @@ -188,17 +188,21 @@ struct _AppIndicatorClass { /** AppIndicator: - @parent: Parent object. - @priv: Internal data. A application indicator represents the values that are needed to show a unique status in the panel for an application. In general, applications should try to fit in the other indicators that are available on the panel before using this. But, sometimes it is necissary. */ +/* Private fields + @parent: Parent object. + @priv: Internal data. +*/ struct _AppIndicator { + /*< Private >*/ GObject parent; + /*< Private >*/ AppIndicatorPrivate *priv; }; -- cgit v1.2.3