[gnome-photos/wip/rishi/thumbnailer: 2/12] local-item: Split out the code to construct the pipeline path
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/thumbnailer: 2/12] local-item: Split out the code to construct the pipeline path
- Date: Sun, 12 Feb 2017 16:46:25 +0000 (UTC)
commit c996d350f6c5f32217371a4983033dc14cc77378
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 e4a7d59..50cee15 100644
--- a/src/photos-local-item.c
+++ b/src/photos-local-item.c
@@ -72,29 +72,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]