[gnome-taquin] Bump Gtk required version.



commit e9742d1b363f5792382772d28b9b717857532ced
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Feb 15 11:49:58 2019 +0100

    Bump Gtk required version.
    
    Gdk.WindowState.TILED is deprecated.
    And remove related duplicated stuff.

 meson.build                |  2 +-
 src/adaptative-window.vala | 10 ++++++++--
 src/game-window.vala       | 46 +---------------------------------------------
 src/taquin-main.vala       |  5 +----
 4 files changed, 11 insertions(+), 52 deletions(-)
---
diff --git a/meson.build b/meson.build
index 2f9edc6..cf20d68 100644
--- a/meson.build
+++ b/meson.build
@@ -9,7 +9,7 @@ python3 = import('python3')
 
 gio_dependency = dependency('gio-2.0', version: '>= 2.40.0')
 glib_dependency = dependency('glib-2.0', version: '>= 2.40.0')
-gtk_dependency = dependency('gtk+-3.0', version: '>= 3.20.0')
+gtk_dependency = dependency('gtk+-3.0', version: '>= 3.22.23')
 rsvg_dependency = dependency('librsvg-2.0', version: '>= 2.32.0')
 canberra_dependency = dependency('libcanberra')
 canberra_gtk3_dependency = dependency('libcanberra-gtk3', version: '>= 0.26')
diff --git a/src/adaptative-window.vala b/src/adaptative-window.vala
index 2be94d6..27574ef 100644
--- a/src/adaptative-window.vala
+++ b/src/adaptative-window.vala
@@ -227,9 +227,15 @@ private abstract class AdaptativeWindow : ApplicationWindow
     {
         if ((event.changed_mask & Gdk.WindowState.MAXIMIZED) != 0)
             window_is_maximized = (event.new_window_state & Gdk.WindowState.MAXIMIZED) != 0;
+
         /* We don’t save this state, but track it for saving size allocation */
-        if ((event.changed_mask & Gdk.WindowState.TILED) != 0)
-            window_is_tiled = (event.new_window_state & Gdk.WindowState.TILED) != 0;
+        Gdk.WindowState tiled_state = Gdk.WindowState.TILED
+                                    | Gdk.WindowState.TOP_TILED
+                                    | Gdk.WindowState.BOTTOM_TILED
+                                    | Gdk.WindowState.LEFT_TILED
+                                    | Gdk.WindowState.RIGHT_TILED;
+        if ((event.changed_mask & tiled_state) != 0)
+            window_is_tiled = (event.new_window_state & tiled_state) != 0;
 
         return false;
     }
diff --git a/src/game-window.vala b/src/game-window.vala
index adf77eb..88aff99 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -30,12 +30,6 @@ public enum GameWindowFlags {
 
 private class GameWindow : BaseWindow, AdaptativeWidget
 {
-    /* settings */
-    private bool tiled_state;
-    private bool maximized_state;
-    private int window_width;
-    private int window_height;
-
     private bool game_finished = false;
 
     /* private widgets */
@@ -43,7 +37,7 @@ private class GameWindow : BaseWindow, AdaptativeWidget
     private GameView        game_view;
     private Box             new_game_screen;
 
-    public GameWindow (string? css_resource, string name, int width, int height, bool maximized, bool 
start_now, GameWindowFlags flags, Box _new_game_screen, Widget view_content, NightLightMonitor 
night_light_monitor)
+    public GameWindow (string? css_resource, string name, bool start_now, GameWindowFlags flags, Box 
_new_game_screen, Widget view_content, NightLightMonitor night_light_monitor)
     {
         GameHeaderBar _headerbar = new GameHeaderBar (name, flags, night_light_monitor);
         GameView      _game_view = new GameView (flags, _new_game_screen, view_content);
@@ -73,13 +67,6 @@ private class GameWindow : BaseWindow, AdaptativeWidget
         /* window config */
         set_title (name);
 
-        set_default_size (width, height);
-        if (maximized)
-            maximize ();
-
-        size_allocate.connect (size_allocate_cb);
-        window_state_event.connect (window_state_event_cb);
-
         /* start or not */
         if (start_now)
             show_view ();
@@ -95,37 +82,6 @@ private class GameWindow : BaseWindow, AdaptativeWidget
         ((AdaptativeWidget) game_view).set_window_size (new_size);
     }
 
-    /*\
-    * * Window events
-    \*/
-
-    private void size_allocate_cb ()
-    {
-        if (maximized_state || tiled_state)
-            return;
-        get_size (out window_width, out window_height);
-    }
-
-    private bool window_state_event_cb (Gdk.EventWindowState event)
-    {
-        if ((event.changed_mask & Gdk.WindowState.MAXIMIZED) != 0)
-            maximized_state = (event.new_window_state & Gdk.WindowState.MAXIMIZED) != 0;
-        /* We don’t save this state, but track it for saving size allocation */
-        if ((event.changed_mask & Gdk.WindowState.TILED) != 0)
-            tiled_state = (event.new_window_state & Gdk.WindowState.TILED) != 0;
-        return false;
-    }
-
-    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 ();
-    }
-
     /*\
     * * Some public calls
     \*/
diff --git a/src/taquin-main.vala b/src/taquin-main.vala
index 3579219..7d17069 100644
--- a/src/taquin-main.vala
+++ b/src/taquin-main.vala
@@ -150,9 +150,6 @@ private class Taquin : Gtk.Application, BaseApplication
         init_night_mode ();
         window = new GameWindow ("/org/gnome/Taquin/ui/taquin.css",
                                  PROGRAM_NAME,
-                                 settings.get_int ("window-width"),
-                                 settings.get_int ("window-height"),
-                                 settings.get_boolean ("window-is-maximized"),
                                  true,     // TODO add an option to go to new-game screen?
                                  GameWindowFlags.SHOW_UNDO | GameWindowFlags.SHOW_START_BUTTON,
                                  (Box) new_game_screen,
@@ -216,7 +213,7 @@ private class Taquin : Gtk.Application, BaseApplication
 
     protected override void shutdown ()
     {
-        window.shutdown (settings);
+        window.destroy ();
         base.shutdown ();
     }
 


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