[nautilus/wip/apoos-maximus/gsoc2020: 26/27] properties-window: use top-widget margins for spacing between widget groups




commit 5100f4ea9d900936c754610148833eb621bcb8d4
Author: Apoorv Sachan <apoorv 99 sachan gmail com>
Date:   Wed Jul 22 02:51:44 2020 +0530

    properties-window: use top-widget margins for spacing between widget groups
    
    It is recommended that widget margins should be used to apply
    spacing between widget groups instead of empty labels.
    
    properties-window: Follow HIG layout advice
    
    The GNOME Human Interface Guidelines include spacing rules for widgets
    laid out in a grid, and spacing from window edges:
    https://developer.gnome.org/hig/stable/visual-layout.html.en
    
    For vertical spacing between groups of controls, we have been using
    empty label widgets. This doesn't give us the control over the heigh
    that we need, so shall use margins instead. In case of the Basic page,
    due to the conditionality of the first widget in a group, instead of
    propper margins we use an empty box with a set heigh as a spacer.
    
    Also, prefer the GtkBox:spacing property over the padding child prop.

 src/nautilus-properties-window.c               |  15 +--
 src/resources/ui/nautilus-properties-window.ui | 179 ++++++++++++-------------
 2 files changed, 85 insertions(+), 109 deletions(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 9f2470d66..91d45171c 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -184,18 +184,12 @@ struct _NautilusPropertiesWindow
     GtkWidget *others_file_access_label;
     GtkWidget *others_file_access_combo;
 
-    GtkWidget *spacer_6;
-
     GtkWidget *execute_label;
     GtkWidget *execute_checkbox;
 
-    GtkWidget *spacer_7;
-
     GtkWidget *security_context_title_label;
     GtkWidget *security_context_value_label;
 
-    GtkWidget *spacer_8;
-
     GtkWidget *change_permissions_button_box;
     GtkWidget *change_permissions_button;
 
@@ -3269,7 +3263,6 @@ setup_execute_checkbox_with_label (NautilusPropertiesWindow *window,
     GtkLabel *label_for;
 
     label_for = GTK_LABEL (window->execute_label);
-    gtk_widget_show (window->spacer_6);
     gtk_widget_show (window->execute_label);
     gtk_widget_show (window->execute_checkbox);
 
@@ -4267,7 +4260,6 @@ create_permissions_page (NautilusPropertiesWindow *window)
         create_simple_permissions (window, GTK_GRID (window->permissions_grid));
 
 #ifdef HAVE_SELINUX
-        gtk_widget_show (window->spacer_7);
         gtk_widget_show (window->security_context_title_label);
         gtk_widget_show (window->security_context_value_label);
 
@@ -4279,8 +4271,6 @@ create_permissions_page (NautilusPropertiesWindow *window)
                                                window->security_context_value_label);
 #endif
 
-        gtk_widget_show (window->spacer_8);
-
         if (window->has_recursive_apply)
         {
             gtk_widget_show_all (window->change_permissions_button_box);
@@ -4776,7 +4766,7 @@ setup_app_chooser_area (NautilusPropertiesWindow *window)
     GAppInfo *info;
 
     window->app_chooser_widget = gtk_app_chooser_widget_new (window->content_type);
-    gtk_box_pack_start (GTK_BOX (window->app_chooser_widget_box), window->app_chooser_widget, TRUE, TRUE, 6);
+    gtk_box_pack_start (GTK_BOX (window->app_chooser_widget_box), window->app_chooser_widget, TRUE, TRUE, 0);
 
     gtk_app_chooser_widget_set_show_default (GTK_APP_CHOOSER_WIDGET (window->app_chooser_widget), TRUE);
     gtk_app_chooser_widget_set_show_fallback (GTK_APP_CHOOSER_WIDGET (window->app_chooser_widget), TRUE);
@@ -5655,13 +5645,10 @@ nautilus_properties_window_class_init (NautilusPropertiesWindowClass *klass)
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, others_access_combo);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, 
others_folder_access_combo);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, others_file_access_combo);
-    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, spacer_6);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, execute_label);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, execute_checkbox);
-    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, spacer_7);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, 
security_context_title_label);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, 
security_context_value_label);
-    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, spacer_8);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, 
change_permissions_button_box);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, change_permissions_button);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, open_with_box);
diff --git a/src/resources/ui/nautilus-properties-window.ui b/src/resources/ui/nautilus-properties-window.ui
index 250a6ca05..285876f2c 100644
--- a/src/resources/ui/nautilus-properties-window.ui
+++ b/src/resources/ui/nautilus-properties-window.ui
@@ -19,7 +19,7 @@
               <object class="GtkBox" id="basic_box">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="border_width">12</property>
+                <property name="border_width">18</property>
                 <property name="orientation">vertical</property>
                 <property name="spacing">12</property>
                 <child>
@@ -72,7 +72,6 @@
                       <object class="GtkGrid" id="basic_grid">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="border_width">6</property>
                         <property name="orientation">vertical</property>
                         <property name="row_spacing">6</property>
                         <property name="column_spacing">12</property>
@@ -246,16 +245,6 @@
                             <property name="top_attach">4</property>
                           </packing>
                         </child>
-                        <child>
-                          <object class="GtkLabel" id="spacer_1">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">5</property>
-                          </packing>
-                        </child>
                         <child>
                           <object class="GtkLabel" id="parent_folder_title_label">
                             <property name="can_focus">False</property>
@@ -368,15 +357,6 @@
                             <property name="top_attach">12</property>
                           </packing>
                         </child>
-                        <child>
-                          <object class="GtkLabel" id="spacer_2">
-                            <property name="can_focus">False</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">8</property>
-                          </packing>
-                        </child>
                         <child>
                           <object class="GtkLabel" id="accessed_title_label">
                             <property name="can_focus">False</property>
@@ -429,15 +409,6 @@
                             <property name="top_attach">10</property>
                           </packing>
                         </child>
-                        <child>
-                          <object class="GtkLabel" id="spacer_3">
-                            <property name="can_focus">False</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">13</property>
-                          </packing>
-                        </child>
                         <child>
                           <object class="GtkLabel" id="free_space_title_label">
                             <property name="can_focus">False</property>
@@ -689,6 +660,49 @@
                             <property name="width">3</property>
                           </packing>
                         </child>
+                        <child>
+                          <object class="GtkBox" id="spacer_1">
+                            <property name="height_request">6</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="orientation">vertical</property>
+                            <child>
+                              <placeholder/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">5</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkBox" id="spacer_2">
+                            <property name="height_request">6</property>
+                            <property name="can_focus">False</property>
+                            <property name="orientation">vertical</property>
+                            <child>
+                              <placeholder/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">8</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkBox" id="spacer_3">
+                            <property name="height_request">6</property>
+                            <property name="can_focus">False</property>
+                            <property name="orientation">vertical</property>
+                            <child>
+                              <placeholder/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">13</property>
+                          </packing>
+                        </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -721,7 +735,7 @@
             <child>
               <object class="GtkBox" id="permissions_box">
                 <property name="can_focus">False</property>
-                <property name="border_width">12</property>
+                <property name="border_width">18</property>
                 <property name="orientation">vertical</property>
                 <child>
                   <object class="GtkLabel" id="not_the_owner_label">
@@ -765,7 +779,6 @@
                 <child>
                   <object class="GtkGrid" id="permissions_grid">
                     <property name="can_focus">False</property>
-                    <property name="border_width">6</property>
                     <property name="orientation">vertical</property>
                     <property name="row_spacing">6</property>
                     <property name="column_spacing">12</property>
@@ -889,20 +902,11 @@
                         <property name="top_attach">3</property>
                       </packing>
                     </child>
-                    <child>
-                      <object class="GtkLabel" id="spacer_4">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">4</property>
-                      </packing>
-                    </child>
                     <child>
                       <object class="GtkLabel" id="group_label">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="margin_top">12</property>
                         <property name="label" translatable="yes">_Group</property>
                         <property name="use_underline">True</property>
                         <property name="mnemonic_widget">group_combo_box</property>
@@ -925,6 +929,7 @@
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="halign">start</property>
+                            <property name="margin_top">12</property>
                           </object>
                           <packing>
                             <property name="name">combo_box</property>
@@ -935,6 +940,7 @@
                           <object class="GtkLabel" id="group_value_label">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
+                            <property name="margin_top">12</property>
                             <property name="selectable">True</property>
                             <property name="xalign">0</property>
                           </object>
@@ -1019,20 +1025,11 @@
                         <property name="top_attach">8</property>
                       </packing>
                     </child>
-                    <child>
-                      <object class="GtkLabel" id="spacer_5">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">9</property>
-                      </packing>
-                    </child>
                     <child>
                       <object class="GtkLabel" id="others_label">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="margin_top">12</property>
                         <property name="label" translatable="yes">Others</property>
                         <property name="xalign">1</property>
                         <style>
@@ -1113,18 +1110,10 @@
                         <property name="top_attach">13</property>
                       </packing>
                     </child>
-                    <child>
-                      <object class="GtkLabel" id="spacer_6">
-                        <property name="can_focus">False</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">14</property>
-                      </packing>
-                    </child>
                     <child>
                       <object class="GtkLabel" id="execute_label">
                         <property name="can_focus">False</property>
+                        <property name="margin_top">12</property>
                         <property name="label" translatable="yes">Execute</property>
                         <property name="xalign">1</property>
                         <style>
@@ -1136,30 +1125,10 @@
                         <property name="top_attach">15</property>
                       </packing>
                     </child>
-                    <child>
-                      <object class="GtkCheckButton" id="execute_checkbox">
-                        <property name="label" translatable="yes">Allow _executing file as program</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="draw_indicator">True</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">15</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="spacer_7">
-                        <property name="can_focus">False</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">16</property>
-                      </packing>
-                    </child>
                     <child>
                       <object class="GtkLabel" id="security_context_title_label">
                         <property name="can_focus">False</property>
+                        <property name="margin_top">12</property>
                         <property name="label" translatable="yes">Security context</property>
                         <property name="xalign">1</property>
                         <style>
@@ -1174,6 +1143,7 @@
                     <child>
                       <object class="GtkLabel" id="security_context_value_label">
                         <property name="can_focus">False</property>
+                        <property name="margin_top">12</property>
                         <property name="selectable">True</property>
                         <property name="max_width_chars">24</property>
                         <property name="xalign">0</property>
@@ -1183,18 +1153,10 @@
                         <property name="top_attach">17</property>
                       </packing>
                     </child>
-                    <child>
-                      <object class="GtkLabel" id="spacer_8">
-                        <property name="can_focus">False</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">18</property>
-                      </packing>
-                    </child>
                     <child>
                       <object class="GtkBox" id="change_permissions_button_box">
                         <property name="can_focus">False</property>
+                        <property name="margin_top">12</property>
                         <child>
                           <object class="GtkButton" id="change_permissions_button">
                             <property name="label" translatable="yes">Change Permissions for Enclosed 
Files…</property>
@@ -1214,6 +1176,34 @@
                         <property name="width">2</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkCheckButton" id="execute_checkbox">
+                        <property name="label" translatable="yes">Allow _executing file as program</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="margin_top">12</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">15</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                     <child>
                       <placeholder/>
                     </child>
@@ -1259,8 +1249,9 @@
             <child>
               <object class="GtkBox" id="open_with_box">
                 <property name="can_focus">False</property>
-                <property name="border_width">8</property>
+                <property name="border_width">18</property>
                 <property name="orientation">vertical</property>
+                <property name="spacing">6</property>
                 <child>
                   <object class="GtkLabel" id="open_with_label">
                     <property name="visible">True</property>
@@ -1288,7 +1279,6 @@
                   <packing>
                     <property name="expand">True</property>
                     <property name="fill">True</property>
-                    <property name="padding">6</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -1296,7 +1286,7 @@
                   <object class="GtkButtonBox" id="app_chooser_button_box">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="spacing">6</property>
+                    <property name="spacing">12</property>
                     <property name="layout_style">end</property>
                     <child>
                       <object class="GtkButton" id="reset_button">
@@ -1343,7 +1333,6 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="padding">6</property>
                     <property name="position">2</property>
                   </packing>
                 </child>


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