diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-09-12 03:39:48 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-09-12 03:39:48 +0800 |
commit | b1cf9a7df7160d9c58d0f0c833bd48a9eee003ff (patch) | |
tree | 6a632d96c91206f26d413a70784a15a8e8f62577 /mail/mail-display.c | |
parent | 842c040cf17d43067ad22d73a89ea457ee0d3fbe (diff) | |
download | gsoc2013-evolution-b1cf9a7df7160d9c58d0f0c833bd48a9eee003ff.tar.gz gsoc2013-evolution-b1cf9a7df7160d9c58d0f0c833bd48a9eee003ff.tar.zst gsoc2013-evolution-b1cf9a7df7160d9c58d0f0c833bd48a9eee003ff.zip |
check the new gnome-vfs icon_filename key. If that fails, fall back to
2002-09-11 Jeffrey Stedfast <fejj@ximian.com>
* mail-display.c (pixbuf_for_mime_type): check the new gnome-vfs
icon_filename key. If that fails, fall back to checking
icon-filename. Also don't leak the fm_icon string and rearranged
some code.
svn path=/trunk/; revision=18044
Diffstat (limited to 'mail/mail-display.c')
-rw-r--r-- | mail/mail-display.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/mail/mail-display.c b/mail/mail-display.c index 88f18b50d0..f6e6123d9a 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -532,34 +532,40 @@ pixbuf_for_mime_type (const char *mime_type) const char *icon_name; char *filename = NULL; GdkPixbuf *pixbuf = NULL; - - icon_name = gnome_vfs_mime_get_value (mime_type, "icon-filename"); + + /* GnomeVFS changed the key from icon-filename to + icon_filename, so check icon_filename first and if that + fails, fall back to the old key name */ + if (!(icon_name = gnome_vfs_mime_get_value (mime_type, "icon_filename"))) + icon_name = gnome_vfs_mime_get_value (mime_type, "icon-filename"); + if (icon_name) { if (*icon_name == '/') { pixbuf = gdk_pixbuf_new_from_file (icon_name); if (pixbuf) return pixbuf; } - + filename = gnome_pixmap_file (icon_name); if (!filename) { char *fm_icon; - + fm_icon = g_strdup_printf ("nautilus/%s", icon_name); filename = gnome_pixmap_file (fm_icon); if (!filename) { + g_free (fm_icon); fm_icon = g_strdup_printf ("mc/%s", icon_name); filename = gnome_pixmap_file (fm_icon); } g_free (fm_icon); } + + if (filename) { + pixbuf = gdk_pixbuf_new_from_file (filename); + g_free (filename); + } } - if (filename) { - pixbuf = gdk_pixbuf_new_from_file (filename); - g_free (filename); - } - if (!pixbuf) { filename = gnome_pixmap_file ("gnome-unknown.png"); if (filename) { @@ -571,7 +577,7 @@ pixbuf_for_mime_type (const char *mime_type) (const char **)empty_xpm); } } - + return pixbuf; } |