[gnome-photos/wip/rishi/edit-mode: 8/27] base-item: Take advantage of better caching during download



commit 25357b499aebf96f5622daa395e99d4199dad9b3
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue May 26 10:40:16 2015 +0200

    base-item: Take advantage of better caching during download
    
    We only hit the network if the cache is empty. If it isn't, then we
    return the local path to the cached file. Therefore, there is no need
    to guard it with a 'once' variable.

 src/photos-base-item.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 7c05186..092c58c 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -68,7 +68,6 @@ struct _PhotosBaseItemPrivate
   gboolean collection;
   gboolean failed_thumbnailing;
   gboolean favorite;
-  gboolean loaded_once;
   const gchar *thumb_path;
   gchar *author;
   gchar *default_app_name;
@@ -733,16 +732,11 @@ photos_base_item_load (PhotosBaseItem *self, GCancellable *cancellable, GError *
   GeglNode *ret_val = NULL;
   gchar *path = NULL;
 
-  if (!priv->loaded_once)
-    {
-      path = photos_base_item_download (self, cancellable, error);
-      if (path == NULL)
-        goto out;
-
-      gegl_node_set (priv->node, "path", path, NULL);
-      priv->loaded_once = TRUE;
-    }
+  path = photos_base_item_download (self, cancellable, error);
+  if (path == NULL)
+    goto out;
 
+  gegl_node_set (priv->node, "path", path, NULL);
   gegl_node_process (priv->node);
   priv->bbox = gegl_node_get_bounding_box (priv->node);
   ret_val = g_object_ref (priv->node);


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