image_change_complete(): reduce code redundancy and implify.
authorLaurent Monin <geeqie@norz.org>
Sat, 28 Feb 2009 16:59:20 +0000 (16:59 +0000)
committerLaurent Monin <geeqie@norz.org>
Sat, 28 Feb 2009 16:59:20 +0000 (16:59 +0000)
src/image.c

index 122f19c..4f6c5e7 100644 (file)
@@ -728,44 +728,36 @@ static void image_reset(ImageWindow *imd)
 static void image_change_complete(ImageWindow *imd, gdouble zoom, gint new)
 {
        image_reset(imd);
+       imd->unknown = TRUE;
 
-       if (imd->image_fd && isfile(imd->image_fd->path))
+       if (!imd->image_fd)
+               {
+               image_change_pixbuf(imd, NULL, zoom, FALSE);
+               }
+       else
                {
-               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))
+               if (isfile(imd->image_fd->path))
                        {
-                       imd->unknown = FALSE;
-                       }
-               else
-                       {
-                       GdkPixbuf *pixbuf;
-
-                       pixbuf = pixbuf_inline(PIXBUF_INLINE_BROKEN);
-                       image_change_pixbuf(imd, pixbuf, zoom, FALSE);
-                       g_object_unref(pixbuf);
+                       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
-               {
-               if (imd->image_fd)
+
+               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);