[gnome-games/wip/exalm/rebrand: 25/102] runner: Use GObject-style construction




commit 5f483ca2c92f896b502d4b60659a1d166133b364
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon Mar 29 21:39:04 2021 +0500

    runner: Use GObject-style construction

 src/core/runner.vala | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/src/core/runner.vala b/src/core/runner.vala
index a1b2374f..658ac185 100644
--- a/src/core/runner.vala
+++ b/src/core/runner.vala
@@ -6,6 +6,9 @@ public class Games.Runner : Object {
        public signal void crash (string message);
        public signal void controllers_changed ();
 
+       public Game game { get; construct; }
+       public RetroCoreSource core_source { get; construct; }
+
        public bool can_fullscreen {
                get { return true; }
        }
@@ -42,9 +45,7 @@ public class Games.Runner : Object {
                }
        }
 
-       private RetroCoreSource core_source;
        private Settings settings;
-       private Game game;
        private SnapshotManager snapshot_manager;
 
        private Snapshot previewed_snapshot;
@@ -67,9 +68,15 @@ public class Games.Runner : Object {
        private bool is_error;
 
        public Runner (Game game, RetroCoreSource source) {
-               this.game = game;
+               Object (game: game, core_source: source);
+       }
+
+       construct {
+               settings = new Settings ("org.gnome.Games");
+               view = new Retro.CoreView ();
 
-               core_source = source;
+               settings.changed["video-filter"].connect (on_video_filter_changed);
+               on_video_filter_changed ();
 
                _media_set = game.media_set;
                if (media_set == null && game.uri != null) {
@@ -83,14 +90,6 @@ public class Games.Runner : Object {
                _media_set.notify["selected-media-number"].connect (on_media_number_changed);
        }
 
-       construct {
-               settings = new Settings ("org.gnome.Games");
-               view = new Retro.CoreView ();
-
-               settings.changed["video-filter"].connect (on_video_filter_changed);
-               on_video_filter_changed ();
-       }
-
        private void on_video_filter_changed () {
                var filter_name = settings.get_string ("video-filter");
                var filter = Retro.VideoFilter.from_string (filter_name);


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