[gnome-music/wip/jfelder/3-34-grilo-tracker-reload: 4/4] coregrilo: Properly load tracker plugin



commit c854eef13f8ef9de1414cf33f6e50f1c1f501c05
Author: Jean Felder <jfelder src gnome org>
Date:   Wed Feb 19 17:56:06 2020 +0100

    coregrilo: Properly load tracker plugin
    
    All grilo plugins are loaded at startup. However, TrackerWrapper may
    not be available yet. In that case, GrlTrackerWrapper is not
    created. Once TrackerWrapper becomes available, all grilo plugins are
    loaded again in order to instantiate GrlTrackerWrapper.
    It means that all plugins are activated two times, while only the
    tracker plugin should be loaded.
    
    This issue is solved by only reloading the tracker plugin when
    TrackerWrapper becomes available.

 gnomemusic/coregrilo.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/coregrilo.py b/gnomemusic/coregrilo.py
index 80e635ca..1dedca9b 100644
--- a/gnomemusic/coregrilo.py
+++ b/gnomemusic/coregrilo.py
@@ -91,9 +91,10 @@ class CoreGrilo(GObject.GObject):
         new_state = self._tracker_wrapper.props.tracker_available
         # FIXME:No removal support yet.
         if new_state == TrackerState.AVAILABLE:
-            # FIXME: Look for a better way to just activate the Tracker
-            # plugin.
-            self._registry.load_all_plugins(True)
+            tracker_plugin = self._registry.lookup_plugin("grl-tracker")
+            if tracker_plugin:
+                self._registry.unload_plugin("grl-tracker")
+            self._registry.activate_plugin_by_id("grl-tracker")
 
     def _on_source_added(self, registry, source):
 


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