[gnome-games/wip/exalm/platform-preferences: 27/30] c



commit 12dd80ac7737b50871cbc0da439da1c098fbe229
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 9f2f01df..43d2929d 100644
--- a/src/ui/preferences-page-retro-platform.vala
+++ b/src/ui/preferences-page-retro-platform.vala
@@ -19,15 +19,6 @@ private class Games.PreferencesPageRetroPlatform: 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 ();
@@ -43,28 +34,12 @@ private class Games.PreferencesPageRetroPlatform: 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);
                }
        }
 
@@ -78,11 +53,6 @@ private class Games.PreferencesPageRetroPlatform: 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]