diff options
author | Sebastien Bacher <seb128@ubuntu.com> | 2010-04-09 20:59:20 +0200 |
---|---|---|
committer | Sebastien Bacher <seb128@ubuntu.com> | 2010-04-09 20:59:20 +0200 |
commit | ef92fb6b07220aea130c9a32890c56623e393a45 (patch) | |
tree | 75c5ec3c6753057bcfa68703e206d2a6c2c3ee26 /src/indicator-session.c | |
parent | 81db14844ae153486cd472e1186d98b33865a23a (diff) | |
parent | dda06df8cd9fd0186d81701c72ff2e6fa36f5658 (diff) | |
download | ayatana-indicator-session-ef92fb6b07220aea130c9a32890c56623e393a45.tar.gz ayatana-indicator-session-ef92fb6b07220aea130c9a32890c56623e393a45.tar.bz2 ayatana-indicator-session-ef92fb6b07220aea130c9a32890c56623e393a45.zip |
releasing version 0.2.8-0ubuntu1~ppa1
Diffstat (limited to 'src/indicator-session.c')
-rw-r--r-- | src/indicator-session.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/indicator-session.c b/src/indicator-session.c index b54a5d9..dc23139 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -243,12 +243,26 @@ new_user_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuCl 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) { @@ -300,11 +314,20 @@ switch_property_change (DbusmenuMenuitem * item, const gchar * property, const G GtkMenuItem * gmi = dbusmenu_gtkclient_menuitem_get(DBUSMENU_GTKCLIENT(user_data), item); gchar * finalstring = NULL; gboolean set_ellipsize = FALSE; + gboolean no_name_in_lang = FALSE; + + /* TRANSLATORS: Translate the '1' below into anything other than + '1' if "Switch From %s..." doesn't make sense in your language. + Instead, the string "Switch User..." will be used. */ + const gchar * translate = C_("session_menu:switchfrom", "1"); + if (g_strcmp0(translate, "1") != 0) { + no_name_in_lang = TRUE; + } /* If there's a NULL string of some type, then we want to go back to our old 'Switch User' which isn't great but eh, this error condition should never happen. */ - if (value == NULL || g_value_get_string(value) == NULL || g_value_get_string(value)[0] == '\0') { + if (value == NULL || g_value_get_string(value) == NULL || g_value_get_string(value)[0] == '\0' || no_name_in_lang) { finalstring = _("Switch User..."); set_ellipsize = FALSE; } |