Commit b104dcb6 authored by Bastien Nocera's avatar Bastien Nocera
Browse files

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.
parent 3f7a47d3
Pipeline #207898 passed with stage
in 20 minutes and 34 seconds
......@@ -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))
keyfile = g_key_file_new ();
if (!g_key_file_load_from_file (keyfile, "/.flatpak-info", G_KEY_FILE_NONE, NULL))
value = g_key_file_get_value (keyfile, "Policy Tracker3", "dbus:org.freedesktop.Tracker3.Miner.Files", NULL);
if (value)
value = g_key_file_get_string (keyfile, "Application", "name", NULL);
grl_tracker_miner_service = g_strdup_printf ("%s.Tracker3.Miner.Files", value);
GRL_INFO("\tRunning in sandboxed mode, using %s as miner service",
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);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment