[gnome-music/wip/jfelder/tracker3: 33/34] coregrilo: Avoid Tracker configuration crash




commit 3fd8063752ff33238a387179323b97a7213eba62
Author: Marinus Schraal <mschraal gnome org>
Date:   Mon Aug 24 22:06:59 2020 +0200

    coregrilo: Avoid Tracker configuration crash
    
    If TrackerWrapper takes a long time to create a connection,
    miner_fs_busname may still be unset. This will crash the Grilo Tracker3
    plugin registry configuration.
    
    To avoid this only set the configuration when TrackerWrapper is
    available.

 gnomemusic/coregrilo.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gnomemusic/coregrilo.py b/gnomemusic/coregrilo.py
index aabd3f74..d587cdf0 100644
--- a/gnomemusic/coregrilo.py
+++ b/gnomemusic/coregrilo.py
@@ -83,13 +83,6 @@ class CoreGrilo(GObject.GObject):
         config.set_api_key(self._theaudiodb_api_key)
         self._registry.add_config(config)
 
-        config = Grl.Config.new("grl-tracker3", "grl-tracker3-source")
-        config.set_string(
-            "miner-service", self._tracker_wrapper.props.miner_fs_busname)
-        config.set_string(
-            "store-path", self._tracker_wrapper.cache_directory())
-        self._registry.add_config(config)
-
         self._registry.connect('source-added', self._on_source_added)
         self._registry.connect('source-removed', self._on_source_removed)
 
@@ -121,6 +114,13 @@ class CoreGrilo(GObject.GObject):
         # FIXME:No removal support yet.
         new_state = self._tracker_wrapper.props.tracker_available
         if new_state == TrackerState.AVAILABLE:
+            config = Grl.Config.new("grl-tracker3", "grl-tracker3-source")
+            config.set_string(
+                "miner-service", self._tracker_wrapper.props.miner_fs_busname)
+            config.set_string(
+                "store-path", self._tracker_wrapper.cache_directory())
+            self._registry.add_config(config)
+
             self._registry.activate_plugin_by_id("grl-tracker3")
 
     def _on_source_added(self, registry, source):


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