From 39513c9d317d9cd121ba065b8e64331f8ca4296e Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Mon, 11 Apr 2011 15:02:38 +0000 Subject: Journal detail view copy-palette: fallback to more generic icon when needed, part of OLPC #10805 The list of icon names we get in Fedora is: ['drive-removable-media-usb', 'drive-removable-media', 'drive-removable', 'drive']. Of this list our artwork only has 'drive' which is the usb icon. This adds the fallback code to make it more robust and display the icon. Signed-off-by: Simon Schampijer Acked-By: Sascha Silbe --- diff --git a/src/jarabe/journal/journaltoolbox.py b/src/jarabe/journal/journaltoolbox.py index cdf998d..d825bc9 100644 --- a/src/jarabe/journal/journaltoolbox.py +++ b/src/jarabe/journal/journaltoolbox.py @@ -469,9 +469,12 @@ class EntryToolbar(gtk.Toolbar): continue menu_item = MenuItem(mount.get_name()) - # TODO: fallback to the more generic icons when needed - menu_item.set_image(Icon(icon_name=mount.get_icon().props.names[0], - icon_size=gtk.ICON_SIZE_MENU)) + icon_theme = gtk.icon_theme_get_default() + for name in mount.get_icon().props.names: + if icon_theme.has_icon(name): + menu_item.set_image(Icon(icon_name=name, + icon_size=gtk.ICON_SIZE_MENU)) + break menu_item.connect('activate', self._copy_menu_item_activate_cb, -- cgit v0.9.1