[gnome-photos] search-type-manager: Add a SearchType for collections
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] search-type-manager: Add a SearchType for collections
- Date: Tue, 2 Apr 2013 22:38:54 +0000 (UTC)
commit 9bae6c0392bdd68eb4ae8d5f068cb19fb1bf3230
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Apr 2 17:25:19 2013 +0200
search-type-manager: Add a SearchType for collections
This includes both local and non-local collections.
src/photos-query.c | 1 +
src/photos-query.h | 1 +
src/photos-search-type-manager.c | 13 ++++++++++++-
src/photos-search-type.h | 3 ++-
4 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-query.c b/src/photos-query.c
index dc4c59c..06d9b2e 100644
--- a/src/photos-query.c
+++ b/src/photos-query.c
@@ -29,6 +29,7 @@
#include "photos-source-manager.h"
+const gchar *PHOTOS_QUERY_COLLECTIONS_IDENTIFIER = "photos:collection:";
const gchar *PHOTOS_QUERY_LOCAL_COLLECTIONS_IDENTIFIER = "photos:collection:local:";
diff --git a/src/photos-query.h b/src/photos-query.h
index 6ae9460..39526ea 100644
--- a/src/photos-query.h
+++ b/src/photos-query.h
@@ -56,6 +56,7 @@ typedef enum
PHOTOS_QUERY_FLAGS_FAVORITES = 1 << 1
} PhotosQueryFlags;
+extern const gchar *PHOTOS_QUERY_COLLECTIONS_IDENTIFIER;
extern const gchar *PHOTOS_QUERY_LOCAL_COLLECTIONS_IDENTIFIER;
typedef struct _PhotosQuery PhotosQuery;
diff --git a/src/photos-search-type-manager.c b/src/photos-search-type-manager.c
index 78ad35f..1a6b9bf 100644
--- a/src/photos-search-type-manager.c
+++ b/src/photos-search-type-manager.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -28,6 +28,7 @@
#include <glib.h>
#include <glib/gi18n.h>
+#include "photos-query.h"
#include "photos-search-type.h"
#include "photos-search-type-manager.h"
@@ -59,11 +60,21 @@ static void
photos_search_type_manager_init (PhotosSearchTypeManager *self)
{
PhotosSearchType *search_type;
+ gchar *filter;
search_type = photos_search_type_new (PHOTOS_SEARCH_TYPE_STOCK_ALL, _("All"));
photos_base_manager_add_object (PHOTOS_BASE_MANAGER (self), G_OBJECT (search_type));
g_object_unref (search_type);
+ filter = g_strconcat ("((fn:contains (rdf:type (?urn), \'nfo#DataContainer\'))"
+ " && (fn:starts-with (nao:identifier (?urn), \'",
PHOTOS_QUERY_COLLECTIONS_IDENTIFIER, "\'))"
+ ")",
+ NULL);
+ search_type = photos_search_type_new_with_filter (PHOTOS_SEARCH_TYPE_STOCK_COLLECTIONS, _("Albums"),
filter);
+ photos_base_manager_add_object (PHOTOS_BASE_MANAGER (self), G_OBJECT (search_type));
+ g_object_unref (search_type);
+ g_free (filter);
+
search_type = photos_search_type_new_with_filter (PHOTOS_SEARCH_TYPE_STOCK_PHOTOS,
_("Photos"),
"fn:contains (rdf:type (?urn), 'nmm#Photo')");
diff --git a/src/photos-search-type.h b/src/photos-search-type.h
index fdd4283..24c2102 100644
--- a/src/photos-search-type.h
+++ b/src/photos-search-type.h
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 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
@@ -52,6 +52,7 @@ G_BEGIN_DECLS
PHOTOS_TYPE_SEARCH_TYPE, PhotosSearchTypeClass))
#define PHOTOS_SEARCH_TYPE_STOCK_ALL "all"
+#define PHOTOS_SEARCH_TYPE_STOCK_COLLECTIONS "collections"
#define PHOTOS_SEARCH_TYPE_STOCK_PHOTOS "photos"
typedef struct _PhotosSearchType PhotosSearchType;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]