aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer/ChangeLog7
-rw-r--r--composer/e-icon-list.c8
-rw-r--r--composer/e-msg-composer-attachment-bar.c17
3 files changed, 29 insertions, 3 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 6791f3d7b0..4896e00c80 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,10 @@
+2000-10-10 Iain Holmes <iain@helixcode.com>
+
+ * e-icon-list.c: Allow NULL pixbufs, and load the "broken" image
+
+ * e-msg-composer-attachment-bar.c (update): If the image isn't
+ found load the default text/plain icon.
+
2000-10-02 Jeffrey Stedfast <fejj@helixcode.com>
* e-msg-composer.c (build_message): If the body of the message has
diff --git a/composer/e-icon-list.c b/composer/e-icon-list.c
index 18790784d1..bdff6c5abe 100644
--- a/composer/e-icon-list.c
+++ b/composer/e-icon-list.c
@@ -982,6 +982,11 @@ icon_new_from_pixbuf (EIconList *eil, GdkPixbuf *im,
else
icon->icon_filename = NULL;
+ if (im == NULL)
+ im = gdk_pixbuf_new_from_xpm_data ((const char**) bad_icon_xpm);
+ else
+ gdk_pixbuf_ref (im);
+
icon->image = GNOME_CANVAS_PIXBUF (gnome_canvas_item_new (
group,
gnome_canvas_pixbuf_get_type (),
@@ -991,6 +996,7 @@ icon_new_from_pixbuf (EIconList *eil, GdkPixbuf *im,
"height", (double) gdk_pixbuf_get_height (im),
"pixbuf", im,
NULL));
+ gdk_pixbuf_unref (im);
icon->text = GNOME_ICON_TEXT_ITEM (gnome_canvas_item_new (
group,
@@ -1139,7 +1145,6 @@ e_icon_list_insert_pixbuf (EIconList *eil, int pos, GdkPixbuf *im,
g_return_if_fail (eil != NULL);
g_return_if_fail (IS_EIL (eil));
- g_return_if_fail (im != NULL);
icon = icon_new_from_pixbuf (eil, im, icon_filename, text);
icon_list_insert (eil, pos, icon);
@@ -1187,7 +1192,6 @@ e_icon_list_append_pixbuf (EIconList *eil, GdkPixbuf *im,
g_return_val_if_fail (eil != NULL, -1);
g_return_val_if_fail (IS_EIL (eil), -1);
- g_return_val_if_fail (im != NULL, -1);
icon = icon_new_from_pixbuf (eil, im, icon_filename, text);
return icon_list_append (eil, icon);
diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c
index 3743c310af..0a7428b2ea 100644
--- a/composer/e-msg-composer-attachment-bar.c
+++ b/composer/e-msg-composer-attachment-bar.c
@@ -305,7 +305,22 @@ update (EMsgComposerAttachmentBar *bar)
if (image) {
e_icon_list_append_pixbuf (icon_list, attachment->pixbuf_cache, icon_name, label);
} else {
- e_icon_list_append (icon_list, icon_name, label);
+ if (icon_name)
+ pixbuf = gdk_pixbuf_new_from_file (icon_name);
+ else
+ pixbuf = NULL;
+
+ /* Get the default */
+ if (pixbuf == NULL) {
+ icon_name = gnome_vfs_mime_get_value ("text/plain",
+ "icon-filename");
+ if (icon_name != NULL)
+ pixbuf = gdk_pixbuf_new_from_file (icon_name);
+ }
+ e_icon_list_append_pixbuf (icon_list, pixbuf,
+ icon_name, label);
+ if (pixbuf)
+ gdk_pixbuf_unref (pixbuf);
}
g_free (label);