diff src/thumb.c @ 876:2d8705f33da5

set fallback thumbnail pixbuf only if the loading really fails
author nadvornik
date Thu, 03 Jul 2008 19:38:19 +0000
parents 3093f50c7181
children 21e324dcd78c
line wrap: on
line diff
--- a/src/thumb.c	Thu Jul 03 18:16:39 2008 +0000
+++ b/src/thumb.c	Thu Jul 03 19:38:19 2008 +0000
@@ -112,6 +112,12 @@
 	if (tl->func_progress) tl->func_progress(tl, tl->data);
 }
 
+static void thumb_loader_set_fallback(ThumbLoader *tl)
+{
+	if (tl->fd->thumb_pixbuf) g_object_unref(tl->fd->thumb_pixbuf);
+	tl->fd->thumb_pixbuf = pixbuf_fallback(tl->fd, tl->max_w, tl->max_h);
+}
+
 static void thumb_loader_done_cb(ImageLoader *il, gpointer data)
 {
 	ThumbLoader *tl = data;
@@ -238,6 +244,8 @@
 	image_loader_free(tl->il);
 	tl->il = NULL;
 
+	thumb_loader_set_fallback(tl);
+	
 	if (tl->func_error) tl->func_error(tl, tl->data);
 }
 
@@ -332,8 +340,6 @@
 
 	if (!tl->fd) tl->fd = file_data_ref(fd);
 
-	if (tl->fd->thumb_pixbuf) g_object_unref(tl->fd->thumb_pixbuf);
-	tl->fd->thumb_pixbuf = pixbuf_fallback(tl->fd, tl->max_w, tl->max_h);
 
 	if (tl->cache_enable)
 		{
@@ -403,6 +409,7 @@
 
 		image_loader_free(tl->il);
 		tl->il = NULL;
+		thumb_loader_set_fallback(tl);
 		return FALSE;
 		}