[gnome-photos/wip/rishi/edit-mode: 29/33] query-builder, utils: Move convert_path_to_uri
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/edit-mode: 29/33] query-builder, utils: Move convert_path_to_uri
- Date: Wed, 11 Nov 2015 18:44:18 +0000 (UTC)
commit e774b73237c625e480ffce2f869146703d43e7fd
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Nov 11 16:38:57 2015 +0100
query-builder, utils: Move convert_path_to_uri
We need it to create the URI where a BaseItem will be saved.
src/photos-query-builder.c | 28 ++++++----------------------
src/photos-utils.c | 17 +++++++++++++++++
src/photos-utils.h | 2 ++
3 files changed, 25 insertions(+), 22 deletions(-)
---
diff --git a/src/photos-query-builder.c b/src/photos-query-builder.c
index 6bce288..58325fb 100644
--- a/src/photos-query-builder.c
+++ b/src/photos-query-builder.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012, 2013, 2014 Red Hat, Inc.
+ * Copyright © 2012, 2013, 2014, 2015 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -33,6 +33,7 @@
#include "photos-source-manager.h"
#include "photos-search-match-manager.h"
#include "photos-search-type-manager.h"
+#include "photos-utils.h"
static const gchar *TRACKER_SCHEMA = "org.freedesktop.Tracker.Miner.Files";
@@ -40,23 +41,6 @@ static const gchar *TRACKER_KEY_RECURSIVE_DIRECTORIES = "index-recursive-directo
static gchar *
-photos_query_builder_convert_path_to_uri (const gchar *path)
-{
- GFile *file;
- gchar *uri;
-
- if (path == NULL)
- return g_strdup ("");
-
- file = g_file_new_for_path (path);
- uri = g_file_get_uri (file);
- g_object_unref (file);
-
- return uri;
-}
-
-
-static gchar *
photos_query_builder_filter (PhotosSearchContextState *state, gint flags)
{
gchar *sparql;
@@ -388,19 +372,19 @@ photos_query_builder_filter_local (void)
if (tracker_dirs[i][0] == '&' || tracker_dirs[i][0] == '$')
continue;
- tracker_uri = photos_query_builder_convert_path_to_uri (tracker_dirs[i]);
+ tracker_uri = photos_utils_convert_path_to_uri (tracker_dirs[i]);
g_string_append_printf (tracker_filter, " || fn:contains (nie:url (?urn), '%s')", tracker_uri);
g_free (tracker_uri);
}
path = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
- desktop_uri = photos_query_builder_convert_path_to_uri (path);
+ desktop_uri = photos_utils_convert_path_to_uri (path);
path = g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD);
- download_uri = photos_query_builder_convert_path_to_uri (path);
+ download_uri = photos_utils_convert_path_to_uri (path);
path = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES);
- pictures_uri = photos_query_builder_convert_path_to_uri (path);
+ pictures_uri = photos_utils_convert_path_to_uri (path);
filter = g_strdup_printf ("(fn:contains (nie:url (?urn), '%s')"
" || fn:contains (nie:url (?urn), '%s')"
diff --git a/src/photos-utils.c b/src/photos-utils.c
index bcee0fb..34fa99c 100644
--- a/src/photos-utils.c
+++ b/src/photos-utils.c
@@ -125,6 +125,23 @@ photos_utils_center_pixbuf (GdkPixbuf *pixbuf, gint size)
}
+gchar *
+photos_utils_convert_path_to_uri (const gchar *path)
+{
+ GFile *file;
+ gchar *uri;
+
+ if (path == NULL)
+ return g_strdup ("");
+
+ file = g_file_new_for_path (path);
+ uri = g_file_get_uri (file);
+ g_object_unref (file);
+
+ return uri;
+}
+
+
GIcon *
photos_utils_create_collection_icon (gint base_size, GList *pixbufs)
{
diff --git a/src/photos-utils.h b/src/photos-utils.h
index 111d376..2592436 100644
--- a/src/photos-utils.h
+++ b/src/photos-utils.h
@@ -56,6 +56,8 @@ void photos_utils_border_pixbuf (GdkPixbuf *pixbuf);
GdkPixbuf *photos_utils_center_pixbuf (GdkPixbuf *pixbuf, gint size);
+gchar *photos_utils_convert_path_to_uri (const gchar *path);
+
GIcon *photos_utils_create_collection_icon (gint base_size, GList *pixbufs);
GdkPixbuf *photos_utils_create_pixbuf_from_node (GeglNode *node);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]