[gnome-photos/wip/uajain/de_dup: 4/4] WIP



commit 229f7770dafa261a08e8afa1dbccfe8883bbac14
Author: Umang Jain <mailumangjain gmail com>
Date:   Sat Aug 20 22:33:50 2016 +0530

    WIP

 src/photos-item-manager.c       |   22 ++++++++++++++++++++++
 src/photos-item-manager.h       |    3 +++
 src/photos-tracker-controller.c |    6 ++++++
 3 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index aa2a503..8985e01 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -829,6 +829,28 @@ photos_item_manager_get_load_state (PhotosItemManager *self)
   return self->load_state;
 }
 
+void
+photos_item_manager_hide_remote_objects (PhotosItemManager *self, TrackerSparqlCursor *cursor)
+{
+
+  PhotosBaseItem *item;
+  gint i = 0;
+  GError *error = NULL;
+  const gchar *id;
+
+  /*TODO: Make it async*/
+  while (tracker_sparql_cursor_next (cursor, NULL, &error))
+    {
+      //g_print ("Result [%d]: %s\n",i++, tracker_sparql_cursor_get_string (cursor, 0, NULL));
+      id = tracker_sparql_cursor_get_string (cursor, 0, NULL);
+      item = PHOTOS_BASE_ITEM (photos_base_manager_get_object_by_id 
(self->item_mngr_chldrn[PHOTOS_WINDOW_MODE_OVERVIEW], id));
+      if (item == NULL)
+       return;
+      photos_base_manager_remove_object_by_id (self->item_mngr_chldrn[PHOTOS_WINDOW_MODE_OVERVIEW], id);
+      g_signal_emit_by_name (self, "object-removed", G_OBJECT (item));
+    }
+}
+
 
 void
 photos_item_manager_hide_item (PhotosItemManager *self, PhotosBaseItem *item)
diff --git a/src/photos-item-manager.h b/src/photos-item-manager.h
index faa490e..64d1cba 100644
--- a/src/photos-item-manager.h
+++ b/src/photos-item-manager.h
@@ -121,6 +121,9 @@ void                      photos_mode_controller_set_fullscreen     (PhotosModeC
 void                      photos_mode_controller_set_window_mode    (PhotosModeController *self,
                                                                      PhotosWindowMode      mode);
 
+void                      photos_item_manager_hide_remote_objects   (PhotosItemManager *self,
+                                                                    TrackerSparqlCursor *cursor);
+
 G_END_DECLS
 
 #endif /* PHOTOS_ITEM_MANAGER_H */
diff --git a/src/photos-tracker-controller.c b/src/photos-tracker-controller.c
index 47be734..d45cc6d 100644
--- a/src/photos-tracker-controller.c
+++ b/src/photos-tracker-controller.c
@@ -374,6 +374,12 @@ photos_tracker_controller_window_mode_changed (PhotosTrackerController *self,
         */
        if (!photos_tracker_controller_get_query_status (self))
        {
+         GApplication *app;
+         PhotosSearchContextState *state;
+
+         app = g_application_get_default ();
+         state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app));
+
          PhotosQuery *query = photos_query_builder_get_remote_objects_with_related_to (state);
          photos_tracker_queue_select (priv->queue,
                                       query->sparql,


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