[gnome-games/wip/exalm/rebrand: 42/124] runner: Use GObject-style construction
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/rebrand: 42/124] runner: Use GObject-style construction
- Date: Sat, 19 Jun 2021 14:37:44 +0000 (UTC)
commit c15aee8191d226cc87b569e5cfded78e6299253a
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Mon Mar 29 21:39:04 2021 +0500
runner: Use GObject-style construction
plugins/game-cube/src/game-cube-runner.vala | 1 -
src/core/runner.vala | 27 +++++++++++----------------
2 files changed, 11 insertions(+), 17 deletions(-)
---
diff --git a/plugins/game-cube/src/game-cube-runner.vala b/plugins/game-cube/src/game-cube-runner.vala
index fddb667a..5fead278 100644
--- a/plugins/game-cube/src/game-cube-runner.vala
+++ b/plugins/game-cube/src/game-cube-runner.vala
@@ -16,7 +16,6 @@ private class Games.GameCubeRunner : Runner {
}
private string get_game_id () {
- var game = get_game ();
var prefix = game.platform.get_uid_prefix ();
var uid = game.uid.to_string ();
diff --git a/src/core/runner.vala b/src/core/runner.vala
index 3d4389dd..6179e182 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);
+ }
- core_source = source;
+ construct {
+ settings = new Settings ("org.gnome.Games");
+ view = new Retro.CoreView ();
+
+ 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);
@@ -480,10 +479,6 @@ public class Games.Runner : Object {
return core;
}
- public Game get_game () {
- return game;
- }
-
private void save_screenshot (string path) throws Error {
var pixbuf = current_state_pixbuf;
if (pixbuf == null)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]