[gnome-taquin] Delay when changing settings.



commit 1b89441ca1a74f84551255efc96ad902f06b7814
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Feb 7 20:42:11 2019 +0100

    Delay when changing settings.

 src/game-window.vala |  2 ++
 src/taquin-main.vala | 17 +++++++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/game-window.vala b/src/game-window.vala
index 16bc2cc..adf77eb 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -118,9 +118,11 @@ private class GameWindow : BaseWindow, AdaptativeWidget
 
     internal void shutdown (GLib.Settings settings)
     {
+        settings.delay ();
         settings.set_int ("window-width", window_width);
         settings.set_int ("window-height", window_height);
         settings.set_boolean ("window-is-maximized", maximized_state);
+        settings.apply ();
         destroy ();
     }
 
diff --git a/src/taquin-main.vala b/src/taquin-main.vala
index 7c09a28..3579219 100644
--- a/src/taquin-main.vala
+++ b/src/taquin-main.vala
@@ -130,12 +130,17 @@ private class Taquin : Gtk.Application, BaseApplication
         base.startup ();
 
         settings = new GLib.Settings ("org.gnome.Taquin");
-        if (sound != null)
-            settings.set_boolean ("sound", (!) sound);
-        if (tmp_size > 1)
-            settings.set_int ("size", tmp_size);
-        if (tmp_type != null)
-            settings.set_string ("type", ((!) tmp_type).to_string ());     // TODO better?
+        if ((sound != null) || (tmp_size > 1) || (tmp_type != null))
+        {
+            settings.delay ();
+            if (sound != null)
+                settings.set_boolean ("sound", (!) sound);
+            if (tmp_size > 1)
+                settings.set_int ("size", tmp_size);
+            if (tmp_type != null)
+                settings.set_string ("type", ((!) tmp_type).to_string ());     // TODO better?
+            settings.apply ();
+        }
 
         /* UI parts */
         view = new TaquinView ();


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