[gnome-notes/improve-tracker-support] tracker: Use private store



commit dd4fec2fb202e4f43e832d3da300c76e4c230963
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Oct 3 01:00:32 2018 +0200

    tracker: Use private store
    
    (through tracker_sparql_connection_local_new)
    
    This enables use of Tracker as a library instead of a service, making
    bijiben keep a private store, isolated from anything else. This data is
    stored in $XDG_CACHE_HOME/bijiben/tracker.

 build-aux/flatpak/org.gnome.Notes.json |  3 +--
 src/bijiben-shell-search-provider.c    | 15 +++++++++++++--
 src/libbiji/biji-manager.c             | 13 ++++++++++++-
 3 files changed, 26 insertions(+), 5 deletions(-)
---
diff --git a/build-aux/flatpak/org.gnome.Notes.json b/build-aux/flatpak/org.gnome.Notes.json
index 3888c92..fe3da49 100644
--- a/build-aux/flatpak/org.gnome.Notes.json
+++ b/build-aux/flatpak/org.gnome.Notes.json
@@ -25,8 +25,7 @@
         "--talk-name=org.gnome.evolution.dataserver.AddressBook9",
         "--talk-name=org.gnome.evolution.dataserver.Calendar7",
         "--talk-name=org.gnome.evolution.dataserver.Sources5",
-        "--talk-name=org.gnome.evolution.dataserver.Subprocess.Backend.*",
-        "--talk-name=org.freedesktop.Tracker1"
+        "--talk-name=org.gnome.evolution.dataserver.Subprocess.Backend.*"
     ],
     "build-options" : {
         "cflags" : "-O2 -g",
diff --git a/src/bijiben-shell-search-provider.c b/src/bijiben-shell-search-provider.c
index 6eebd1f..021042f 100644
--- a/src/bijiben-shell-search-provider.c
+++ b/src/bijiben-shell-search-provider.c
@@ -423,8 +423,19 @@ bijiben_shell_search_provider_app_init (BijibenShellSearchProviderApp *self)
   char *storage_path;
   GFile *storage;
   GdkRGBA color = { 0, 0, 0, 0 };
-
-  self->connection = tracker_sparql_connection_get (NULL, &error);
+  g_autofree char *filename = NULL;
+  g_autoptr (GFile) data_location = NULL;
+
+  filename = g_build_filename (g_get_user_cache_dir (),
+                               g_get_application_name (),
+                               "tracker",
+                               NULL);
+  data_location = g_file_new_for_path (filename);
+
+  self->connection = tracker_sparql_connection_local_new (TRACKER_SPARQL_CONNECTION_FLAGS_READONLY,
+                                                          data_location,
+                                                          NULL, NULL, NULL,
+                                                          &error);
 
   if (error)
   {
diff --git a/src/libbiji/biji-manager.c b/src/libbiji/biji-manager.c
index 38274b9..ea2853d 100644
--- a/src/libbiji/biji-manager.c
+++ b/src/libbiji/biji-manager.c
@@ -218,10 +218,21 @@ biji_manager_initable_init (GInitable *initable,
   GError *local_error = NULL;
   GoaClient *client;
   ESourceRegistry *registry;
+  g_autofree char *filename = NULL;
+  g_autoptr (GFile) data_location = NULL;
+
+  filename = g_build_filename (g_get_user_cache_dir (),
+                               g_get_application_name (),
+                               "tracker",
+                               NULL);
+  data_location = g_file_new_for_path (filename);
 
   /* If tracker fails for some reason,
    * do not attempt anything */
-  self->connection = tracker_sparql_connection_get (NULL, &local_error);
+  self->connection = tracker_sparql_connection_local_new (TRACKER_SPARQL_CONNECTION_FLAGS_NONE,
+                                                          data_location,
+                                                          NULL, NULL, NULL,
+                                                          &local_error);
 
   if (local_error)
   {


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