[gnome-photos] local-item: Split out the code to construct the pipeline path



commit 6ecd4d5ebf40126478b362a5820e22f7ebf81a81
Author: Debarshi Ray <debarshir gnome org>
Date:   Sun Feb 12 03:42:34 2017 +0100

    local-item: Split out the code to construct the pipeline path
    
    In a subsequent commit, we will use this to pass the pipeline, if any,
    to the thumbnailer.

 src/photos-local-item.c |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/src/photos-local-item.c b/src/photos-local-item.c
index 70fe4ed..e3eda5a 100644
--- a/src/photos-local-item.c
+++ b/src/photos-local-item.c
@@ -73,29 +73,40 @@ photos_local_item_create_name_fallback (PhotosBaseItem *item)
 
 
 static gchar *
-photos_local_item_create_pipeline_path (PhotosBaseItem *item)
+photos_local_item_get_pipeline_path (PhotosLocalItem *self)
 {
   const gchar *data_dir;
   const gchar *uri;
-  gchar *app_data_dir;
   gchar *md5;
   gchar *path;
 
-  uri = photos_base_item_get_uri (item);
+  uri = photos_base_item_get_uri (PHOTOS_BASE_ITEM (self));
   md5 = g_compute_checksum_for_string (G_CHECKSUM_MD5, uri, -1);
   data_dir = g_get_user_data_dir ();
 
-  app_data_dir = g_build_filename (data_dir, PACKAGE_TARNAME, "local", NULL);
-  g_mkdir_with_parents (app_data_dir, 0700);
+  path = g_build_filename (data_dir, PACKAGE_TARNAME, "local", md5, NULL);
 
-  path = g_build_filename (app_data_dir, md5, NULL);
-
-  g_free (app_data_dir);
   g_free (md5);
   return path;
 }
 
 
+static gchar *
+photos_local_item_create_pipeline_path (PhotosBaseItem *item)
+{
+  PhotosLocalItem *self = PHOTOS_LOCAL_ITEM (item);
+  gchar *path;
+  gchar *pipeline_dir;
+
+  path = photos_local_item_get_pipeline_path (self);
+  pipeline_dir = g_path_get_dirname (path);
+  g_mkdir_with_parents (pipeline_dir, 0700);
+
+  g_free (pipeline_dir);
+  return path;
+}
+
+
 static gboolean
 photos_local_item_create_thumbnail (PhotosBaseItem *item, GCancellable *cancellable, GError **error)
 {


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