[gthumb] preloader: reload the image if the cached image isn't exactly the same size



commit d571de1f1830a56f85aecfe11aa3c516da1d4db2
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Sep 15 10:39:50 2013 +0200

    preloader: reload the image if the cached image isn't exactly the same size

 extensions/image_viewer/gth-image-viewer-page.c |   11 ++++++-----
 gthumb/gth-image-preloader.c                    |    2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/extensions/image_viewer/gth-image-viewer-page.c b/extensions/image_viewer/gth-image-viewer-page.c
index e8d692a..7d16fdf 100644
--- a/extensions/image_viewer/gth-image-viewer-page.c
+++ b/extensions/image_viewer/gth-image-viewer-page.c
@@ -321,14 +321,15 @@ update_image_quality_if_required (GthImageViewerPage *self)
                }
        }
        else {
-               int requested_size;
+               int old_requested_size;
+               int new_requested_size;
 
-               requested_size = gth_image_viewer_get_requested_size (GTH_IMAGE_VIEWER (self->priv->viewer));
-               if (requested_size == -1) {
-                       requested_size = _gth_image_preloader_get_requested_size (self);
+               old_requested_size = gth_image_viewer_get_requested_size (GTH_IMAGE_VIEWER 
(self->priv->viewer));
+               new_requested_size = _gth_image_preloader_get_requested_size (self);
+               if (old_requested_size != new_requested_size) {
                        gth_image_preloader_load (self->priv->preloader,
                                                  self->priv->file_data,
-                                                 requested_size,
+                                                 new_requested_size,
                                                  NULL,
                                                  different_quality_ready_cb,
                                                  self,
diff --git a/gthumb/gth-image-preloader.c b/gthumb/gth-image-preloader.c
index d9ce9a2..8944d11 100644
--- a/gthumb/gth-image-preloader.c
+++ b/gthumb/gth-image-preloader.c
@@ -126,7 +126,7 @@ cache_data_is_valid_for_request (CacheData   *cache_data,
                                 GthFileData *file_data,
                                 int          requested_size)
 {
-       return (((cache_data->requested_size == requested_size) || ((requested_size > 0) && 
(cache_data->requested_size > requested_size)))
+       return ((cache_data->requested_size == requested_size)
                && g_file_equal (cache_data->file_data->file, file_data->file)
                && (_g_time_val_cmp (gth_file_data_get_modification_time (file_data),
                                     gth_file_data_get_modification_time (cache_data->file_data)) == 0));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]