[gnome-games/wip/exalm/platform-preferences] c



commit 850af1e674a8a677f11783431a15281920067931
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Thu Sep 27 21:59:20 2018 +0500

    c

 src/ui/preferences-page-retro-platform.vala | 40 ++++-------------------------
 1 file changed, 5 insertions(+), 35 deletions(-)
---
diff --git a/src/ui/preferences-page-retro-platform.vala b/src/ui/preferences-page-retro-platform.vala
index 283d7854..d2d2d857 100644
--- a/src/ui/preferences-page-retro-platform.vala
+++ b/src/ui/preferences-page-retro-platform.vala
@@ -30,15 +30,6 @@ private class Games.PreferencesPageRetroPlatform: Gtk.Bin, PreferencesPage {
                }
        }
 
-       private Retro.CoreDescriptor[] core_descriptors;
-
-       construct {
-               var query = new Retro.ModuleQuery (true);
-               core_descriptors = {};
-               foreach (var core_descriptor in query)
-                       core_descriptors += core_descriptor;
-       }
-
        public PreferencesPageRetroPlatform (RetroPlatform platform) {
                this.platform = platform;
                _title = platform.get_name ();
@@ -53,28 +44,12 @@ private class Games.PreferencesPageRetroPlatform: Gtk.Bin, PreferencesPage {
        }
 
        private void build_core_list () {
-               foreach (var core_descriptor in core_descriptors) {
-                       try {
-                               var platform_id = platform.get_id ();
-                               var mime_types = platform.get_mime_types ();
-
-                               if (!core_descriptor.get_is_emulator ())
-                                       continue;
-
-                               if (!core_descriptor.has_platform (platform_id))
-                                       continue;
+               var core_manager = new RetroCoreManager ();
+               var core_descriptors = core_manager.get_cores_for_platform (platform);
 
-                               if (!core_descriptor.get_platform_supports_mime_types (platform_id, 
mime_types))
-                                       continue;
-
-                               if (core_descriptor.get_module_file () == null)
-                                       continue;
-
-                               add_core_descriptor (core_descriptor);
-                       }
-                       catch (Error e) {
-                               debug (e.message);
-                       }
+               foreach (var core_descriptor in core_descriptors) {
+                       var item = new CoreItem (core_descriptor);
+                       core_list_box.add (item);
                }
        }
 
@@ -88,11 +63,6 @@ private class Games.PreferencesPageRetroPlatform: Gtk.Bin, PreferencesPage {
                });
        }
 
-       private void add_core_descriptor (Retro.CoreDescriptor core_descriptor) {
-               var item = new CoreItem (core_descriptor);
-               core_list_box.add (item);
-       }
-
        [GtkCallback]
        private void core_list_box_row_activated (Gtk.ListBoxRow row_item) {
                var core_item = row_item as CoreItem;


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