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:55:16 (GMT) |
commit | ee6c19907b3ee702c25a77245186d7d1377665dc (patch) | |
tree | 74ab2b37f85755b471a5f88e99d8ade51c0c1268 /src | |
parent | e16cf854aaa513c5b14f7a7d71a5d226443ce68c (diff) |
Find an available icon for displaying the removable device #627
Diffstat (limited to 'src')
-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() |