[gnome-control-center] region: Replace old style packing properties with GtkWidget properties



commit cf2f90ce65076d162cbf1a5fc8c4dc84a8eae3ca
Author: Robert Ancell <robert ancell canonical com>
Date:   Tue Sep 11 10:39:09 2018 +1200

    region: Replace old style packing properties with GtkWidget properties
    
    Note that the toolbar properties can't yet be changed:
    https://gitlab.gnome.org/GNOME/gtk/merge_requests/334

 panels/region/cc-format-chooser.c  |   9 +--
 panels/region/cc-format-chooser.ui |  26 +-------
 panels/region/cc-input-chooser.c   |  12 ++--
 panels/region/region.ui            | 131 ++++---------------------------------
 4 files changed, 24 insertions(+), 154 deletions(-)
---
diff --git a/panels/region/cc-format-chooser.c b/panels/region/cc-format-chooser.c
index 59520e1e8..550373056 100644
--- a/panels/region/cc-format-chooser.c
+++ b/panels/region/cc-format-chooser.c
@@ -199,7 +199,7 @@ padded_label_new (char *text, gboolean narrow)
         gtk_widget_set_margin_bottom (widget, 10);
         gtk_widget_set_margin_start (widget, narrow ? 10 : 80);
         gtk_widget_set_margin_end (widget, narrow ? 10 : 80);
-        gtk_box_pack_start (GTK_BOX (widget), gtk_label_new (text), FALSE, FALSE, 0);
+        gtk_container_add (GTK_CONTAINER (widget), gtk_label_new (text));
 
         return widget;
 }
@@ -230,14 +230,14 @@ region_widget_new (const gchar *locale_id,
         gtk_image_set_from_icon_name (GTK_IMAGE (check), "object-select-symbolic", GTK_ICON_SIZE_MENU);
         gtk_widget_set_opacity (check, 0.0);
         g_object_set (check, "icon-size", GTK_ICON_SIZE_MENU, NULL);
-        gtk_box_pack_start (GTK_BOX (box), check, FALSE, FALSE, 0);
+        gtk_container_add (GTK_CONTAINER (box), check);
         gtk_box_reorder_child (GTK_BOX (box), check, 0);
 
         check = gtk_image_new ();
         gtk_image_set_from_icon_name (GTK_IMAGE (check), "object-select-symbolic", GTK_ICON_SIZE_MENU);
         gtk_widget_set_opacity (check, 0.0);
         g_object_set (check, "icon-size", GTK_ICON_SIZE_MENU, NULL);
-        gtk_box_pack_start (GTK_BOX (box), check, FALSE, FALSE, 0);
+        gtk_container_add (GTK_CONTAINER (box), check);
 
         g_object_set_data (G_OBJECT (row), "check", check);
         g_object_set_data_full (G_OBJECT (row), "locale-id", g_strdup (locale_id), g_free);
@@ -262,9 +262,10 @@ more_widget_new (void)
 
         arrow = gtk_image_new_from_icon_name ("view-more-symbolic", GTK_ICON_SIZE_MENU);
         gtk_style_context_add_class (gtk_widget_get_style_context (arrow), "dim-label");
+        gtk_widget_set_hexpand (arrow, TRUE);
         gtk_widget_set_margin_top (box, 10);
         gtk_widget_set_margin_bottom (box, 10);
-        gtk_box_pack_start (GTK_BOX (box), arrow, TRUE, TRUE, 0);
+        gtk_container_add (GTK_CONTAINER (box), arrow);
 
         return GTK_LIST_BOX_ROW (row);
 }
diff --git a/panels/region/cc-format-chooser.ui b/panels/region/cc-format-chooser.ui
index 7e915f0e6..2813b553a 100644
--- a/panels/region/cc-format-chooser.ui
+++ b/panels/region/cc-format-chooser.ui
@@ -42,6 +42,7 @@
             <property name="margin_top">6</property>
             <property name="margin_bottom">6</property>
             <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
             <property name="spacing">20</property>
             <child>
               <object class="GtkBox">
@@ -75,11 +76,6 @@
                       </object>
                     </child>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
                 </child>
                 <child>
                   <object class="GtkSearchEntry" id="region_filter_entry">
@@ -87,18 +83,8 @@
                     <property name="hexpand">True</property>
                     <property name="can_focus">True</property>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
                 </child>
               </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
             </child>
             <child>
               <object class="GtkGrid">
@@ -316,18 +302,8 @@
                   </packing>
                 </child>
               </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
             </child>
           </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
         </child>
       </object>
     </child>
diff --git a/panels/region/cc-input-chooser.c b/panels/region/cc-input-chooser.c
index 674662052..9646017e3 100644
--- a/panels/region/cc-input-chooser.c
+++ b/panels/region/cc-input-chooser.c
@@ -135,21 +135,22 @@ padded_label_new (const gchar        *text,
   if (direction == ROW_TRAVEL_DIRECTION_BACKWARD)
     {
       arrow = gtk_image_new_from_icon_name ("go-previous-symbolic", GTK_ICON_SIZE_MENU);
-      gtk_box_pack_start (GTK_BOX (widget), arrow, FALSE, TRUE, 0);
+      gtk_container_add (GTK_CONTAINER (widget), arrow);
     }
 
   label = gtk_label_new (text);
   gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_MIDDLE);
+  gtk_widget_set_hexpand (label, TRUE);
   gtk_widget_set_halign (label, alignment);
   set_row_widget_margins (label);
-  gtk_box_pack_start (GTK_BOX (widget), label, TRUE, TRUE, 0);
+  gtk_container_add (GTK_CONTAINER (widget), label);
   if (dim_label)
     gtk_style_context_add_class (gtk_widget_get_style_context (label), "dim-label");
 
   if (direction == ROW_TRAVEL_DIRECTION_FORWARD)
     {
       arrow = gtk_image_new_from_icon_name ("go-next-symbolic", GTK_ICON_SIZE_MENU);
-      gtk_box_pack_start (GTK_BOX (widget), arrow, FALSE, TRUE, 0);
+      gtk_container_add (GTK_CONTAINER (widget), arrow);
     }
 
   return widget;
@@ -169,8 +170,9 @@ more_row_new (void)
 
   arrow = gtk_image_new_from_icon_name ("view-more-symbolic", GTK_ICON_SIZE_MENU);
   gtk_style_context_add_class (gtk_widget_get_style_context (arrow), "dim-label");
+  gtk_widget_set_hexpand (arrow, TRUE);
   set_row_widget_margins (arrow);
-  gtk_box_pack_start (GTK_BOX (box), arrow, TRUE, TRUE, 0);
+  gtk_container_add (GTK_CONTAINER (box), arrow);
 
   return GTK_LIST_BOX_ROW (row);
 }
@@ -249,7 +251,7 @@ input_source_row_new (GtkWidget   *chooser,
       image = gtk_image_new_from_icon_name ("system-run-symbolic", GTK_ICON_SIZE_MENU);
       set_row_widget_margins (image);
       gtk_style_context_add_class (gtk_widget_get_style_context (image), "dim-label");
-      gtk_box_pack_start (GTK_BOX (widget), image, FALSE, TRUE, 0);
+      gtk_container_add (GTK_CONTAINER (widget), image);
 
       g_object_set_data_full (G_OBJECT (row), "name", display_name, g_free);
       g_object_set_data_full (G_OBJECT (row), "unaccented-name",
diff --git a/panels/region/region.ui b/panels/region/region.ui
index e5b4646a1..d3af5be75 100644
--- a/panels/region/region.ui
+++ b/panels/region/region.ui
@@ -18,17 +18,6 @@
           </object>
         </child>
 
-        <child>
-          <object class="GtkBox">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
-          </object>
-          <packing>
-            <property name="pack_type">end</property>
-          </packing>
-        </child>
-
         <!-- Content -->
         <child>
           <object class="GtkBox">
@@ -70,12 +59,8 @@
                                     <property name="xalign">0</property>
                                     <property name="label" translatable="yes">_Language</property>
                                     <property name="use_underline">True</property>
+                                    <property name="hexpand">True</property>
                                   </object>
-                                  <packing>
-                                    <property name="expand">True</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
                                 </child>
                                 <child>
                                   <object class="GtkLabel" id="language_label">
@@ -87,11 +72,6 @@
                                     <property name="margin_top">18</property>
                                     <property name="margin_bottom">18</property>
                                   </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
                             </child>
@@ -120,11 +100,6 @@
                                           <attribute name="scale" value="0.9"/>
                                         </attributes>
                                       </object>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">True</property>
-                                        <property name="position">0</property>
-                                      </packing>
                                     </child>
                                     <child>
                                       <object class="GtkButton" id="restart_button">
@@ -140,11 +115,6 @@
                                         </style>
                                         <signal name="clicked" handler="restart_now" object="CcRegionPanel" 
swapped="yes"/>
                                       </object>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">True</property>
-                                        <property name="position">1</property>
-                                      </packing>
                                     </child>
                                   </object>
                                 </child>
@@ -172,12 +142,8 @@
                                 <property name="xalign">0</property>
                                 <property name="label" translatable="yes">_Formats</property>
                                 <property name="use_underline">True</property>
+                                <property name="hexpand">True</property>
                               </object>
-                              <packing>
-                                <property name="expand">True</property>
-                                <property name="fill">True</property>
-                                <property name="position">0</property>
-                              </packing>
                             </child>
                             <child>
                               <object class="GtkLabel" id="formats_label">
@@ -189,11 +155,6 @@
                                 <property name="margin_top">18</property>
                                 <property name="margin_bottom">18</property>
                               </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="position">1</property>
-                              </packing>
                             </child>
                           </object>
                         </child>
@@ -205,11 +166,6 @@
                   <placeholder/>
                 </child>
               </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
             </child>
             <child>
               <object class="GtkBox" id="input_section">
@@ -229,6 +185,7 @@
                         <property name="margin_start">2</property>
                         <property name="margin_end">2</property>
                         <property name="xalign">0</property>
+                        <property name="hexpand">True</property>
                         <property name="label" translatable="yes">Input Sources</property>
                         <attributes>
                           <attribute name="weight" value="bold"/>
@@ -237,11 +194,6 @@
                           <relation target="input_list" type="label-for"/>
                         </accessibility>
                       </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkMenuButton" id="options_button">
@@ -252,18 +204,8 @@
                         <property name="use_underline">True</property>
                         <property name="popover">options_popover</property>
                       </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
                     </child>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
                 </child>
                 <child>
                   <object class="GtkFrame" id="input_frame">
@@ -297,11 +239,6 @@
                       </object>
                     </child>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
                 </child>
                 <child>
                   <object class="GtkToolbar" id="input_toolbar">
@@ -341,11 +278,6 @@
                                   </object>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="position">0</property>
-                              </packing>
                             </child>
                             <child>
                               <object class="GtkButton" id="remove_input">
@@ -367,18 +299,10 @@
                                   </object>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="position">1</property>
-                              </packing>
                             </child>
                           </object>
                         </child>
                       </object>
-                      <packing>
-                        <property name="expand">False</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkSeparatorToolItem" id="sep1">
@@ -418,11 +342,6 @@
                                   </object>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="position">0</property>
-                              </packing>
                             </child>
                             <child>
                               <object class="GtkButton" id="move_down_input">
@@ -444,18 +363,10 @@
                                   </object>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="position">1</property>
-                              </packing>
                             </child>
                           </object>
                         </child>
                       </object>
-                      <packing>
-                        <property name="expand">False</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkSeparatorToolItem" id="sep2">
@@ -495,11 +406,6 @@
                                   </object>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="position">0</property>
-                              </packing>
                             </child>
                             <child>
                               <object class="GtkButton" id="show_layout">
@@ -521,32 +427,14 @@
                                   </object>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="position">1</property>
-                              </packing>
                             </child>
                           </object>
                         </child>
                       </object>
-                      <packing>
-                        <property name="expand">False</property>
-                      </packing>
                     </child>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">2</property>
-                  </packing>
                 </child>
               </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
             </child>
             <child>
               <object class="GtkLabel" id="login_label">
@@ -562,6 +450,14 @@
             </child>
           </object>
         </child>
+
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+          </object>
+        </child>
       </object>
     </child>
   </template>
@@ -759,11 +655,6 @@
               </packing>
             </child>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
         </child>
       </object>
     </child>


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