changeset 1337:091ba3e6aedb

image_change_complete(): reduce code redundancy and implify.
author zas_
date Sat, 28 Feb 2009 16:59:20 +0000
parents 4179d41d1149
children f150ab408e0b
files src/image.c
diffstat 1 files changed, 20 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/src/image.c	Sat Feb 28 14:40:22 2009 +0000
+++ b/src/image.c	Sat Feb 28 16:59:20 2009 +0000
@@ -728,44 +728,36 @@
 static void image_change_complete(ImageWindow *imd, gdouble zoom, gint new)
 {
 	image_reset(imd);
-
-	if (imd->image_fd && isfile(imd->image_fd->path))
-		{
-		PixbufRenderer *pr;
-
-		pr = PIXBUF_RENDERER(imd->pr);
-		pr->zoom = zoom;	/* store the zoom, needed by the loader */
+	imd->unknown = TRUE;
 
-		if (image_load_begin(imd, imd->image_fd))
-			{
-			imd->unknown = FALSE;
-			}
-		else
-			{
-			GdkPixbuf *pixbuf;
-
-			pixbuf = pixbuf_inline(PIXBUF_INLINE_BROKEN);
-			image_change_pixbuf(imd, pixbuf, zoom, FALSE);
-			g_object_unref(pixbuf);
-
-			imd->unknown = TRUE;
-			}
+	if (!imd->image_fd)
+		{
+		image_change_pixbuf(imd, NULL, zoom, FALSE);
 		}
 	else
 		{
-		if (imd->image_fd)
+
+		if (isfile(imd->image_fd->path))
+			{
+			PixbufRenderer *pr;
+	
+			pr = PIXBUF_RENDERER(imd->pr);
+			pr->zoom = zoom;	/* store the zoom, needed by the loader */
+
+			if (image_load_begin(imd, imd->image_fd))
+				{
+				imd->unknown = FALSE;
+				}
+			}
+
+		if (imd->unknown == TRUE)
 			{
 			GdkPixbuf *pixbuf;
-
+	
 			pixbuf = pixbuf_inline(PIXBUF_INLINE_BROKEN);
 			image_change_pixbuf(imd, pixbuf, zoom, FALSE);
 			g_object_unref(pixbuf);
 			}
-		else
-			{
-			image_change_pixbuf(imd, NULL, zoom, FALSE);
-			}
-		imd->unknown = TRUE;
 		}
 
 	image_update_util(imd);