[grilo-plugins/wip/hadess/tracker3-auto-flatpak] tracker3: Handle sandboxed tracker3 automatically
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins/wip/hadess/tracker3-auto-flatpak] tracker3: Handle sandboxed tracker3 automatically
- Date: Wed, 26 Aug 2020 12:49:08 +0000 (UTC)
commit a29fead4bde2171dd1acb87dab4b72d588c3e351
Author: Bastien Nocera <hadess hadess net>
Date: Wed Aug 26 14:47:09 2020 +0200
tracker3: Handle sandboxed tracker3 automatically
When running under Flatpak, and if the application isn't allowed to talk to
Tracker 3 outside the sandbox, assume that the miners run inside the
sandbox and change the service name as appropriate.
src/tracker3/grl-tracker.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
---
diff --git a/src/tracker3/grl-tracker.c b/src/tracker3/grl-tracker.c
index a07dbd20..d91158a8 100644
--- a/src/tracker3/grl-tracker.c
+++ b/src/tracker3/grl-tracker.c
@@ -89,6 +89,29 @@ tracker_new_connection_cb (GObject *object,
init_sources ();
}
+static void
+set_miner_service (void)
+{
+ g_autoptr(GKeyFile) keyfile = NULL;
+ const char *value;
+
+ if (!g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS))
+ return;
+
+ keyfile = g_key_file_new ();
+ if (!g_key_file_load_from_file (keyfile, "/.flatpak-info", G_KEY_FILE_NONE, NULL))
+ return;
+
+ value = g_key_file_get_value (keyfile, "Session Bus Policy", "org.freedesktop.Tracker3.Miner.Files", NULL);
+ if (value && g_str_equal (value, "talk"))
+ return;
+
+ value = g_key_file_get_string (keyfile, "Application", "name", NULL);
+ grl_tracker_miner_service = g_strdup_printf ("%s.Miner.Files", value);
+ GRL_INFO("\tRunning in sandboxed mode, using %s as miner service",
+ grl_tracker_miner_service);
+}
+
gboolean
grl_tracker3_plugin_init (GrlRegistry *registry,
GrlPlugin *plugin,
@@ -125,6 +148,9 @@ grl_tracker3_plugin_init (GrlRegistry *registry,
grl_config_get_string (config, "miner-service");
}
+ if (!grl_tracker_miner_service)
+ set_miner_service ();
+
grl_tracker_plugin_init_cancel = g_cancellable_new ();
if (grl_tracker_store_path) {
store = g_file_new_for_path (grl_tracker_store_path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]