From b1cf9a7df7160d9c58d0f0c833bd48a9eee003ff Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 11 Sep 2002 19:39:48 +0000 Subject: check the new gnome-vfs icon_filename key. If that fails, fall back to 2002-09-11 Jeffrey Stedfast * 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 --- mail/mail-display.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'mail/mail-display.c') 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; } -- cgit