[gnome-photos] item-manager: Fix logic to check if a cursor is a collection
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] item-manager: Fix logic to check if a cursor is a collection
- Date: Tue, 30 Aug 2016 09:14:57 +0000 (UTC)
commit 81d21039a06ea65a14508f5d72bbd78c334f3e8d
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Aug 24 11:05:58 2016 +0200
item-manager: Fix logic to check if a cursor is a collection
Some collections might not have a nao:identifier. eg., the built-in
nfo:image-category-screenshot. Instead, we should check the rdf:type
for nfo:DataContainer. This is also what PhotosBaseItem does.
This wasn't a problem so far because we were miraculously not hitting
this code path for such collections. Things are going to change in
subsequent commits when we sprinkle some assertions around the code.
https://bugzilla.gnome.org/show_bug.cgi?id=770342
src/photos-item-manager.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index 42e35bc..fb870a0 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -25,6 +25,8 @@
#include "config.h"
+#include <string.h>
+
#include <gio/gio.h>
#include <glib.h>
#include <tracker-sparql.h>
@@ -263,10 +265,10 @@ static gboolean
photos_item_manager_cursor_is_collection (TrackerSparqlCursor *cursor)
{
gboolean ret_val;
- const gchar *identifier;
+ const gchar *rdf_type;
- identifier = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_IDENTIFIER, NULL);
- ret_val = g_str_has_prefix (identifier, "photos:collection:");
+ rdf_type = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_RDF_TYPE, NULL);
+ ret_val = strstr (rdf_type, "nfo#DataContainer") != NULL;
return ret_val;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]