Commit 9bae6c03 authored by Debarshi Ray's avatar Debarshi Ray

search-type-manager: Add a SearchType for collections

This includes both local and non-local collections.
parent 92d0f0bd
......@@ -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:";
......
......@@ -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;
......
/*
* 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')");
......
/*
* 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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment