[gnome-notes] Port to Tracker 3
- From: Isaque Galdino de Araujo <igaldino src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-notes] Port to Tracker 3
- Date: Sun, 12 Jul 2020 23:03:15 +0000 (UTC)
commit 355042920a416a050891980d13694045ef8989e9
Author: Carlos Garnacho <mrgarnacho gmail com>
Date: Sun Jul 12 23:03:10 2020 +0000
Port to Tracker 3
Add yet another compile check for it, on top of the older versions.
Since Tracker3 databases are private by default, force the private_store
option on if tracker3 is used, and use the new constructor as per 3.x
API.
Adapt BijiTracker to remove priority argument from calls to Tracker3 API
tracker_sparql_connection_update*().
meson.build | 21 ++++++++++++++-------
src/bijiben-shell-search-provider.c | 15 ++++++++++++++-
src/libbiji/biji-manager.c | 15 ++++++++++++++-
src/libbiji/biji-tracker.c | 8 ++++++++
4 files changed, 50 insertions(+), 9 deletions(-)
---
diff --git a/meson.build b/meson.build
index d31f260..44a42c7 100644
--- a/meson.build
+++ b/meson.build
@@ -40,9 +40,6 @@ 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',
@@ -99,14 +96,24 @@ libgd = subproject(
)
libgd_dep = libgd.get_variable('libgd_dep')
-tracker_sparql_dep = dependency('tracker-sparql-2.0', required: false)
+tracker_sparql_dep = dependency('tracker-sparql-3.0', required: false)
+has_tracker3 = tracker_sparql_dep.found()
+config_h.set10('HAVE_TRACKER3', has_tracker3)
+
if not tracker_sparql_dep.found()
- tracker_sparql_dep = dependency('tracker-sparql-1.0', required: false)
+ tracker_sparql_dep = dependency('tracker-sparql-2.0', required: false)
if not tracker_sparql_dep.found()
- tracker_sparql_dep = dependency('tracker-sparql-0.18', required: true)
+ tracker_sparql_dep = dependency('tracker-sparql-1.0', required: false)
+ if not tracker_sparql_dep.found()
+ tracker_sparql_dep = dependency('tracker-sparql-0.18', required: true)
+ endif
endif
endif
+# Tracker
+private_store = get_option('private_store') or has_tracker3
+config_h.set('TRACKER_PRIVATE_STORE', private_store)
+
bijiben_deps = [
libgd_dep,
tracker_sparql_dep,
@@ -150,5 +157,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'
+output += ' Use Private Store ' + private_store.to_string() + ' (Tracker3: ' + has_tracker3.to_string() +
')\n'
message(output)
diff --git a/src/bijiben-shell-search-provider.c b/src/bijiben-shell-search-provider.c
index 8e1c737..387b768 100644
--- a/src/bijiben-shell-search-provider.c
+++ b/src/bijiben-shell-search-provider.c
@@ -427,17 +427,30 @@ bijiben_shell_search_provider_app_init (BijibenShellSearchProviderApp *self)
filename = g_build_filename (g_get_user_cache_dir (),
g_get_application_name (),
+#if HAVE_TRACKER3
+ "tracker3",
+#else
"tracker",
+#endif /* HAVE_TRACKER3 */
NULL);
data_location = g_file_new_for_path (filename);
+#if HAVE_TRACKER3
+ self->connection = tracker_sparql_connection_new (TRACKER_SPARQL_CONNECTION_FLAGS_READONLY,
+ data_location,
+ tracker_sparql_get_ontology_nepomuk (),
+ NULL,
+ &error);
+#else
self->connection = tracker_sparql_connection_local_new (TRACKER_SPARQL_CONNECTION_FLAGS_READONLY,
data_location,
NULL, NULL, NULL,
&error);
+#endif /* HAVE_TRACKER3 */
+
#else
self->connection = tracker_sparql_connection_get (NULL, &error);
-#endif
+#endif /* TRACKER_PRIVATE_STORE */
if (error)
{
diff --git a/src/libbiji/biji-manager.c b/src/libbiji/biji-manager.c
index e781781..4990937 100644
--- a/src/libbiji/biji-manager.c
+++ b/src/libbiji/biji-manager.c
@@ -224,19 +224,32 @@ biji_manager_initable_init (GInitable *initable,
filename = g_build_filename (g_get_user_cache_dir (),
g_get_application_name (),
+#if HAVE_TRACKER3
+ "tracker3",
+#else
"tracker",
+#endif /* HAVE_TRACKER3 */
NULL);
data_location = g_file_new_for_path (filename);
/* If tracker fails for some reason,
* do not attempt anything */
+#if HAVE_TRACKER3
+ self->connection = tracker_sparql_connection_new (TRACKER_SPARQL_CONNECTION_FLAGS_NONE,
+ data_location,
+ tracker_sparql_get_ontology_nepomuk (),
+ NULL,
+ &local_error);
+#else
self->connection = tracker_sparql_connection_local_new (TRACKER_SPARQL_CONNECTION_FLAGS_NONE,
data_location,
NULL, NULL, NULL,
&local_error);
+#endif /* HAVE_TRACKER3 */
+
#else
self->connection = tracker_sparql_connection_get (NULL, &local_error);
-#endif
+#endif /* TRACKER_PRIVATE_STORE */
if (local_error)
{
diff --git a/src/libbiji/biji-tracker.c b/src/libbiji/biji-tracker.c
index 206a2cc..85cb21d 100644
--- a/src/libbiji/biji-tracker.c
+++ b/src/libbiji/biji-tracker.c
@@ -15,6 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
#include "biji-item.h"
#include "biji-tracker.h"
@@ -152,7 +154,9 @@ biji_perform_update_async_and_free (TrackerSparqlConnection *connection,
(NULL, query, NULL, f, NULL, NULL, NULL, NULL, user_data);
tracker_sparql_connection_update_async (connection,
query,
+#if !HAVE_TRACKER3
0, // priority
+#endif
NULL,
biji_finish_update,
finisher);
@@ -497,7 +501,9 @@ biji_create_new_notebook_async (BijiManager *manager,
finisher = biji_tracker_finisher_new (manager, g_strdup (name), NULL, NULL, NULL, item_cb, NULL, NULL,
user_data);
tracker_sparql_connection_update_blank_async (get_connection (manager),
query,
+#if !HAVE_TRACKER3
G_PRIORITY_DEFAULT,
+#endif
NULL,
on_new_notebook_query_executed,
finisher);
@@ -655,7 +661,9 @@ push_new_note (BijiTrackerFinisher *finisher)
tracker_sparql_connection_update_blank_async (get_connection (manager),
query,
+#if !HAVE_TRACKER3
G_PRIORITY_DEFAULT,
+#endif
NULL,
NULL, // callback,
NULL); // user_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]