[gnome-taquin] Handle view margins in CSS.



commit a2c20560f172d18e4d459ca89c7d679736af9801
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Jan 24 10:49:46 2019 +0100

    Handle view margins in CSS.

 data/base-view.ui      |  3 +++
 data/taquin-screens.ui |  3 ---
 data/taquin.css        | 11 +++++++++--
 src/game-view.vala     | 21 ---------------------
 4 files changed, 12 insertions(+), 26 deletions(-)
---
diff --git a/data/base-view.ui b/data/base-view.ui
index 850cf9b..bb0495e 100644
--- a/data/base-view.ui
+++ b/data/base-view.ui
@@ -27,6 +27,9 @@
           <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/data/taquin-screens.ui b/data/taquin-screens.ui
index 7bc139c..459e14a 100644
--- a/data/taquin-screens.ui
+++ b/data/taquin-screens.ui
@@ -59,9 +59,6 @@
     <property name="orientation">vertical</property>
     <property name="visible">True</property>
     <property name="spacing">6</property>
-    <style>
-      <class name="new-game-screen"/>
-    </style>
     <child>
       <object class="GtkLabel" id="games_label">
         <property name="visible">False</property>
diff --git a/data/taquin.css b/data/taquin.css
index 6e5c62e..79970c6 100644
--- a/data/taquin.css
+++ b/data/taquin.css
@@ -18,12 +18,19 @@
 @import url("base-window.css");
 
 
+/*\
+* * new-hame 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; }
 
-                               .new-game-screen         {                          padding:0.5rem; }  /* for 
top    */
                                button.start-game-button { margin-top:1.5rem; margin-bottom:0.5rem;
                                                transition:margin-top 0 ease, margin-bottom 0 ease; }
                   .flat-window button.start-game-button { margin-top:0.5rem;                       }
-.extra-flat-window.flat-window .new-game-screen         {                          padding:0.4rem; }
 .extra-flat-window.flat-window button.start-game-button { margin-top:  0rem; margin-bottom:0.4rem; }
 
 .extra-thin-window             label.section-header,
diff --git a/src/game-view.vala b/src/game-view.vala
index 7e4cdb7..391bc8e 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -67,31 +67,10 @@ private class GameView : BaseView, AdaptativeWidget
 
         game_content = content;
         game_stack.add (content);
-        update_game_content_margin (short_margin, ref game_content);
         content.can_focus = true;
         content.show ();
     }
 
-    private bool short_margin = false;
-    protected override void set_window_size (AdaptativeWidget.WindowSize new_size)
-    {
-        base.set_window_size (new_size);
-
-        bool _short_margin = AdaptativeWidget.WindowSize.is_extra_thin (new_size)
-                          || AdaptativeWidget.WindowSize.is_extra_flat (new_size);
-        if (_short_margin == short_margin)
-            return;
-        short_margin = _short_margin;
-        update_game_content_margin (short_margin, ref game_content);
-    }
-    private static void update_game_content_margin (bool new_state, ref Widget game_content)
-    {
-        if (new_state)
-            game_content.margin = 11;
-        else
-            game_content.margin = 25;
-    }
-
     internal void show_new_game_box (bool grab_focus)
     {
         game_stack.set_visible_child (scrolled);


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