[simple-scan] Remove packing properties that will not be available in GTK+ 4



commit 9ac219dc1f7f52f19b1e9427651ef494434f105a
Author: Robert Ancell <robert ancell canonical com>
Date:   Tue Sep 25 19:58:28 2018 +1200

    Remove packing properties that will not be available in GTK+ 4

 src/app-window.ui         | 45 +------------------------------
 src/app-window.vala       | 46 ++++++++++++++++++--------------
 src/authorize-dialog.ui   | 24 +----------------
 src/book-view.vala        |  5 ++--
 src/preferences-dialog.ui | 67 -----------------------------------------------
 5 files changed, 31 insertions(+), 156 deletions(-)
---
diff --git a/src/app-window.ui b/src/app-window.ui
index 1f986e9..44a0203 100644
--- a/src/app-window.ui
+++ b/src/app-window.ui
@@ -211,6 +211,7 @@
           <object class="GtkStack" id="stack">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="vexpand">True</property>
             <child>
               <object class="GtkAlignment">
                 <property name="visible">True</property>
@@ -232,11 +233,6 @@
                         <property name="icon_name">scanner-symbolic</property>
                         <property name="icon_size">6</property>
                       </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="status_primary_label">
@@ -250,11 +246,6 @@
                           <class name="dim-label"/>
                         </style>
                       </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="status_secondary_label">
@@ -266,11 +257,6 @@
                           <class name="dim-label"/>
                         </style>
                       </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">2</property>
-                      </packing>
                     </child>
                   </object>
                 </child>
@@ -284,33 +270,21 @@
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="orientation">vertical</property>
-                <child>
-                  <placeholder/>
-                </child>
                 <child>
                   <object class="GtkActionBar" id="action_bar">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
                     <property name="pack_type">end</property>
-                    <property name="position">1</property>
                   </packing>
                 </child>
               </object>
               <packing>
                 <property name="name">document</property>
-                <property name="position">1</property>
               </packing>
             </child>
           </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
-          </packing>
         </child>
       </object>
     </child>
@@ -338,11 +312,6 @@
                   <class name="destructive-action"/>
                 </style>
               </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
             </child>
             <child>
               <object class="GtkButton" id="scan_button">
@@ -358,11 +327,6 @@
                   <class name="suggested-action"/>
                 </style>
               </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
             </child>
             <child>
               <object class="GtkMenuButton">
@@ -389,11 +353,6 @@
                   </object>
                 </child>
               </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">2</property>
-              </packing>
             </child>
             <style>
               <class name="linked"/>
@@ -420,7 +379,6 @@
           </object>
           <packing>
             <property name="pack_type">end</property>
-            <property name="position">2</property>
           </packing>
         </child>
         <child>
@@ -446,7 +404,6 @@
           </object>
           <packing>
             <property name="pack_type">end</property>
-            <property name="position">3</property>
           </packing>
         </child>
         <style>
diff --git a/src/app-window.vala b/src/app-window.vala
index c088a3d..d673725 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -359,18 +359,18 @@ public class AppWindow : Gtk.ApplicationWindow
         /* Label in save dialog beside combo box to choose file format (PDF, JPEG, PNG, WEBP) */
         var label = new Gtk.Label (_("File format:"));
         label.visible = true;
-        box.pack_start (label, false, false, 0);
+        box.add (label);
 
         var file_type_combo = new Gtk.ComboBox.with_model (file_type_store);
         file_type_combo.visible = true;
         var renderer = new Gtk.CellRendererText ();
         file_type_combo.pack_start (renderer, true);
         file_type_combo.add_attribute (renderer, "text", 0);
-        box.pack_start (file_type_combo, false, true, 0);
+        box.add (file_type_combo);
 
         /* Label in save dialog beside compression slider */
         var quality_label = new Gtk.Label (_("Compression:"));
-        box.pack_start (quality_label, false, false, 0);
+        box.add (quality_label);
 
         var quality_adjustment = new Gtk.Adjustment (75, 0, 100, 1, 10, 0);
         var quality_scale = new Gtk.Scale (Gtk.Orientation.HORIZONTAL, quality_adjustment);
@@ -382,7 +382,7 @@ public class AppWindow : Gtk.ApplicationWindow
         quality_scale.add_mark (100, Gtk.PositionType.BOTTOM, null);
         quality_adjustment.value = settings.get_int ("jpeg-quality");
         quality_adjustment.value_changed.connect (() => { settings.set_int ("jpeg-quality", (int) 
quality_adjustment.value); });
-        box.pack_start (quality_scale, false, false, 0);
+        box.add (quality_scale);
 
         file_type_combo.set_active (0);
         file_type_combo.changed.connect (() =>
@@ -1050,11 +1050,13 @@ public class AppWindow : Gtk.ApplicationWindow
 
         var label = new Gtk.Label (text);
         label.visible = true;
-        vbox.pack_start (label, true, true, 0);
+        label.vexpand = true;
+        vbox.add (label);
 
         var rb = make_reorder_box (items);
         rb.visible = true;
-        vbox.pack_start (rb, true, true, 0);
+        rb.vexpand = true;
+        vbox.add (rb);
 
         return b;
     }
@@ -1071,7 +1073,7 @@ public class AppWindow : Gtk.ApplicationWindow
             {
                 var a = new Gtk.Label ("➤");
                 a.visible = true;
-                box.pack_start (a, false, false, 0);
+                box.add (a);
                 page_box = null;
                 continue;
             }
@@ -1086,7 +1088,7 @@ public class AppWindow : Gtk.ApplicationWindow
             {
                 page_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 3);
                 page_box.visible = true;
-                box.pack_start (page_box, false, false, 0);
+                box.add (page_box);
             }
 
             /* Get colours for each page (from Tango palette) */
@@ -1123,7 +1125,7 @@ public class AppWindow : Gtk.ApplicationWindow
 
             var icon = new PageIcon ("%c".printf (items[i]), r, g, b);
             icon.visible = true;
-            page_box.pack_start (icon, false, false, 0);
+            page_box.add (icon);
         }
 
         return box;
@@ -1355,14 +1357,16 @@ public class AppWindow : Gtk.ApplicationWindow
         var label = new Gtk.Label (message);
         label.visible = true;
         label.xalign = 0f;
-        dialog.get_content_area ().pack_start (label, true, true, 0);
+        label.vexpand = true;
+        dialog.get_content_area ().add (label);
 
         var instructions_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
         instructions_box.visible = true;
-        dialog.get_content_area ().pack_start (instructions_box, true, true, 0);
+        instructions_box.vexpand = true;
+        dialog.get_content_area ().add (instructions_box);
 
         var stack = new Gtk.Stack ();
-        instructions_box.pack_start (stack, false, false, 0);
+        instructions_box.add (stack);
 
         var spinner = new Gtk.Spinner ();
         spinner.visible = true;
@@ -1376,14 +1380,15 @@ public class AppWindow : Gtk.ApplicationWindow
         instructions_label.visible = true;
         instructions_label.xalign = 0f;
         instructions_label.use_markup = true;
-        instructions_box.pack_start (instructions_label, false, false, 0);
+        instructions_box.add (instructions_label);
 
         label = new Gtk.Label (/* Message in driver install dialog */
                                _("Once installed you will need to restart Simple Scan."));
         label.visible = true;
         label.xalign = 0f;
+        label.vexpand = true;
         dialog.get_content_area ().border_width = 12;
-        dialog.get_content_area ().pack_start (label, true, true, 0);
+        dialog.get_content_area ().add (label);
 
         if (packages_to_install.length > 0)
         {
@@ -1555,7 +1560,7 @@ public class AppWindow : Gtk.ApplicationWindow
         var rotate_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
         rotate_box.get_style_context ().add_class (Gtk.STYLE_CLASS_LINKED);
         rotate_box.visible = true;
-        box.pack_start (rotate_box, false, true, 0);
+        box.add (rotate_box);
 
         button = new Gtk.Button.from_icon_name ("object-rotate-left-symbolic");
         button.visible = true;
@@ -1564,7 +1569,7 @@ public class AppWindow : Gtk.ApplicationWindow
         /* Tooltip for rotate left (counter-clockwise) button */
         button.tooltip_text = _("Rotate the page to the left (counter-clockwise)");
         button.clicked.connect (rotate_left_button_clicked_cb);
-        rotate_box.pack_start (button, false, true, 0);
+        rotate_box.add (button);
 
         button = new Gtk.Button.from_icon_name ("object-rotate-right-symbolic");
         button.visible = true;
@@ -1573,7 +1578,7 @@ public class AppWindow : Gtk.ApplicationWindow
         /* Tooltip for rotate right (clockwise) button */
         button.tooltip_text = _("Rotate the page to the right (clockwise)");
         button.clicked.connect (rotate_right_button_clicked_cb);
-        rotate_box.pack_start (button, false, true, 0);
+        rotate_box.add (button);
 
         crop_button = new Gtk.ToggleButton ();
         crop_button.visible = true;
@@ -1594,7 +1599,7 @@ public class AppWindow : Gtk.ApplicationWindow
             else
                 no_crop_menuitem.active = true;
         });
-        box.pack_start (crop_button, false, true, 0);
+        box.add (crop_button);
 
         delete_button = new Gtk.Button.from_icon_name ("user-trash-symbolic");
         delete_button.visible = true;
@@ -1603,7 +1608,7 @@ public class AppWindow : Gtk.ApplicationWindow
         /* Tooltip for delete button */
         delete_button.tooltip_text = _("Delete the selected page");
         delete_button.clicked.connect (() => { book_view.book.delete_page (book_view.selected_page); });
-        box.pack_start (delete_button, false, true, 0);
+        box.add (delete_button);
 
         var document_type = settings.get_string ("document-type");
         if (document_type != null)
@@ -1611,7 +1616,8 @@ public class AppWindow : Gtk.ApplicationWindow
 
         book_view = new BookView (book);
         book_view.border_width = 18;
-        main_vbox.pack_start (book_view, true, true, 0);
+        book_view.vexpand = true;
+        main_vbox.add (book_view);
         book_view.page_selected.connect (page_selected_cb);
         book_view.show_page.connect (show_page_cb);
         book_view.show_menu.connect (show_page_menu_cb);
diff --git a/src/authorize-dialog.ui b/src/authorize-dialog.ui
index c099563..1c0235c 100644
--- a/src/authorize-dialog.ui
+++ b/src/authorize-dialog.ui
@@ -28,18 +28,10 @@
                 <property name="receives_default">True</property>
                 <property name="use_underline">True</property>
               </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
             </child>
           </object>
           <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
             <property name="pack_type">end</property>
-            <property name="position">0</property>
           </packing>
         </child>
         <child>
@@ -53,13 +45,9 @@
               <object class="GtkLabel" id="authorize_label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="vexpand">True</property>
                 <property name="label" comments="This label is set dynamically and is not translated">To 
connect to ? you need to authorize</property>
               </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
             </child>
             <child>
               <object class="GtkGrid" id="grid2">
@@ -119,18 +107,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">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
         </child>
       </object>
     </child>
diff --git a/src/book-view.vala b/src/book-view.vala
index 3ffcdf8..782a011 100644
--- a/src/book-view.vala
+++ b/src/book-view.vala
@@ -99,11 +99,12 @@ public class BookView : Gtk.Box
         drawing_area.set_size_request (200, 100);
         drawing_area.can_focus = true;
         drawing_area.events = Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | 
Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.FOCUS_CHANGE_MASK | Gdk.EventMask.STRUCTURE_MASK | 
Gdk.EventMask.SCROLL_MASK;
-        pack_start (drawing_area, true, true, 0);
+        drawing_area.vexpand = true;
+        add (drawing_area);
 
         scroll = new Gtk.Scrollbar (Gtk.Orientation.HORIZONTAL, null);
         adjustment = scroll.adjustment;
-        pack_start (scroll, false, true, 0);
+        add (scroll);
 
         drawing_area.configure_event.connect (configure_cb);
         drawing_area.draw.connect (draw_cb);
diff --git a/src/preferences-dialog.ui b/src/preferences-dialog.ui
index 361996a..e65667e 100644
--- a/src/preferences-dialog.ui
+++ b/src/preferences-dialog.ui
@@ -167,11 +167,6 @@
                             <property name="active">True</property>
                             <property name="draw_indicator">False</property>
                           </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
                         </child>
                         <child>
                           <object class="GtkRadioButton" id="back_side_button">
@@ -182,11 +177,6 @@
                             <property name="draw_indicator">False</property>
                             <property name="group">front_side_button</property>
                           </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
                         </child>
                         <child>
                           <object class="GtkRadioButton" id="both_side_button">
@@ -197,11 +187,6 @@
                             <property name="draw_indicator">False</property>
                             <property name="group">front_side_button</property>
                           </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">2</property>
-                          </packing>
                         </child>
                         <style>
                           <class name="linked"/>
@@ -213,11 +198,6 @@
                       </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">
@@ -271,11 +251,6 @@
                             <property name="active">True</property>
                             <property name="draw_indicator">False</property>
                           </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
                         </child>
                         <child>
                           <object class="GtkRadioButton" id="page_delay_5s_button">
@@ -287,11 +262,6 @@
                             <property name="draw_indicator">False</property>
                             <property name="group">page_delay_3s_button</property>
                           </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
                         </child>
                         <child>
                           <object class="GtkRadioButton" id="page_delay_7s_button">
@@ -303,11 +273,6 @@
                             <property name="draw_indicator">False</property>
                             <property name="group">page_delay_3s_button</property>
                           </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">2</property>
-                          </packing>
                         </child>
                         <child>
                           <object class="GtkRadioButton" id="page_delay_10s_button">
@@ -319,11 +284,6 @@
                             <property name="draw_indicator">False</property>
                             <property name="group">page_delay_3s_button</property>
                           </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">3</property>
-                          </packing>
                         </child>
                         <child>
                           <object class="GtkRadioButton" id="page_delay_15s_button">
@@ -335,11 +295,6 @@
                             <property name="draw_indicator">False</property>
                             <property name="group">page_delay_3s_button</property>
                           </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">4</property>
-                          </packing>
                         </child>
                         <style>
                           <class name="linked"/>
@@ -367,11 +322,6 @@
                       </packing>
                     </child>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
                 </child>
               </object>
               <packing>
@@ -458,11 +408,6 @@
                       </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">
@@ -529,15 +474,9 @@
                       </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="position">1</property>
                 <property name="tab_expand">True</property>
               </packing>
             </child>
@@ -548,16 +487,10 @@
                 <property name="label" translatable="yes" comments="Preferences Dialog: Tab for quality 
settings">Quality</property>
               </object>
               <packing>
-                <property name="position">1</property>
                 <property name="tab_fill">False</property>
               </packing>
             </child>
           </object>
-          <packing>
-            <property name="expand">True</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]