[gnome-music/wip/jfelder/grilo-reload-tracker-source: 6/6] coregrilo: Properly load tracker plugin



commit 59a8771c212278c9556803d88c90130f7b7094a9
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 8809e6c2..75db84f4 100644
--- a/gnomemusic/coregrilo.py
+++ b/gnomemusic/coregrilo.py
@@ -104,9 +104,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]