[gnome-games] runner: Add delete_savestate()
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] runner: Add delete_savestate()
- Date: Fri, 9 Aug 2019 13:39:59 +0000 (UTC)
commit 7028d9b839291172031f5abb351c137196021c37
Author: Yetizone <andreii lisita gmail com>
Date: Thu Aug 8 16:51:39 2019 +0300
runner: Add delete_savestate()
src/command/command-runner.vala | 3 +++
src/core/runner.vala | 1 +
src/dummy/dummy-runner.vala | 3 +++
src/retro/retro-runner.vala | 12 ++++++++++++
4 files changed, 19 insertions(+)
---
diff --git a/src/command/command-runner.vala b/src/command/command-runner.vala
index 6d5d1b94..13bd524d 100644
--- a/src/command/command-runner.vala
+++ b/src/command/command-runner.vala
@@ -106,6 +106,9 @@ public class Games.CommandRunner : Object, Runner {
return false;
}
+ public void delete_savestate (Savestate savestate) {
+ }
+
public InputMode[] get_available_input_modes () {
return { };
}
diff --git a/src/core/runner.vala b/src/core/runner.vala
index 3dd47682..bd58210a 100644
--- a/src/core/runner.vala
+++ b/src/core/runner.vala
@@ -24,6 +24,7 @@ public interface Games.Runner : Object {
public abstract void preview_savestate (Savestate savestate);
public abstract bool try_create_savestate (bool is_automatic);
+ public abstract void delete_savestate (Savestate savestate);
public abstract void load_previewed_savestate () throws Error;
public abstract Savestate[] get_savestates ();
diff --git a/src/dummy/dummy-runner.vala b/src/dummy/dummy-runner.vala
index a3db95c3..86ae78b5 100644
--- a/src/dummy/dummy-runner.vala
+++ b/src/dummy/dummy-runner.vala
@@ -72,6 +72,9 @@ private class Games.DummyRunner : Object, Runner {
return false;
}
+ public void delete_savestate (Savestate savestate) {
+ }
+
public InputMode[] get_available_input_modes () {
return { };
}
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index 457298ca..803dc165 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -490,6 +490,18 @@ public class Games.RetroRunner : Object, Runner {
// FIXME: The game_savestates array should be updated somehow here
}
+ public void delete_savestate (Savestate savestate) {
+ Savestate[] new_game_savestates = {};
+
+ foreach (var existing_savestate in game_savestates) {
+ if (savestate != existing_savestate)
+ new_game_savestates += existing_savestate;
+ }
+
+ game_savestates = new_game_savestates;
+ savestate.delete_from_disk ();
+ }
+
private string get_options_path () throws Error {
assert (core != null);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]