[gnome-games] grilo-media: Remove redundant sources



commit 34cbd45a57e466ea6f0a3c5c78da30ac6d37cee4
Author: 1PunMan <saurabhsingh412 gmail com>
Date:   Wed Mar 7 03:16:07 2018 +0530

    grilo-media: Remove redundant sources
    
    Currently grilo loads all the default plugins but looks for only one
    source (thegamesdb), this commit removes the redundant sources.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=782290

 src/grilo/grilo-media.vala | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/grilo/grilo-media.vala b/src/grilo/grilo-media.vala
index 5452917..19c5b95 100644
--- a/src/grilo/grilo-media.vala
+++ b/src/grilo/grilo-media.vala
@@ -1,6 +1,9 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
 public class Games.GriloMedia : Object {
+       private const string SOURCE_NAME = "grl-thegamesdb";
+       private const string SOURCE_TAG = "games";
+
        private static Grl.Registry registry;
 
        public signal void resolved ();
@@ -22,7 +25,14 @@ public class Games.GriloMedia : Object {
                        return registry;
 
                registry = Grl.Registry.get_default ();
-               registry.load_all_plugins(true);
+               registry.load_all_plugins (true);
+
+               var source_list = registry.get_sources (true);
+               source_list.foreach ((entry) => {
+                       var tags = entry.get_tags ();
+                       if (!(SOURCE_TAG in tags))
+                               registry.unregister_source (entry);
+               });
 
                return registry;
        }
@@ -47,7 +57,7 @@ public class Games.GriloMedia : Object {
                resolving = true;
 
                var registry = get_registry ();
-               var source = registry.lookup_source ("grl-thegamesdb");
+               var source = registry.lookup_source (SOURCE_NAME);
                if (source == null)
                        return;
 


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