[gnome-photos/wip/rishi/collection: 23/25] tracker-controller, tracker-search-controller: Delay SEARCH queries
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/collection: 23/25] tracker-controller, tracker-search-controller: Delay SEARCH queries
- Date: Thu, 18 Jan 2018 09:00:06 +0000 (UTC)
commit 93ef8d77a0d8a362ecc857a89e72ccef4346ae54
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Jan 17 20:47:23 2018 +0100
tracker-controller, tracker-search-controller: Delay SEARCH queries
Currently TrackerSearchController issues an "empty" search query at
startup. This is wasteful because the SEARCH view isn't shown when the
MainWindow is presented for the first time. It's only revealed when at
least one search criterion is specified, which requires a new query to
fetch the relevant results.
src/photos-tracker-controller.c | 17 +++++++++++++++++
src/photos-tracker-search-controller.c | 5 ++++-
2 files changed, 21 insertions(+), 1 deletion(-)
---
diff --git a/src/photos-tracker-controller.c b/src/photos-tracker-controller.c
index 59f7207b..d18ebe79 100644
--- a/src/photos-tracker-controller.c
+++ b/src/photos-tracker-controller.c
@@ -54,6 +54,7 @@ struct _PhotosTrackerControllerPrivate
PhotosQuery *current_query;
PhotosTrackerQueue *queue;
PhotosWindowMode mode;
+ gboolean delay_start;
gboolean is_frozen;
gboolean is_started;
gboolean query_queued;
@@ -67,6 +68,7 @@ struct _PhotosTrackerControllerPrivate
enum
{
PROP_0,
+ PROP_DELAY_START,
PROP_MODE
};
@@ -518,6 +520,10 @@ photos_tracker_controller_set_property (GObject *object, guint prop_id, const GV
switch (prop_id)
{
+ case PROP_DELAY_START:
+ priv->delay_start = g_value_get_boolean (value);
+ break;
+
case PROP_MODE:
priv->mode = (PhotosWindowMode) g_value_get_enum (value);
break;
@@ -579,6 +585,14 @@ photos_tracker_controller_class_init (PhotosTrackerControllerClass *class)
object_class->set_property = photos_tracker_controller_set_property;
object_class->finalize = photos_tracker_controller_finalize;
+ g_object_class_install_property (object_class,
+ PROP_DELAY_START,
+ g_param_spec_boolean ("delay-start",
+ "Delay start",
+ "Don't start issuing queries immediately on
start-up",
+ FALSE,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
+
g_object_class_install_property (object_class,
PROP_MODE,
g_param_spec_enum ("mode",
@@ -639,6 +653,9 @@ photos_tracker_controller_start (PhotosTrackerController *self)
priv = photos_tracker_controller_get_instance_private (self);
+ if (priv->delay_start)
+ return;
+
if (priv->is_started)
return;
diff --git a/src/photos-tracker-search-controller.c b/src/photos-tracker-search-controller.c
index 352b83c0..629dc57a 100644
--- a/src/photos-tracker-search-controller.c
+++ b/src/photos-tracker-search-controller.c
@@ -181,5 +181,8 @@ photos_tracker_search_controller_class_init (PhotosTrackerSearchControllerClass
PhotosTrackerController *
photos_tracker_search_controller_dup_singleton (void)
{
- return g_object_new (PHOTOS_TYPE_TRACKER_SEARCH_CONTROLLER, "mode", PHOTOS_WINDOW_MODE_SEARCH, NULL);
+ return g_object_new (PHOTOS_TYPE_TRACKER_SEARCH_CONTROLLER,
+ "delay-start", TRUE,
+ "mode", PHOTOS_WINDOW_MODE_SEARCH,
+ NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]