[gnome-photos] query: Loosen the requirement to provide a SearchContextState



commit d52f94a87fd5b108db6f74f5e96ae82045fde540
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Sep 4 16:18:59 2017 +0200

    query: Loosen the requirement to provide a SearchContextState
    
    Currently, the SearchContextState (or the Source) is only used by
    TrackerController, and is not used by every SPARQL query. A subsequent
    commit will replace raw strings with Query objects in the TrackerQueue
    API, and this is a prerequisite for that.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=787833

 src/photos-query.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/photos-query.c b/src/photos-query.c
index 83320ed..9e4132f 100644
--- a/src/photos-query.c
+++ b/src/photos-query.c
@@ -37,14 +37,18 @@ const gchar *PHOTOS_QUERY_LOCAL_COLLECTIONS_IDENTIFIER = "photos:collection:loca
 PhotosQuery *
 photos_query_new (PhotosSearchContextState *state, gchar *sparql)
 {
-  GObject *active_object;
   PhotosQuery *query;
 
   query = g_slice_new0 (PhotosQuery);
 
-  active_object = photos_base_manager_get_active_object (state->src_mngr);
-  if (active_object != NULL)
-    query->source = PHOTOS_SOURCE (g_object_ref (active_object));
+  if (state != NULL)
+    {
+      GObject *active_object;
+
+      active_object = photos_base_manager_get_active_object (state->src_mngr);
+      if (active_object != NULL)
+        query->source = PHOTOS_SOURCE (g_object_ref (active_object));
+    }
 
   query->sparql = sparql;
 


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