[gnome-notes/wip/igaldino/optional-private-store] tracker: Make private store optional



commit 4493f23c9170fbcc811e16a366ca7252e2e4e6e1
Author: Isaque Galdino <igaldino gmail com>
Date:   Tue Nov 6 20:12:03 2018 -0200

    tracker: Make private store optional
    
    In commit dd4fec2f we have changed the way Notes handle Tracker, to use
    it as a library instead of a service.
    
    That is cool for sandbox package where it doesn't need to rely on
    anything else.
    
    But it might be interesting, when installed as a standard application,
    to use the system service instead of a local one.

 build-aux/flatpak/org.gnome.Notes.json | 3 +++
 meson.build                            | 4 ++++
 meson_options.txt                      | 1 +
 src/bijiben-shell-search-provider.c    | 4 ++++
 src/libbiji/biji-manager.c             | 6 +++++-
 5 files changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/build-aux/flatpak/org.gnome.Notes.json b/build-aux/flatpak/org.gnome.Notes.json
index fe3da49..ccccb84 100644
--- a/build-aux/flatpak/org.gnome.Notes.json
+++ b/build-aux/flatpak/org.gnome.Notes.json
@@ -139,6 +139,9 @@
             "name" : "bijiben",
             "buildsystem" : "meson",
             "builddir" : true,
+            "config-opts" : [
+                "-Dprivate_store=true"
+            ],
             "sources" : [
                 {
                     "type" : "git",
diff --git a/meson.build b/meson.build
index 2ef08a2..8293b75 100644
--- a/meson.build
+++ b/meson.build
@@ -40,6 +40,9 @@ foreach define: set_defines
   config_h.set_quoted(define[0], define[1])
 endforeach
 
+# Tracker
+config_h.set('TRACKER_PRIVATE_STORE', get_option('private_store'))
+
 # compiler flags
 common_flags = [
   '-DHAVE_CONFIG_H',
@@ -146,4 +149,5 @@ meson.add_install_script(
 
 output = '  Version:          ' + bijiben_version + '\n'
 output += '  Enable Zeitgeist  ' + enable_zeitgeist.to_string() + '\n'
+output += '  Use Private Store ' + get_option('private_store').to_string() + '\n'
 message(output)
diff --git a/meson_options.txt b/meson_options.txt
index 4e05542..db8f705 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,2 +1,3 @@
 option('zeitgeist', type: 'boolean', value: false, description: 'Enable Zeitgeist')
 option('update_mimedb', type: 'boolean', value: true, description: 'update-mime-database after install')
+option('private_store', type: 'boolean', value: false, description: 'Use Tracker private store instead of 
Tracker service')
diff --git a/src/bijiben-shell-search-provider.c b/src/bijiben-shell-search-provider.c
index 021042f..515ed40 100644
--- a/src/bijiben-shell-search-provider.c
+++ b/src/bijiben-shell-search-provider.c
@@ -423,6 +423,7 @@ bijiben_shell_search_provider_app_init (BijibenShellSearchProviderApp *self)
   char *storage_path;
   GFile *storage;
   GdkRGBA color = { 0, 0, 0, 0 };
+#ifdef TRACKER_PRIVATE_STORE
   g_autofree char *filename = NULL;
   g_autoptr (GFile) data_location = NULL;
 
@@ -436,6 +437,9 @@ bijiben_shell_search_provider_app_init (BijibenShellSearchProviderApp *self)
                                                           data_location,
                                                           NULL, NULL, NULL,
                                                           &error);
+#else
+  self->connection = tracker_sparql_connection_get (NULL, &error);
+#endif
 
   if (error)
   {
diff --git a/src/libbiji/biji-manager.c b/src/libbiji/biji-manager.c
index ea2853d..8433c65 100644
--- a/src/libbiji/biji-manager.c
+++ b/src/libbiji/biji-manager.c
@@ -17,7 +17,7 @@
 
 #include <gtk/gtk.h>
 
-
+#include "config.h"
 #include "libbiji.h"
 #include "biji-notebook.h"
 #include "biji-error.h"
@@ -218,6 +218,7 @@ biji_manager_initable_init (GInitable *initable,
   GError *local_error = NULL;
   GoaClient *client;
   ESourceRegistry *registry;
+#ifdef TRACKER_PRIVATE_STORE
   g_autofree char *filename = NULL;
   g_autoptr (GFile) data_location = NULL;
 
@@ -233,6 +234,9 @@ biji_manager_initable_init (GInitable *initable,
                                                           data_location,
                                                           NULL, NULL, NULL,
                                                           &local_error);
+#else
+  self->connection = tracker_sparql_connection_get (NULL, &local_error);
+#endif
 
   if (local_error)
   {


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