Remove commented out code.
[geeqie.git] / src / thumb.c
index cc3bb5c..6935fc2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Geeqie
  * (C) 2004 John Ellis
- * Copyright (C) 2008 - 2009 The Geeqie Team
+ * Copyright (C) 2008 - 2012 The Geeqie Team
  *
  * Author: John Ellis
  *
@@ -27,7 +27,7 @@
 
 
 static void thumb_loader_error_cb(ImageLoader *il, gpointer data);
-static void thumb_loader_setup(ThumbLoader *tl, const gchar *path);
+static void thumb_loader_setup(ThumbLoader *tl, FileData *fd);
 
 static GdkPixbuf *get_xv_thumbnail(gchar *thumb_filename, gint max_w, gint max_h);
 
@@ -142,7 +142,7 @@ static void thumb_loader_done_cb(ImageLoader *il, gpointer data)
                {
                if (!tl->fd->exif_orientation)
                        {
-                       tl->fd->exif_orientation = metadata_read_int(tl->fd, "Exif.Image.Orientation", EXIF_ORIENTATION_TOP_LEFT);
+                       tl->fd->exif_orientation = metadata_read_int(tl->fd, ORIENTATION_KEY, EXIF_ORIENTATION_TOP_LEFT);
                        }
                
                if (tl->fd->exif_orientation != EXIF_ORIENTATION_TOP_LEFT)
@@ -161,7 +161,7 @@ static void thumb_loader_done_cb(ImageLoader *il, gpointer data)
                DEBUG_1("thumbnail size mismatch, regenerating: %s", tl->fd->path);
                tl->cache_hit = FALSE;
 
-               thumb_loader_setup(tl, tl->fd->path);
+               thumb_loader_setup(tl, tl->fd);
        
                g_signal_connect(G_OBJECT(tl->il), "done", (GCallback)thumb_loader_done_cb, tl);
 
@@ -250,7 +250,7 @@ static gboolean thumb_loader_done_delay_cb(gpointer data)
 {
        ThumbLoader *tl = data;
 
-       tl->idle_done_id = -1;
+       tl->idle_done_id = 0;
 
        if (tl->func_done) tl->func_done(tl, tl->data);
 
@@ -259,22 +259,17 @@ static gboolean thumb_loader_done_delay_cb(gpointer data)
 
 static void thumb_loader_delay_done(ThumbLoader *tl)
 {
-       if (tl->idle_done_id == -1) tl->idle_done_id = g_idle_add(thumb_loader_done_delay_cb, tl);
+       if (!tl->idle_done_id) tl->idle_done_id = g_idle_add(thumb_loader_done_delay_cb, tl);
 }
 
-static void thumb_loader_setup(ThumbLoader *tl, const gchar *path)
+static void thumb_loader_setup(ThumbLoader *tl, FileData *fd)
 {
-       FileData *fd = file_data_new_simple(path);
        image_loader_free(tl->il);
        tl->il = image_loader_new(fd);
-       file_data_unref(fd);
        image_loader_set_priority(tl->il, G_PRIORITY_LOW);
 
-       if (options->thumbnails.fast)
-               {
-               /* this will speed up jpegs by up to 3x in some cases */
-               image_loader_set_requested_size(tl->il, tl->max_w, tl->max_h);
-               }
+       /* this will speed up jpegs by up to 3x in some cases */
+       image_loader_set_requested_size(tl->il, tl->max_w, tl->max_h);
 
        g_signal_connect(G_OBJECT(tl->il), "error", (GCallback)thumb_loader_error_cb, tl);
        if (tl->func_progress) g_signal_connect(G_OBJECT(tl->il), "percent", (GCallback)thumb_loader_percent_cb, tl);
@@ -380,13 +375,15 @@ gboolean thumb_loader_start(ThumbLoader *tl, FileData *fd)
 
        if (cache_path)
                {
-               thumb_loader_setup(tl, cache_path);
+               FileData *fd = file_data_new_no_grouping(cache_path);
+               thumb_loader_setup(tl, fd);
+               file_data_unref(fd);
                g_free(cache_path);
                tl->cache_hit = TRUE;
                }
        else
                {
-               thumb_loader_setup(tl, tl->fd->path);
+               thumb_loader_setup(tl, tl->fd);
                }
 
        g_signal_connect(G_OBJECT(tl->il), "done", (GCallback)thumb_loader_done_cb, tl);
@@ -398,7 +395,7 @@ gboolean thumb_loader_start(ThumbLoader *tl, FileData *fd)
                        tl->cache_hit = FALSE;
                        log_printf("%s", _("Thumbnail image in cache failed to load, trying to recreate.\n"));
 
-                       thumb_loader_setup(tl, tl->fd->path);
+                       thumb_loader_setup(tl, tl->fd);
                        g_signal_connect(G_OBJECT(tl->il), "done", (GCallback)thumb_loader_done_cb, tl);
                        if (image_loader_start(tl->il)) return TRUE;
                        }
@@ -480,7 +477,6 @@ ThumbLoader *thumb_loader_new(gint width, gint height)
        tl->percent_done = 0.0;
        tl->max_w = width;
        tl->max_h = height;
-       tl->idle_done_id = -1;
 
        return tl;
 }
@@ -498,7 +494,7 @@ void thumb_loader_free(ThumbLoader *tl)
        image_loader_free(tl->il);
        file_data_unref(tl->fd);
 
-       if (tl->idle_done_id != -1) g_source_remove(tl->idle_done_id);
+       if (tl->idle_done_id) g_source_remove(tl->idle_done_id);
 
        g_free(tl);
 }