[gnome-photos/wip/rishi/collection: 5/27] item-manager: Hidden items shouldn't show up in searches and elsewhere



commit c6cf8767337c13bac37fe04bac21d7bf6f60ff67
Author: Debarshi Ray <debarshir gnome org>
Date:   Sun Jan 21 13:06:38 2018 +0100

    item-manager: Hidden items shouldn't show up in searches and elsewhere

 src/photos-item-manager.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
---
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index 616552eb..eb6d210c 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -956,9 +956,19 @@ photos_item_manager_new (void)
 void
 photos_item_manager_add_item (PhotosItemManager *self, TrackerSparqlCursor *cursor, gboolean force)
 {
+  PhotosItemManagerHiddenItem *old_hidden_item;
+  const gchar *id;
+
   g_return_if_fail (PHOTOS_IS_ITEM_MANAGER (self));
   g_return_if_fail (TRACKER_SPARQL_IS_CURSOR (cursor));
 
+  id = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_URN, NULL);
+  g_return_if_fail (id != NULL && id[0] != '\0');
+
+  old_hidden_item = (PhotosItemManagerHiddenItem *) g_hash_table_lookup (self->hidden_items, id);
+  if (old_hidden_item != NULL)
+    goto out;
+
   if (photos_item_manager_cursor_is_collection (cursor))
     {
       if (self->active_collection != NULL && force)
@@ -974,13 +984,29 @@ photos_item_manager_add_item (PhotosItemManager *self, TrackerSparqlCursor *curs
 
       photos_item_manager_add_cursor_for_mode (self, cursor, PHOTOS_WINDOW_MODE_OVERVIEW, force);
     }
+
+ out:
+  return;
 }
 
 
 void
 photos_item_manager_add_item_for_mode (PhotosItemManager *self, PhotosWindowMode mode, TrackerSparqlCursor 
*cursor)
 {
+  PhotosItemManagerHiddenItem *old_hidden_item;
+  const gchar *id;
+
+  id = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_URN, NULL);
+  g_return_if_fail (id != NULL && id[0] != '\0');
+
+  old_hidden_item = (PhotosItemManagerHiddenItem *) g_hash_table_lookup (self->hidden_items, id);
+  if (old_hidden_item != NULL)
+    goto out;
+
   photos_item_manager_add_cursor_for_mode (self, cursor, mode, FALSE);
+
+ out:
+  return;
 }
 
 


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