aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-application.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-04 16:45:32 -0800
committerTed Gould <ted@gould.cx>2010-02-04 16:45:32 -0800
commit33edaca78f98d3a4b0f1eccf7076b3c659ec90e4 (patch)
tree56db9b794df727e4f7a717e85b9ec49600c69a66 /src/indicator-application.c
parentf25e2f07b3afbdfbe6088bb913cf091620a4ad16 (diff)
parentf8ab455538c130ce03132e2557c9363e9a808156 (diff)
downloadlibayatana-appindicator-33edaca78f98d3a4b0f1eccf7076b3c659ec90e4.tar.gz
libayatana-appindicator-33edaca78f98d3a4b0f1eccf7076b3c659ec90e4.tar.bz2
libayatana-appindicator-33edaca78f98d3a4b0f1eccf7076b3c659ec90e4.zip
* Upstream release 0.0.11
* Interoperability Fixes * Adding in XVFB support for tests * Adding support for icons with the '-panel' suffix
Diffstat (limited to 'src/indicator-application.c')
-rw-r--r--src/indicator-application.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/indicator-application.c b/src/indicator-application.c
index 3ef5688..6c053a9 100644
--- a/src/indicator-application.c
+++ b/src/indicator-application.c
@@ -41,6 +41,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "application-service-client.h"
#include "application-service-marshal.h"
+#define PANEL_ICON_SUFFIX "panel"
+
#define INDICATOR_APPLICATION_TYPE (indicator_application_get_type ())
#define INDICATOR_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_APPLICATION_TYPE, IndicatorApplication))
#define INDICATOR_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATOR_APPLICATION_TYPE, IndicatorApplicationClass))
@@ -325,7 +327,17 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co
theme_dir_ref(application, icon_path);
}
- app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(iconname, GTK_ICON_SIZE_MENU));
+ /* We make a long name using the suffix, and if that
+ icon is available we want to use it. Otherwise we'll
+ just use the name we were given. */
+ gchar * longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX);
+ if (gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), longname)) {
+ app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(longname, GTK_ICON_SIZE_MENU));
+ } else {
+ app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(iconname, GTK_ICON_SIZE_MENU));
+ }
+ g_free(longname);
+
app->entry.label = NULL;
app->entry.menu = GTK_MENU(dbusmenu_gtkmenu_new((gchar *)dbusaddress, (gchar *)dbusobject));
@@ -390,7 +402,17 @@ application_icon_changed (DBusGProxy * proxy, gint position, const gchar * iconn
return;
}
- gtk_image_set_from_icon_name(app->entry.image, iconname, GTK_ICON_SIZE_MENU);
+ /* We make a long name using the suffix, and if that
+ icon is available we want to use it. Otherwise we'll
+ just use the name we were given. */
+ gchar * longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX);
+ if (gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), longname)) {
+ gtk_image_set_from_icon_name(app->entry.image, longname, GTK_ICON_SIZE_MENU);
+ } else {
+ gtk_image_set_from_icon_name(app->entry.image, iconname, GTK_ICON_SIZE_MENU);
+ }
+ g_free(longname);
+
return;
}