[gnome-photos/wip/foo: 8/13] query-builder: Add photos_query_builder_set_collection_query



commit 0c6429dffe03499ea5d6a76f521424a8d6bb7f8a
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Mar 29 17:34:02 2013 +0100

    query-builder: Add photos_query_builder_set_collection_query

 src/photos-query-builder.c |   13 +++++++++++++
 src/photos-query-builder.h |    4 ++++
 2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-query-builder.c b/src/photos-query-builder.c
index 67da6a3..fdc9fed 100644
--- a/src/photos-query-builder.c
+++ b/src/photos-query-builder.c
@@ -248,6 +248,19 @@ photos_query_builder_global_query (void)
 
 
 PhotosQuery *
+photos_query_builder_set_collection_query (const gchar *item_urn, const gchar *collection_urn, gboolean 
setting)
+{
+  gchar *sparql;
+
+  sparql = g_strdup_printf ("%s { <%s> nie:isPartOf <%s> }",
+                            setting ? "INSERT" : "DELETE",
+                            item_urn,
+                            collection_urn);
+  return photos_query_new (sparql);
+}
+
+
+PhotosQuery *
 photos_query_builder_single_query (gint flags, const gchar *resource)
 {
   GRegex *regex;
diff --git a/src/photos-query-builder.h b/src/photos-query-builder.h
index fb96505..fdbcddf 100644
--- a/src/photos-query-builder.h
+++ b/src/photos-query-builder.h
@@ -41,6 +41,10 @@ PhotosQuery  *photos_query_builder_global_favorites_query (void);
 
 PhotosQuery  *photos_query_builder_global_query        (void);
 
+PhotosQuery  *photos_query_builder_set_collection_query (const gchar *item_urn,
+                                                         const gchar *collection_urn,
+                                                         gboolean setting);
+
 PhotosQuery  *photos_query_builder_single_query        (gint flags, const gchar *resource);
 
 PhotosQuery  *photos_query_builder_update_mtime_query (const gchar *resource);


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