[gnome-sudoku] controls_box: homogeneous layout



commit 03a2e1009dce4f38b6cdc0d5caeb27fa541c48cf
Author: lajonss <l3n1 dupaw eu>
Date:   Tue Nov 24 08:40:53 2020 +0100

    controls_box: homogeneous layout

 data/gnome-sudoku.ui  | 25 +++++++++++--------------
 src/gnome-sudoku.vala | 14 ++++++++------
 2 files changed, 19 insertions(+), 20 deletions(-)
---
diff --git a/data/gnome-sudoku.ui b/data/gnome-sudoku.ui
index 348ced24..e5b623c5 100644
--- a/data/gnome-sudoku.ui
+++ b/data/gnome-sudoku.ui
@@ -320,6 +320,7 @@
                         <property name="can-focus">False</property>
                         <property name="orientation">vertical</property>
                         <property name="spacing">6</property>
+                        <property name="homogeneous">True</property>
                         <child>
                           <object class="GtkButton" id="play_pause_button">
                             <property name="visible">True</property>
@@ -327,8 +328,8 @@
                             <property name="receives-default">True</property>
                             <property name="action-name">app.pause</property>
                             <property name="use-underline">True</property>
-                            <property name="width-request">120</property>
-                            <property name="height-request">60</property>
+                            <property name="valign">fill</property>
+                            <property name="halign">fill</property>
                             <child>
                               <object class="GtkLabel" id="play_pause_label">
                                 <property name="visible">True</property>
@@ -340,8 +341,7 @@
                             </child>
                           </object>
                           <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
+                            <property name="expand">True</property>
                             <property name="pack-type">end</property>
                             <property name="position">0</property>
                           </packing>
@@ -355,12 +355,11 @@
                             <property name="valign">center</property>
                             <property name="action-name">app.reset</property>
                             <property name="tooltip-text" translatable="yes">Reset the board to its original 
state</property>
-                            <property name="width-request">120</property>
-                            <property name="height-request">60</property>
+                            <property name="valign">fill</property>
+                            <property name="halign">fill</property>
                           </object>
                           <packing>
                             <property name="expand">True</property>
-                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
@@ -373,12 +372,11 @@
                             <property name="valign">center</property>
                             <property name="action-name">app.new-game</property>
                             <property name="tooltip-text" translatable="yes">Start a new puzzle</property>
-                            <property name="width-request">120</property>
-                            <property name="height-request">60</property>
+                            <property name="valign">fill</property>
+                            <property name="halign">fill</property>
                           </object>
                           <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
+                            <property name="expand">True</property>
                             <property name="position">2</property>
                           </packing>
                         </child>
@@ -391,12 +389,11 @@
                             <property name="valign">center</property>
                             <property name="action-name">app.play-custom-game</property>
                             <property name="tooltip-text" translatable="yes">Start playing the custom puzzle 
you have created</property>
-                            <property name="width-request">120</property>
-                            <property name="height-request">60</property>
+                            <property name="valign">fill</property>
+                            <property name="halign">fill</property>
                           </object>
                           <packing>
                             <property name="expand">True</property>
-                            <property name="fill">True</property>
                             <property name="position">3</property>
                           </packing>
                         </child>
diff --git a/src/gnome-sudoku.vala b/src/gnome-sudoku.vala
index 3b0051d8..f434f3fb 100644
--- a/src/gnome-sudoku.vala
+++ b/src/gnome-sudoku.vala
@@ -656,12 +656,14 @@ public class Sudoku : Gtk.Application
         var main_squeezer_m = main_squeezer.margin;
         var game_box_s = game_box.spacing;
         var controls_box_s = controls_box.spacing;
-        var button_w = play_pause_button.width_request;
-        var button_h = play_pause_button.height_request;
-
-        var board_and_spacing = board_size + 3 * game_box_s + 2 * controls_box_s + 2 * main_squeezer_m;
-        frame_h.width_request = board_and_spacing + button_w;
-        frame_v.height_request = board_and_spacing + button_h + 50;
+        var button_w = 120;
+        var button_h = 60;
+
+        var board_and_spacing = board_size + 2 * game_box_s + 2 * main_squeezer_m;
+        var board_with_buttons = board_and_spacing + game_box_s + 2 * controls_box_s;
+        frame_h.width_request = board_with_buttons + button_w;
+        frame_h.height_request = board_and_spacing;
+        frame_v.height_request = board_with_buttons + button_h;
     }
 
     private bool draw_cb ()


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