[gnome-games/wip/exalm/platform-preferences: 86/95] ui: Add PreferencesPageRetroPlatform
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/platform-preferences: 86/95] ui: Add PreferencesPageRetroPlatform
- Date: Sun, 21 Oct 2018 15:08:36 +0000 (UTC)
commit fc372f0d7d348272a9ba26d26b7974a431b6f64e
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Tue Sep 25 23:08:16 2018 +0500
ui: Add PreferencesPageRetroPlatform
data/org.gnome.Games.gresource.xml | 1 +
data/ui/preferences-page-retro-platform.ui | 19 ++++++++++
po/POTFILES.in | 1 +
src/meson.build | 1 +
src/ui/preferences-page-retro-platform.vala | 56 +++++++++++++++++++++++++++++
5 files changed, 78 insertions(+)
---
diff --git a/data/org.gnome.Games.gresource.xml b/data/org.gnome.Games.gresource.xml
index 4842845b..598c6cd6 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -37,6 +37,7 @@
<file preprocess="xml-stripblanks">ui/preferences-page-dummy-platform.ui</file>
<file preprocess="xml-stripblanks">ui/preferences-page-plugins.ui</file>
<file preprocess="xml-stripblanks">ui/preferences-page-plugins-item.ui</file>
+ <file preprocess="xml-stripblanks">ui/preferences-page-retro-platform.ui</file>
<file preprocess="xml-stripblanks">ui/preferences-page-video.ui</file>
<file preprocess="xml-stripblanks">ui/preferences-sidebar.ui</file>
<file preprocess="xml-stripblanks">ui/preferences-sidebar-item.ui</file>
diff --git a/data/ui/preferences-page-retro-platform.ui b/data/ui/preferences-page-retro-platform.ui
new file mode 100644
index 00000000..83841200
--- /dev/null
+++ b/data/ui/preferences-page-retro-platform.ui
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.16 -->
+ <template class="GamesPreferencesPageRetroPlatform" parent="GamesPreferencesPage">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkFrame">
+ <property name="visible">true</property>
+ <property name="shadow-type">in</property>
+ <child>
+ <object class="GtkListBox" id="core_list_box">
+ <property name="selection-mode">none</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a942556e..d503b93a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -14,6 +14,7 @@ data/ui/media-menu-button.ui
data/ui/preferences-page-controllers.ui
data/ui/preferences-page-dummy-platform.ui
data/ui/preferences-page-plugins.ui
+data/ui/preferences-page-retro-platform.ui
data/ui/preferences-page-video.ui
data/ui/preferences-subpage-gamepad.ui
data/ui/preferences-subpage-keyboard.ui
diff --git a/src/meson.build b/src/meson.build
index a1068056..f711640b 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -162,6 +162,7 @@ vala_sources = [
'ui/preferences-page-dummy-platform.vala',
'ui/preferences-page-plugins.vala',
'ui/preferences-page-plugins-item.vala',
+ 'ui/preferences-page-retro-platform.vala',
'ui/preferences-page-video.vala',
'ui/preferences-sidebar.vala',
'ui/preferences-sidebar-item.vala',
diff --git a/src/ui/preferences-page-retro-platform.vala b/src/ui/preferences-page-retro-platform.vala
new file mode 100644
index 00000000..a8eefa58
--- /dev/null
+++ b/src/ui/preferences-page-retro-platform.vala
@@ -0,0 +1,56 @@
+// This file is part of GNOME Games. License: GPL-3.0+.
+
+[GtkTemplate (ui = "/org/gnome/Games/ui/preferences-page-retro-platform.ui")]
+private class Games.PreferencesPageRetroPlatform: PreferencesPage {
+ public RetroPlatform platform { get; construct set; }
+
+ [GtkChild]
+ private Gtk.ListBox core_list_box;
+
+ public PreferencesPageRetroPlatform (RetroPlatform platform) {
+ this.platform = platform;
+ title = platform.get_name ();
+ category = PreferencesPageCategory.PLATFORMS;
+
+ build_core_list ();
+ }
+
+ private void build_core_list () {
+ var modules = new Retro.ModuleQuery (true);
+ foreach (var core_descriptor in modules) {
+ 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;
+
+ 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);
+ }
+ }
+ }
+
+ private void add_core_descriptor (Retro.CoreDescriptor core_descriptor) throws Error {
+ var name = core_descriptor.get_name ();
+
+ var item = new CheckmarkItem (name);
+ var row = new Gtk.ListBoxRow ();
+ row.add (item);
+ core_list_box.add (row);
+
+ item.show ();
+ row.show ();
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]