diff options
author | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-01-11 10:08:15 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-01-11 10:08:15 (GMT) |
commit | dca9571f19408b92f83cfca99a1da843e5e04dc8 (patch) | |
tree | d940c35b8a5a386ef41d84a97971d497a367f594 /src | |
parent | 9f076ae5d71eec12d9339ce180e7db49663946f5 (diff) |
Use gio to guess the entry icon
Diffstat (limited to 'src')
-rw-r--r-- | src/jarabe/journal/misc.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/jarabe/journal/misc.py b/src/jarabe/journal/misc.py index a3ba0cf..699ac21 100644 --- a/src/jarabe/journal/misc.py +++ b/src/jarabe/journal/misc.py @@ -21,6 +21,7 @@ import sys import os from gettext import gettext as _ +import gio import gtk from sugar.activity import activityfactory @@ -65,11 +66,13 @@ def get_icon_name(metadata): mime_type = metadata.get('mime_type', '') if not file_name and mime_type: - icon_name = mime.get_mime_icon(mime_type) - if icon_name: + icons = gio.content_type_get_icon(mime_type) + for icon_name in icons.props.names: file_name = _get_icon_file_name(icon_name) + if file_name is not None: + break - if not file_name or not os.path.exists(file_name): + if file_name is None or not os.path.exists(file_name): file_name = _get_icon_file_name('application-octet-stream') return file_name |