[gnome-games] retro-runner: Add should_save
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] retro-runner: Add should_save
- Date: Fri, 25 Mar 2016 12:53:01 +0000 (UTC)
commit 889f035d0737be5d9c5847f2f3a6de7ea83b5805
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sun Mar 6 19:25:03 2016 +0100
retro-runner: Add should_save
This avoids useless saves and it will be used to know if we can safely
quit the game.
src/retro/retro-runner.vala | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index fcbb414..ee9f559 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -42,6 +42,9 @@ public class Games.RetroRunner : Object, Runner {
set {
_running = value;
+ if (running)
+ should_save = true;
+
video.sensitive = running;
}
get { return _running; }
@@ -49,6 +52,7 @@ public class Games.RetroRunner : Object, Runner {
private bool is_initialized;
private bool is_ready;
+ private bool should_save;
public RetroRunner (string module_basename, string uri, Uid uid) {
is_initialized = false;
@@ -224,9 +228,14 @@ public class Games.RetroRunner : Object, Runner {
}
private void save () throws Error {
+ if (!should_save)
+ return;
+
save_ram ();
save_snapshot ();
save_screenshot ();
+
+ should_save = false;
}
private string get_save_path () throws Error {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]