aboutsummaryrefslogtreecommitdiff
path: root/src/libappindicator
diff options
context:
space:
mode:
authorKrzysztof Klimonda <kklimonda@syntaxhighlighted.com>2010-03-25 19:23:57 +0100
committerKrzysztof Klimonda <kklimonda@syntaxhighlighted.com>2010-03-25 19:23:57 +0100
commit64c02739926fa0559c0ad528ab8f41cd2f2522a4 (patch)
tree71c4ce8018b6a3247a53428b49ba390fe632b09c /src/libappindicator
parent105b2a0cee523d8900bbd2394646e2c1a6db1203 (diff)
downloadlibayatana-appindicator-64c02739926fa0559c0ad528ab8f41cd2f2522a4.tar.gz
libayatana-appindicator-64c02739926fa0559c0ad528ab8f41cd2f2522a4.tar.bz2
libayatana-appindicator-64c02739926fa0559c0ad528ab8f41cd2f2522a4.zip
Make GtkStatusIcon use icons with the panel suffix if available.
Rhythmbox uses two icons: rhythmbox-notplaying for the not playing state and the rhythmbox for playing. The rhythmbox-notplaying has a monochromatic icon but the rhythmbox not - instead a rhythmbox-panel is used. This patch makes AppIndicator prefer an icon with panel suffix just as the indicator-application does.
Diffstat (limited to 'src/libappindicator')
-rw-r--r--src/libappindicator/app-indicator.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c
index 32fb2ff..84c39b3 100644
--- a/src/libappindicator/app-indicator.c
+++ b/src/libappindicator/app-indicator.c
@@ -43,6 +43,8 @@ License version 3 and version 2.1 along with this program. If not, see
#include "dbus-shared.h"
+#define PANEL_ICON_SUFFIX "panel"
+
/**
AppIndicatorPrivate:
@id: The ID of the indicator. Maps to AppIndicator::id.
@@ -900,6 +902,23 @@ unfallback (AppIndicator * self, GtkStatusIcon * status_icon)
return;
}
+/* A helper function that appends PANEL_ICON_SUFFIX to the given icon name
+ if it's missing. */
+static char *
+append_panel_icon_suffix (const gchar *icon_name)
+{
+ gchar * long_name = NULL;
+
+ if (!g_str_has_suffix (icon_name, PANEL_ICON_SUFFIX)) {
+ long_name =
+ g_strdup_printf("%s-%s", icon_name, PANEL_ICON_SUFFIX);
+ } else {
+ long_name = g_strdup (icon_name);
+ }
+
+ return long_name;
+}
+
/* ************************* */
/* Public Functions */
@@ -1001,6 +1020,8 @@ app_indicator_set_status (AppIndicator *self, AppIndicatorStatus status)
void
app_indicator_set_attention_icon (AppIndicator *self, const gchar *icon_name)
{
+ char *long_name;
+
g_return_if_fail (IS_APP_INDICATOR (self));
g_return_if_fail (icon_name != NULL);
@@ -1009,7 +1030,8 @@ app_indicator_set_attention_icon (AppIndicator *self, const gchar *icon_name)
if (self->priv->attention_icon_name)
g_free (self->priv->attention_icon_name);
- self->priv->attention_icon_name = g_strdup (icon_name);
+ long_name = append_panel_icon_suffix (icon_name);
+ self->priv->attention_icon_name = long_name;
g_signal_emit (self, signals[NEW_ATTENTION_ICON], 0, TRUE);
}
@@ -1027,6 +1049,8 @@ app_indicator_set_attention_icon (AppIndicator *self, const gchar *icon_name)
void
app_indicator_set_icon (AppIndicator *self, const gchar *icon_name)
{
+ char *long_name;
+
g_return_if_fail (IS_APP_INDICATOR (self));
g_return_if_fail (icon_name != NULL);
@@ -1035,7 +1059,8 @@ app_indicator_set_icon (AppIndicator *self, const gchar *icon_name)
if (self->priv->icon_name)
g_free (self->priv->icon_name);
- self->priv->icon_name = g_strdup (icon_name);
+ long_name = append_panel_icon_suffix (icon_name);
+ self->priv->icon_name = long_name;
g_signal_emit (self, signals[NEW_ICON], 0, TRUE);
}