[iagno] Fix padding on small windows.



commit 08d4a2e169c325814f419ea44749d6518086fe9f
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sun Aug 4 10:33:34 2019 +0200

    Fix padding on small windows.

 data/iagno.css       | 10 +++++-----
 data/ui/base-view.ui |  3 ---
 src/game-view.vala   | 13 ++++++++++---
 3 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/data/iagno.css b/data/iagno.css
index 1063069..4e8223c 100644
--- a/data/iagno.css
+++ b/data/iagno.css
@@ -35,11 +35,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 771847f..bfc1cac 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 7c8ea94..4dbd6c3 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,7 +70,13 @@ private class GameView : BaseView, AdaptativeWidget
         }
 
         game_content = content;
-        game_stack.add (content);
+
+        game_box = new Box (Orientation.HORIZONTAL, 0);
+        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 ();
     }
@@ -84,7 +91,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 +101,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]