aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-12-22 01:27:37 +0800
committerDan Winship <danw@src.gnome.org>2000-12-22 01:27:37 +0800
commitfbf92961aa7fd925a7283ccd134739363d3cb9b9 (patch)
treec5c7404e025f324a2e6dfec000cf64150c6e866a /mail
parentd812b5e3315cedafbd359b2c4b06c6bcccd951ac (diff)
downloadgsoc2013-evolution-fbf92961aa7fd925a7283ccd134739363d3cb9b9.tar
gsoc2013-evolution-fbf92961aa7fd925a7283ccd134739363d3cb9b9.tar.gz
gsoc2013-evolution-fbf92961aa7fd925a7283ccd134739363d3cb9b9.tar.bz2
gsoc2013-evolution-fbf92961aa7fd925a7283ccd134739363d3cb9b9.tar.lz
gsoc2013-evolution-fbf92961aa7fd925a7283ccd134739363d3cb9b9.tar.xz
gsoc2013-evolution-fbf92961aa7fd925a7283ccd134739363d3cb9b9.tar.zst
gsoc2013-evolution-fbf92961aa7fd925a7283ccd134739363d3cb9b9.zip
Deal with the possibility that we have an icon-filename listed for a MIME
* mail-display.c (pixbuf_for_mime_type): Deal with the possibility that we have an icon-filename listed for a MIME type, but the icon file doesn't actually exist. Also, if gnome-unknown.png can't be found, fall back. Might fix a crash people have been reporting... svn path=/trunk/; revision=7118
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/mail-display.c24
2 files changed, 25 insertions, 6 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index e7402b5263..4f0bab6887 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,10 @@
+2000-12-21 Dan Winship <danw@helixcode.com>
+
+ * mail-display.c (pixbuf_for_mime_type): Deal with the possibility
+ that we have an icon-filename listed for a MIME type, but the icon
+ file doesn't actually exist. Also, if gnome-unknown.png can't be
+ found, fall back. Might fix a crash people have been reporting...
+
2000-12-18 Chris Toshok <toshok@helixcode.com>
* mail-format.c (handle_multipart_encrypted): for now #ifdef
diff --git a/mail/mail-display.c b/mail/mail-display.c
index 52858874f6..b7d4442a2a 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -20,6 +20,7 @@
#include "mail-display.h"
#include "mail-config.h"
#include "mail.h"
+#include "art/empty.xpm"
#include <bonobo.h>
#include <libgnorba/gnorba.h>
@@ -374,7 +375,7 @@ pixbuf_for_mime_type (const char *mime_type)
{
const char *icon_name;
char *filename = NULL;
- GdkPixbuf *pixbuf;
+ GdkPixbuf *pixbuf = NULL;
icon_name = gnome_vfs_mime_get_value (mime_type, "icon-filename");
if (icon_name) {
@@ -398,11 +399,22 @@ pixbuf_for_mime_type (const char *mime_type)
}
}
- if (!filename)
- filename = gnome_pixmap_file ("gnome-unknown.png");
+ if (filename) {
+ pixbuf = gdk_pixbuf_new_from_file (filename);
+ g_free (filename);
+ }
- pixbuf = gdk_pixbuf_new_from_file (filename);
- g_free (filename);
+ if (!pixbuf) {
+ filename = gnome_pixmap_file ("gnome-unknown.png");
+ if (filename) {
+ pixbuf = gdk_pixbuf_new_from_file (filename);
+ g_free (filename);
+ } else {
+ g_warning ("Could not get any icon for %s!",mime_type);
+ pixbuf = gdk_pixbuf_new_from_xpm_data (
+ (const char **)empty_xpm);
+ }
+ }
return pixbuf;
}
@@ -469,7 +481,7 @@ pixbuf_gen_idle (struct _PixbufLoader *pbl)
mini = gdk_pixbuf_scale_simple (pixbuf, width, height,
GDK_INTERP_BILINEAR);
- if (error)
+ if (error || !pbl->mstream)
gdk_pixbuf_unref (pixbuf);
bonobo_ui_toolbar_icon_set_pixbuf (
BONOBO_UI_TOOLBAR_ICON (pbl->pixmap), mini);