[swell-foop/arnaudb/wip/gtk4] Fix saving.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [swell-foop/arnaudb/wip/gtk4] Fix saving.
- Date: Mon, 26 Oct 2020 15:42:43 +0000 (UTC)
commit 6303969262422e52d7987c3dd02ad8dfddf60040
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Mon Oct 26 16:42:27 2020 +0100
Fix saving.
src/swell-foop.vala | 10 ++++++++++
src/window.vala | 8 ++++----
2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/swell-foop.vala b/src/swell-foop.vala
index b5ffa5c..cff768c 100644
--- a/src/swell-foop.vala
+++ b/src/swell-foop.vala
@@ -82,6 +82,16 @@ public class SwellFoop : Gtk.Application
window.present ();
}
+ protected override void shutdown ()
+ {
+ window.destroy ();
+ base.shutdown ();
+ }
+
+ /*\
+ * * actions
+ \*/
+
private inline void help_cb (/* SimpleAction action, Variant? variant */)
{
Gtk.show_uri (window, "help:swell-foop", Gdk.CURRENT_TIME);
diff --git a/src/window.vala b/src/window.vala
index 256ea63..75001fc 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -79,6 +79,8 @@ private class SwellFoopWindow : ApplicationWindow
construct
{
+ unmap.connect (on_unmap);
+
CssProvider css_provider = new CssProvider ();
css_provider.load_from_resource ("/org/gnome/SwellFoop/ui/swell-foop.css");
Gdk.Display? gdk_display = Gdk.Display.get_default ();
@@ -96,8 +98,6 @@ private class SwellFoopWindow : ApplicationWindow
settings.changed ["theme"].connect (load_theme);
load_theme (settings, "theme");
- close_request.connect (on_close_request);
-
int32 colors = settings.get_int ("colors"); // 2 <= colors <= 4, per schema file
SimpleAction colors_action = (SimpleAction) lookup_action ("change-colors");
colors_action.set_state (new Variant.@string (colors.to_string ()));
@@ -230,7 +230,7 @@ private class SwellFoopWindow : ApplicationWindow
game.bind_property ("can-redo", redo_action, "enabled", BindingFlags.SYNC_CREATE);
}
- private inline bool on_close_request ()
+ private inline void on_unmap ()
{
settings.delay ();
settings.set_value ("saved-game", game.get_saved_game ());
@@ -243,7 +243,7 @@ private class SwellFoopWindow : ApplicationWindow
}
settings.apply ();
- return /* do not stop other handlers */ false;
+ application.quit ();
}
/*\
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]