[gnome-mahjongg/arnaudb/wip/gtk4: 29/29] Improve state and size handling.




commit debb8f0cea74707bd39b2a674ca0d8eeaa81f936
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Oct 9 17:33:15 2020 +0200

    Improve state and size handling.
    
    See also gtk#3226.

 src/gnome-mahjongg.vala | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/gnome-mahjongg.vala b/src/gnome-mahjongg.vala
index f791111..f16238f 100644
--- a/src/gnome-mahjongg.vala
+++ b/src/gnome-mahjongg.vala
@@ -86,6 +86,7 @@ public class Mahjongg : Gtk.Application
 
         window = new ApplicationWindow (this);
         window.map.connect (init_state_watcher);
+        window.unmap.connect (on_unmap);
         window.set_default_size (settings.get_int ("window-width"), settings.get_int ("window-height"));
         if (settings.get_boolean ("window-is-maximized"))
             window.maximize ();
@@ -223,16 +224,22 @@ public class Mahjongg : Gtk.Application
         is_tiled =      (state & tiled_state)                 != 0;
     }
 
-    protected override void shutdown ()
+    private inline void on_unmap ()
     {
-        base.shutdown ();
-
         /* Save window state */
         settings.delay ();
         settings.set_int ("window-width", window_width);
         settings.set_int ("window-height", window_height);
         settings.set_boolean ("window-is-maximized", is_maximized);
         settings.apply ();
+
+        quit ();
+    }
+
+    protected override void shutdown ()
+    {
+        window.destroy ();
+        base.shutdown ();
     }
 
     protected override int handle_local_options (GLib.VariantDict options)


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