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



commit 84bd73a5d63b72f37c8852460a9e1cbe8abd9a48
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 20d13fa6..a3041a4e 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -957,9 +957,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))
     {
       photos_item_manager_add_cursor_for_mode (self, cursor, PHOTOS_WINDOW_MODE_COLLECTIONS, force);
@@ -971,13 +981,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]