[gnome-taquin] Fix padding on small windows.



commit c862d9afdea8182d02399d827555e4dd99124530
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sun Aug 4 11:05:31 2019 +0200

    Fix padding on small windows.

 data/taquin.css      | 10 +++++-----
 data/ui/base-view.ui |  3 ---
 src/game-view.vala   | 17 +++++++++++++----
 3 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/data/taquin.css b/data/taquin.css
index b5f6ec7..1a292c3 100644
--- a/data/taquin.css
+++ b/data/taquin.css
@@ -28,11 +28,11 @@ button.unfullscreen-button {
 * * new-game screen generics
 \*/
 
-                               .main-grid               { transition:padding 0.3s; padding:1.5rem; }
-                  .thin-window .main-grid               {                          padding:1.0rem; }
-.extra-thin-window.thin-window .main-grid,
-                  .flat-window .main-grid               {                          padding:0.5rem; }
-.extra-flat-window.flat-window .main-grid               {                          padding:0.4rem; }
+                               .game-box                { transition:padding 0.3s; padding:1.5rem; }
+                  .thin-window .game-box                {                          padding:1.0rem; }
+.extra-thin-window.thin-window .game-box,
+                  .flat-window .game-box                {                          padding:0.5rem; }
+.extra-flat-window.flat-window .game-box                {                          padding:0.4rem; }
 
                                button.start-game-button { margin-top:1.5rem; margin-bottom:0.5rem;
                                                transition:margin-top 0 ease, margin-bottom 0 ease; }
diff --git a/data/ui/base-view.ui b/data/ui/base-view.ui
index bb0495e..850cf9b 100644
--- a/data/ui/base-view.ui
+++ b/data/ui/base-view.ui
@@ -27,9 +27,6 @@
           <object class="GtkGrid" id="main_grid">
             <property name="visible">True</property>
             <property name="orientation">vertical</property>
-            <style>
-              <class name="main-grid"/>
-            </style>
           </object>
         </child>
       </object>
diff --git a/src/game-view.vala b/src/game-view.vala
index 1111d18..58ee84e 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -23,6 +23,7 @@ using Gtk;
 private class GameView : BaseView, AdaptativeWidget
 {
     private Stack           game_stack;
+    private Box             game_box;
     private Widget          game_content;
     private ScrolledWindow  scrolled;
     private Box             new_game_box;
@@ -69,9 +70,17 @@ private class GameView : BaseView, AdaptativeWidget
         }
 
         game_content = content;
-        game_stack.add (content);
+
+        game_box = new Box (Orientation.HORIZONTAL, 0);
+        game_content.hexpand = true;
+        game_content.vexpand = true;
+        game_content.show ();
+        game_box.add (game_content);
+        game_box.show ();
+        game_box.get_style_context ().add_class ("game-box");
+
+        game_stack.add (game_box);
         content.can_focus = true;
-        content.show ();
     }
 
     internal void show_new_game_box (bool grab_focus)
@@ -84,7 +93,7 @@ private class GameView : BaseView, AdaptativeWidget
 
     internal void show_game_content (bool grab_focus)
     {
-        game_stack.set_visible_child (game_content);
+        game_stack.set_visible_child (game_box);
         if (grab_focus)
             game_content.grab_focus ();
     }
@@ -94,7 +103,7 @@ private class GameView : BaseView, AdaptativeWidget
         Widget? visible_child = game_stack.get_visible_child ();
         if (visible_child == null)
             assert_not_reached ();
-        return (!) visible_child == game_content;
+        return (!) visible_child == game_box;
     }
 
     internal void configure_transition (StackTransitionType transition_type,


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