[gnome-photos/wip/favorites: 3/13] query-builder: Add a new flag and query for the Favorites mode
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/favorites: 3/13] query-builder: Add a new flag and query for the Favorites mode
- Date: Wed, 12 Dec 2012 18:30:57 +0000 (UTC)
commit 05f58eb7a16a14e64553013e70d847d9e1d6a83d
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Dec 12 23:07:15 2012 +0530
query-builder: Add a new flag and query for the Favorites mode
src/photos-query-builder.c | 15 ++++++++++++++-
src/photos-query-builder.h | 2 ++
src/photos-query.h | 3 ++-
3 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-query-builder.c b/src/photos-query-builder.c
index 804bcc1..3841add 100644
--- a/src/photos-query-builder.c
+++ b/src/photos-query-builder.c
@@ -96,7 +96,10 @@ photos_query_builder_query (gboolean global, gint flags)
gchar *where_sparql;
optional = photos_query_builder_optional ();
- where_sparql = g_strconcat ("WHERE { ?urn a rdfs:Resource ", optional, NULL);
+ if (flags & PHOTOS_QUERY_FLAGS_FAVORITES)
+ where_sparql = g_strconcat ("WHERE { ?urn nao:hasTag nao:predefined-tag-favorite ", optional, NULL);
+ else
+ where_sparql = g_strconcat ("WHERE { ?urn a rdfs:Resource ", optional, NULL);
g_free (optional);
if (!(flags & PHOTOS_QUERY_FLAGS_UNFILTERED))
@@ -172,6 +175,16 @@ photos_query_builder_count_query (void)
PhotosQuery *
+photos_query_builder_global_favorites_query (void)
+{
+ gchar *sparql;
+
+ sparql = photos_query_builder_query (TRUE, PHOTOS_QUERY_FLAGS_FAVORITES);
+ return photos_query_new (sparql);
+}
+
+
+PhotosQuery *
photos_query_builder_global_query (void)
{
gchar *sparql;
diff --git a/src/photos-query-builder.h b/src/photos-query-builder.h
index 886c72f..51995eb 100644
--- a/src/photos-query-builder.h
+++ b/src/photos-query-builder.h
@@ -33,6 +33,8 @@ G_BEGIN_DECLS
PhotosQuery *photos_query_builder_count_query (void);
+PhotosQuery *photos_query_builder_global_favorites_query (void);
+
PhotosQuery *photos_query_builder_global_query (void);
PhotosQuery *photos_query_builder_single_query (gint flags, const gchar *resource);
diff --git a/src/photos-query.h b/src/photos-query.h
index 1aac9a5..5d21452 100644
--- a/src/photos-query.h
+++ b/src/photos-query.h
@@ -52,7 +52,8 @@ typedef enum
typedef enum
{
PHOTOS_QUERY_FLAGS_NONE = 0,
- PHOTOS_QUERY_FLAGS_UNFILTERED = 1 << 0
+ PHOTOS_QUERY_FLAGS_UNFILTERED = 1 << 0,
+ PHOTOS_QUERY_FLAGS_FAVORITES = 1 << 1
} PhotosQueryFlags;
typedef struct _PhotosQuery PhotosQuery;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]