[gnome-photos] query-builder: Add photos_query_builder_single_query
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] query-builder: Add photos_query_builder_single_query
- Date: Sat, 18 Aug 2012 22:53:43 +0000 (UTC)
commit 4aebb743945fd58651a4e52e62db504dec16fa99
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Aug 17 03:24:43 2012 +0200
query-builder: Add photos_query_builder_single_query
src/photos-query-builder.c | 21 +++++++++++++++++++++
src/photos-query-builder.h | 4 ++++
2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-query-builder.c b/src/photos-query-builder.c
index 8ed4c57..82ce834 100644
--- a/src/photos-query-builder.c
+++ b/src/photos-query-builder.c
@@ -176,6 +176,27 @@ photos_query_builder_global_query (void)
}
+PhotosQuery *
+photos_query_builder_single_query (gint flags, const gchar *resource)
+{
+ GRegex *regex;
+ gchar *replacement;
+ gchar *sparql;
+ gchar *tmp;
+
+ tmp = photos_query_builder_query (TRUE, flags);
+
+ regex = g_regex_new ("\\?urn", 0, 0, NULL);
+ replacement = g_strconcat ("<", resource, ">", NULL);
+ sparql = g_regex_replace (regex, tmp, -1, 0, replacement, 0, NULL);
+ g_free (replacement);
+ g_free (tmp);
+ g_regex_unref (regex);
+
+ return photos_query_new (sparql);
+}
+
+
gchar *
photos_query_builder_filter_local (void)
{
diff --git a/src/photos-query-builder.h b/src/photos-query-builder.h
index a4fa94d..86c602c 100644
--- a/src/photos-query-builder.h
+++ b/src/photos-query-builder.h
@@ -21,6 +21,8 @@
#ifndef PHOTOS_QUERY_BUILDER_H
#define PHOTOS_QUERY_BUILDER_H
+#include <glib.h>
+
#include "photos-query.h"
G_BEGIN_DECLS
@@ -29,6 +31,8 @@ PhotosQuery *photos_query_builder_count_query (void);
PhotosQuery *photos_query_builder_global_query (void);
+PhotosQuery *photos_query_builder_single_query (gint flags, const gchar *resource);
+
gchar *photos_query_builder_filter_local (void);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]