diff options
author | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-03-25 18:55:16 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-03-25 18:56:13 (GMT) |
commit | dc25ca6c91b6f367576d2c03b8920f463b8d375c (patch) | |
tree | 8c73cbf92608ceda7635ba2f069525ea76a28047 | |
parent | f6dc05e881f92c8659a483dfb17b352071a5b40f (diff) |
Find an available icon for displaying the removable device #627
-rw-r--r-- | src/jarabe/journal/volumestoolbar.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/jarabe/journal/volumestoolbar.py b/src/jarabe/journal/volumestoolbar.py index 32c8f68..b21832e 100644 --- a/src/jarabe/journal/volumestoolbar.py +++ b/src/jarabe/journal/volumestoolbar.py @@ -145,8 +145,18 @@ class VolumeButton(BaseButton): mount_point = mount.get_root().get_path() BaseButton.__init__(self, mount_point) - # TODO: fallback to the more generic icons when needed - self.props.named_icon = mount.get_icon().props.names[0] + icon_name = None + icon_theme = gtk.icon_theme_get_default() + for icon_name in mount.get_icon().props.names: + icon_info = icon_theme.lookup_icon(icon_name, + gtk.ICON_SIZE_LARGE_TOOLBAR, 0) + if icon_info is not None: + break + + if icon_name is None: + icon_name = 'drive' + + self.props.named_icon = icon_name # TODO: retrieve the colors from the owner of the device client = gconf.client_get_default() |