ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #01284
[Merge] lp:~ted/indicator-session/avatar-scaling into lp:indicator-session
Ted Gould has proposed merging lp:~ted/indicator-session/avatar-scaling into lp:indicator-session.
Requested reviews:
Indicator Applet Developers (indicator-applet-developers)
Fixes large avatars so they don't dominate the menu.
--
https://code.launchpad.net/~ted/indicator-session/avatar-scaling/+merge/22074
Your team ayatana-commits is subscribed to branch lp:indicator-session.
=== modified file 'src/indicator-session.c'
--- src/indicator-session.c 2010-03-18 18:50:42 +0000
+++ src/indicator-session.c 2010-03-24 21:30:41 +0000
@@ -243,12 +243,26 @@
const gchar * icon_name = dbusmenu_menuitem_property_get(newitem, USER_ITEM_PROP_ICON);
g_debug("Using user icon for '%s' from file: %s", dbusmenu_menuitem_property_get(newitem, USER_ITEM_PROP_NAME), icon_name);
if (icon_name != NULL && icon_name[0] != '\0') {
- if (g_strcmp0(icon_name, USER_ITEM_ICON_DEFAULT) == 0 || !g_file_test(icon_name, G_FILE_TEST_EXISTS)) {
+ if (g_strcmp0(icon_name, USER_ITEM_ICON_DEFAULT) != 0 && g_file_test(icon_name, G_FILE_TEST_EXISTS)) {
+ gint width, height;
+ gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
+
+ GError * error = NULL;
+ GdkPixbuf * pixbuf = gdk_pixbuf_new_from_file_at_size(icon_name, width, height, &error);
+
+ if (error == NULL) {
+ usericon = gtk_image_new_from_pixbuf(pixbuf);
+ g_object_unref(pixbuf);
+ } else {
+ g_warning("Unable to load user icon '%s': %s", icon_name, error->message);
+ g_error_free(error);
+ }
+ }
+
+ if (usericon == NULL) {
GIcon * gicon = g_themed_icon_new_with_default_fallbacks("stock_person-panel");
usericon = gtk_image_new_from_gicon(gicon, GTK_ICON_SIZE_MENU);
g_object_unref(gicon);
- } else {
- usericon = gtk_image_new_from_file(icon_name);
}
}
if (usericon != NULL) {
Follow ups