[gnome-photos/wip/rishi/collection: 37/44] Use BaseItem API to get the thumbnail path



commit 141fc505d4be3213239081a434c54868bf901256
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Jan 24 18:58:39 2018 +0100

    Use BaseItem API to get the thumbnail path
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751212

 src/photos-base-item.c         | 7 ++-----
 src/photos-facebook-item.c     | 6 +++---
 src/photos-flickr-item.c       | 6 +++---
 src/photos-google-item.c       | 6 +++---
 src/photos-local-item.c        | 2 +-
 src/photos-media-server-item.c | 2 +-
 6 files changed, 13 insertions(+), 16 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 2acc37aa..d489f622 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -465,13 +465,10 @@ photos_base_item_create_thumbnail_in_thread_func (gpointer data, gpointer user_d
 {
   g_autoptr (GTask) task = G_TASK (data);
   PhotosBaseItem *self;
-  PhotosBaseItemPrivate *priv;
   GCancellable *cancellable;
   GError *error;
 
   self = PHOTOS_BASE_ITEM (g_task_get_source_object (task));
-  priv = photos_base_item_get_instance_private (self);
-
   cancellable = g_task_get_cancellable (task);
 
   error = NULL;
@@ -482,7 +479,7 @@ photos_base_item_create_thumbnail_in_thread_func (gpointer data, gpointer user_d
           g_autoptr (GFile) file = NULL;
           g_autofree gchar *path = NULL;
 
-          path = photos_utils_get_thumbnail_path_for_uri (priv->uri);
+          path = photos_base_item_create_thumbnail_path (self);
           file = g_file_new_for_path (path);
           g_file_delete (file, NULL, NULL);
         }
@@ -1854,7 +1851,7 @@ photos_base_item_pipeline_save_save (GObject *source_object, GAsyncResult *res,
   g_clear_object (&priv->cancellable);
   priv->cancellable = g_cancellable_new ();
 
-  thumbnail_path = photos_utils_get_thumbnail_path_for_uri (priv->uri);
+  thumbnail_path = photos_base_item_create_thumbnail_path (self);
   thumbnail_file = g_file_new_for_path (thumbnail_path);
   g_file_delete_async (thumbnail_file,
                        G_PRIORITY_DEFAULT,
diff --git a/src/photos-facebook-item.c b/src/photos-facebook-item.c
index 5ca69489..33c9efc0 100644
--- a/src/photos-facebook-item.c
+++ b/src/photos-facebook-item.c
@@ -162,13 +162,13 @@ photos_facebook_item_create_thumbnail (PhotosBaseItem *item, GCancellable *cance
 
   remote_file = g_file_new_for_uri (thumbnail_image->source);
 
-  uri = photos_base_item_get_uri (item);
-  local_path = photos_utils_get_thumbnail_path_for_uri (uri);
+  local_path = photos_base_item_create_thumbnail_path (item);
   local_file = g_file_new_for_path (local_path);
-
   local_dir = g_path_get_dirname (local_path);
   g_mkdir_with_parents (local_dir, 0700);
 
+  uri = photos_base_item_get_uri (item);
+
   height = photos_base_item_get_height (item);
   width = photos_base_item_get_width (item);
 
diff --git a/src/photos-flickr-item.c b/src/photos-flickr-item.c
index 8638f465..0be5582e 100644
--- a/src/photos-flickr-item.c
+++ b/src/photos-flickr-item.c
@@ -229,13 +229,13 @@ photos_flickr_item_create_thumbnail (PhotosBaseItem *item, GCancellable *cancell
   thumbnail_uri = grl_media_get_thumbnail (media);
   remote_file = g_file_new_for_uri (thumbnail_uri);
 
-  uri = photos_base_item_get_uri (item);
-  local_path = photos_utils_get_thumbnail_path_for_uri (uri);
+  local_path = photos_base_item_create_thumbnail_path (item);
   local_file = g_file_new_for_path (local_path);
-
   local_dir = g_path_get_dirname (local_path);
   g_mkdir_with_parents (local_dir, 0700);
 
+  uri = photos_base_item_get_uri (item);
+
   height = photos_base_item_get_height (item);
   width = photos_base_item_get_width (item);
 
diff --git a/src/photos-google-item.c b/src/photos-google-item.c
index 76944aa5..faf7104a 100644
--- a/src/photos-google-item.c
+++ b/src/photos-google-item.c
@@ -187,13 +187,13 @@ photos_google_item_create_thumbnail (PhotosBaseItem *item, GCancellable *cancell
   thumbnail_uri = gdata_media_thumbnail_get_uri (thumbnail);
   remote_file = g_file_new_for_uri (thumbnail_uri);
 
-  uri = photos_base_item_get_uri (item);
-  local_path = photos_utils_get_thumbnail_path_for_uri (uri);
+  local_path = photos_base_item_create_thumbnail_path (item);
   local_file = g_file_new_for_path (local_path);
-
   local_dir = g_path_get_dirname (local_path);
   g_mkdir_with_parents (local_dir, 0700);
 
+  uri = photos_base_item_get_uri (item);
+
   height = photos_base_item_get_height (item);
   width = photos_base_item_get_width (item);
 
diff --git a/src/photos-local-item.c b/src/photos-local-item.c
index 746e21bf..661ba130 100644
--- a/src/photos-local-item.c
+++ b/src/photos-local-item.c
@@ -216,7 +216,7 @@ photos_local_item_create_thumbnail (PhotosBaseItem *item, GCancellable *cancella
   orientation = photos_base_item_get_orientation (PHOTOS_BASE_ITEM (self));
   height = photos_base_item_get_height (PHOTOS_BASE_ITEM (self));
   width = photos_base_item_get_width (PHOTOS_BASE_ITEM (self));
-  thumbnail_path = photos_utils_get_thumbnail_path_for_uri (uri);
+  thumbnail_path = photos_base_item_create_thumbnail_path (PHOTOS_BASE_ITEM (self));
 
   pipeline_path = photos_local_item_get_pipeline_path (self);
   pipeline_uri = photos_utils_convert_path_to_uri (pipeline_path);
diff --git a/src/photos-media-server-item.c b/src/photos-media-server-item.c
index deed7ba3..fa78455f 100644
--- a/src/photos-media-server-item.c
+++ b/src/photos-media-server-item.c
@@ -95,7 +95,7 @@ photos_media_server_item_create_thumbnail (PhotosBaseItem *item, GCancellable *c
   orientation = photos_base_item_get_orientation (item);
   height = photos_base_item_get_height (item);
   width = photos_base_item_get_width (item);
-  thumbnail_path = photos_utils_get_thumbnail_path_for_uri (uri);
+  thumbnail_path = photos_base_item_create_thumbnail_path (item);
 
   ret_val = photos_utils_create_thumbnail (file,
                                            mime_type,


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