[gnome-photos/wip/search: 30/32] tracker-controller: Do not react to PhotosSourceManager:active-changed



commit 791284a00ca66b498622052e1d2a184f66164c68
Author: Debarshi Ray <debarshir gnome org>
Date:   Sun Jan 26 14:05:52 2014 +0100

    tracker-controller: Do not react to PhotosSourceManager:active-changed
    
    ... unless it is the PhotosTrackerSearchController, because we do not
    want to filter the other modes (ie. overview, collections and
    favorites) during search.

 src/photos-tracker-controller.c        |   18 +++++++-----------
 src/photos-tracker-controller.h        |    2 ++
 src/photos-tracker-search-controller.c |   12 +++++++++++-
 3 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/src/photos-tracker-controller.c b/src/photos-tracker-controller.c
index 9d2c796..09b1cff 100644
--- a/src/photos-tracker-controller.c
+++ b/src/photos-tracker-controller.c
@@ -208,13 +208,6 @@ photos_tracker_controller_offset_changed (PhotosTrackerController *self)
 
 
 static void
-photos_tracker_controller_refresh_for_object (PhotosTrackerController *self)
-{
-  photos_tracker_controller_refresh_internal (self, PHOTOS_TRACKER_REFRESH_FLAGS_RESET_OFFSET);
-}
-
-
-static void
 photos_tracker_controller_set_query_status (PhotosTrackerController *self, gboolean query_status)
 {
   PhotosTrackerControllerPrivate *priv = self->priv;
@@ -406,10 +399,6 @@ photos_tracker_controller_init (PhotosTrackerController *self)
                             "object-removed",
                             G_CALLBACK (photos_tracker_controller_source_object_added_removed),
                             self);
-  g_signal_connect_swapped (priv->src_mngr,
-                            "active-changed",
-                            G_CALLBACK (photos_tracker_controller_refresh_for_object),
-                            self);
 
   priv->queue = photos_tracker_queue_dup_singleton (NULL, &priv->queue_error);
 }
@@ -462,6 +451,13 @@ photos_tracker_controller_class_init (PhotosTrackerControllerClass *class)
 
 
 void
+photos_tracker_controller_refresh_for_object (PhotosTrackerController *self)
+{
+  photos_tracker_controller_refresh_internal (self, PHOTOS_TRACKER_REFRESH_FLAGS_RESET_OFFSET);
+}
+
+
+void
 photos_tracker_controller_start (PhotosTrackerController *self)
 {
   PhotosTrackerControllerPrivate *priv = self->priv;
diff --git a/src/photos-tracker-controller.h b/src/photos-tracker-controller.h
index 2cadf74..e2dfac2 100644
--- a/src/photos-tracker-controller.h
+++ b/src/photos-tracker-controller.h
@@ -81,6 +81,8 @@ GType                     photos_tracker_controller_get_type          (void) G_G
 
 gboolean                  photos_tracker_controller_get_query_status  (PhotosTrackerController *self);
 
+void                      photos_tracker_controller_refresh_for_object (PhotosTrackerController *self);
+
 void                      photos_tracker_controller_start             (PhotosTrackerController *self);
 
 G_END_DECLS
diff --git a/src/photos-tracker-search-controller.c b/src/photos-tracker-search-controller.c
index ec3ce5b..8e7e665 100644
--- a/src/photos-tracker-search-controller.c
+++ b/src/photos-tracker-search-controller.c
@@ -28,11 +28,13 @@
 #include "photos-mode-controller.h"
 #include "photos-offset-search-controller.h"
 #include "photos-query-builder.h"
+#include "photos-source-manager.h"
 #include "photos-tracker-search-controller.h"
 
 
 struct _PhotosTrackerSearchControllerPrivate
 {
+  PhotosBaseManager *src_mngr;
   PhotosOffsetController *offset_cntrlr;
 };
 
@@ -82,8 +84,10 @@ static void
 photos_tracker_search_controller_dispose (GObject *object)
 {
   PhotosTrackerSearchController *self = PHOTOS_TRACKER_SEARCH_CONTROLLER (object);
+  PhotosTrackerSearchControllerPrivate *priv = self->priv;
 
-  g_clear_object (&self->priv->offset_cntrlr);
+  g_clear_object (&priv->src_mngr);
+  g_clear_object (&priv->offset_cntrlr);
 
   G_OBJECT_CLASS (photos_tracker_search_controller_parent_class)->dispose (object);
 }
@@ -97,6 +101,12 @@ photos_tracker_search_controller_init (PhotosTrackerSearchController *self)
   self->priv = photos_tracker_search_controller_get_instance_private (self);
   priv = self->priv;
 
+  priv->src_mngr = photos_source_manager_dup_singleton ();
+  g_signal_connect_swapped (priv->src_mngr,
+                            "active-changed",
+                            G_CALLBACK (photos_tracker_controller_refresh_for_object),
+                            self);
+
   priv->offset_cntrlr = photos_offset_search_controller_dup_singleton ();
 }
 


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