[gnome-games/wip/exalm/rebrand: 119/124] retro-options: Merge into Runner
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/rebrand: 119/124] retro-options: Merge into Runner
- Date: Sat, 19 Jun 2021 14:37:47 +0000 (UTC)
commit 44ec84bf9dd0e617d653d7a7874d9bea46b52ca8
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Wed Mar 31 01:14:09 2021 +0500
retro-options: Merge into Runner
src/core/runner/runner.vala | 16 ++++++++++++++--
src/meson.build | 1 -
src/retro/retro-options.vala | 22 ----------------------
3 files changed, 14 insertions(+), 25 deletions(-)
---
diff --git a/src/core/runner/runner.vala b/src/core/runner/runner.vala
index 7e5dbf6c..b0a34c94 100644
--- a/src/core/runner/runner.vala
+++ b/src/core/runner/runner.vala
@@ -136,6 +136,19 @@ public class Games.Runner : Object {
return @"$(Config.OPTIONS_DIR)/$options_name.options";
}
+ public void override_options (Retro.Core core, string filename) throws Error {
+ var keyfile = new KeyFile ();
+ keyfile.load_from_file (filename, KeyFileFlags.NONE);
+
+ var options_keys = keyfile.get_keys ("Options");
+
+ foreach (var key in options_keys) {
+ var val = keyfile.get_string ("Options", key);
+
+ core.override_option_default (key, val);
+ }
+ }
+
private void prepare_core () throws Error {
var module_path = core_source.get_module_path ();
@@ -144,8 +157,7 @@ public class Games.Runner : Object {
var options_path = get_options_path ();
if (FileUtils.test (options_path, FileTest.EXISTS))
try {
- var options = new RetroOptions (options_path);
- options.apply (core);
+ override_options (core, options_path);
} catch (Error e) {
critical (e.message);
}
diff --git a/src/meson.build b/src/meson.build
index 437e387a..8dd867bc 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -144,7 +144,6 @@ vala_sources = [
'preferences/preferences-window.vala',
'retro/retro-error.vala',
- 'retro/retro-options.vala',
'screen-layout/screen-layout.vala',
'screen-layout/screen-layout-item.vala',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]