[grilo-plugins/wip/carlosg/tracker3] tracker3: Add configuration option to change miner service



commit 8294df8b1dfb03fd40408d35b9f5111f3d65d0bb
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jun 30 10:25:28 2020 +0200

    tracker3: Add configuration option to change miner service
    
    This may be useful if using domain ontologies for the tracker-miner
    services (e.g. a flatpak app without tracker3 in the host), in this
    case the miner service would be based on the app DBus name, thus
    queries and notification subscriptions need to change.

 src/tracker3/grl-tracker-source-notif.c      | 2 ++
 src/tracker3/grl-tracker-source-priv.h       | 1 +
 src/tracker3/grl-tracker-source-statements.c | 5 ++++-
 src/tracker3/grl-tracker.c                   | 3 +++
 4 files changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/src/tracker3/grl-tracker-source-notif.c b/src/tracker3/grl-tracker-source-notif.c
index 59b76c27..591eb3db 100644
--- a/src/tracker3/grl-tracker-source-notif.c
+++ b/src/tracker3/grl-tracker-source-notif.c
@@ -182,6 +182,8 @@ grl_tracker_source_notify_constructed (GObject *object)
   bus_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
   tracker_notifier_signal_subscribe (self->notifier,
                                      bus_connection,
+                                     grl_tracker_miner_service ?
+                                     grl_tracker_miner_service :
                                      "org.freedesktop.Tracker3.Miner.Files",
                                      NULL,
                                      NULL);
diff --git a/src/tracker3/grl-tracker-source-priv.h b/src/tracker3/grl-tracker-source-priv.h
index 90454c69..caa78d5c 100644
--- a/src/tracker3/grl-tracker-source-priv.h
+++ b/src/tracker3/grl-tracker-source-priv.h
@@ -84,5 +84,6 @@ extern GrlTrackerCache *grl_tracker_item_cache;
 
 /* tracker plugin config */
 extern gchar *grl_tracker_store_path;
+extern gchar *grl_tracker_miner_service;
 
 #endif /* _GRL_TRACKER_SOURCE_PRIV_H_ */
diff --git a/src/tracker3/grl-tracker-source-statements.c b/src/tracker3/grl-tracker-source-statements.c
index 157f906b..10afc5d5 100644
--- a/src/tracker3/grl-tracker-source-statements.c
+++ b/src/tracker3/grl-tracker-source-statements.c
@@ -223,7 +223,10 @@ create_query_string (GrlTrackerQueryType  type,
   merged_list = get_all_keys (keys, options);
 
   /* Remote miner-fs bits */
-  g_string_append (str, "SERVICE <dbus:" MINER_FS_BUS_NAME "> { ");
+  g_string_append_printf (str, "SERVICE <dbus:%s> { ",
+                          grl_tracker_miner_service ?
+                          grl_tracker_miner_service :
+                          MINER_FS_BUS_NAME);
 
   /* Make a subquery so we can apply limit and offset */
   g_string_append (str, "SELECT ?mediaType ?urn ");
diff --git a/src/tracker3/grl-tracker.c b/src/tracker3/grl-tracker.c
index cab9e45a..a07dbd20 100644
--- a/src/tracker3/grl-tracker.c
+++ b/src/tracker3/grl-tracker.c
@@ -56,6 +56,7 @@ GCancellable *grl_tracker_plugin_init_cancel = NULL;
 
 /* tracker plugin config */
 gchar *grl_tracker_store_path = NULL;
+gchar *grl_tracker_miner_service = NULL;
 
 /* =================== Tracker Plugin  =============== */
 
@@ -120,6 +121,8 @@ grl_tracker3_plugin_init (GrlRegistry *registry,
 
     grl_tracker_store_path =
       grl_config_get_string (config, "store-path");
+    grl_tracker_miner_service =
+      grl_config_get_string (config, "miner-service");
   }
 
   grl_tracker_plugin_init_cancel = g_cancellable_new ();


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