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



commit 5bef0fb3cabf5bdfa1b311959c5a7cffe43710c7
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 9550b6f..07d0a2c 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;
@@ -740,16 +739,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]