[simple-scan] Split preferences dialog into tabs as per new design



commit b029f22c009847db5b215f5d94c70ecfd69ff89f
Author: Robert Ancell <robert ancell canonical com>
Date:   Tue May 23 10:10:53 2017 +1200

    Split preferences dialog into tabs as per new design

 src/preferences-dialog.ui   |  685 ++++++++++++++++++++++++++-----------------
 src/preferences-dialog.vala |   58 +++--
 2 files changed, 460 insertions(+), 283 deletions(-)
---
diff --git a/src/preferences-dialog.ui b/src/preferences-dialog.ui
index a84a73e..bc974a7 100644
--- a/src/preferences-dialog.ui
+++ b/src/preferences-dialog.ui
@@ -22,11 +22,6 @@
       <column type="gchararray"/>
     </columns>
   </object>
-  <object class="GtkAdjustment" id="page_delay_adjustment">
-    <property name="upper">10000</property>
-    <property name="step_increment">100</property>
-    <property name="page_increment">1000</property>
-  </object>
   <object class="GtkListStore" id="paper_size_model">
     <columns>
       <!-- column-name width -->
@@ -55,7 +50,6 @@
   </object>
   <template class="PreferencesDialog" parent="GtkDialog">
     <property name="can_focus">False</property>
-    <property name="border_width">30</property>
     <property name="title" translatable="yes" comments="Title of preferences dialog">Preferences</property>
     <property name="resizable">False</property>
     <property name="icon_name">scanner</property>
@@ -95,332 +89,497 @@
           </packing>
         </child>
         <child>
-          <object class="GtkBox">
+          <object class="GtkNotebook">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">30</property>
+            <property name="can_focus">True</property>
+            <property name="show_border">False</property>
             <child>
-              <object class="GtkGrid">
+              <object class="GtkBox">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="row_spacing">10</property>
-                <property name="column_spacing">10</property>
+                <property name="border_width">30</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">30</property>
                 <child>
-                  <object class="GtkLabel" id="source_label">
+                  <object class="GtkGrid">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes" comments="Label beside scan source combo 
box">_Scanner</property>
-                    <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">device_combo</property>
-                    <property name="xalign">1</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkComboBox" id="device_combo">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="hexpand">True</property>
-                    <property name="model">device_model</property>
-                    <signal name="changed" handler="device_combo_changed_cb" swapped="no"/>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="page_side_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes" comments="Label beside scan side combo 
box">Scan Sides</property>
-                    <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">scan_side_box</property>
-                    <property name="xalign">1</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="paper_size_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes" comments="Label beside page size combo 
box">Page Size</property>
-                    <property name="use_underline">True</property>
-                    <property name="xalign">1</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkComboBox" id="paper_size_combo">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="hexpand">True</property>
-                    <property name="model">paper_size_model</property>
+                    <property name="row_spacing">15</property>
+                    <property name="column_spacing">10</property>
+                    <child>
+                      <object class="GtkLabel" id="source_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes" comments="Label beside scan source combo 
box">_Scanner</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">device_combo</property>
+                        <property name="xalign">1</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkComboBox" id="device_combo">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="model">device_model</property>
+                        <signal name="changed" handler="device_combo_changed_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="page_side_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes" comments="Label beside scan side combo 
box">Scan Sides</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">scan_side_box</property>
+                        <property name="xalign">1</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="paper_size_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes" comments="Label beside page size combo 
box">Page Size</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">1</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkComboBox" id="paper_size_combo">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="model">paper_size_model</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="scan_side_box">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="homogeneous">True</property>
+                        <child>
+                          <object class="GtkRadioButton" id="front_side_button">
+                            <property name="label" translatable="yes" comments="Preferences Dialog: Toggle 
button to select scanning on front side of a page">Front</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <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">
+                            <property name="label" translatable="yes" comments="Preferences Dialog: Toggle 
button to select scanning on the back side of a page">Back</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <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">
+                            <property name="label" translatable="yes" comments="Preferences Dialog: Toggle 
button to select scanning on both sides of a page">Both</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <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"/>
+                        </style>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">2</property>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkBox" id="scan_side_box">
+                  <object class="GtkGrid">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="homogeneous">True</property>
+                    <property name="row_spacing">15</property>
+                    <property name="column_spacing">10</property>
                     <child>
-                      <object class="GtkRadioButton" id="front_side_button">
-                        <property name="label" translatable="yes" comments="Preferences Dialog: Toggle 
button to select scanning on front side of a page">Front</property>
+                      <object class="GtkLabel" id="page_delay_label">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="draw_indicator">False</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes" comments="Label beside page delay 
scale">Delay</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">1</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkRadioButton" id="back_side_button">
-                        <property name="label" translatable="yes" comments="Preferences Dialog: Toggle 
button to select scanning on the back side of a page">Back</property>
+                      <object class="GtkLabel">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="draw_indicator">False</property>
-                        <property name="group">front_side_button</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes" comments="Preferences dialog: Label above 
settings for scanning multiple pages from a flatbed">Multiple page from flatbed</property>
+                        <property name="xalign">0</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                        <property name="width">3</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkRadioButton" id="both_side_button">
-                        <property name="label" translatable="yes" comments="Preferences Dialog: Toggle 
button to select scanning on both sides of a page">Both</property>
+                      <object class="GtkBox">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="draw_indicator">False</property>
-                        <property name="group">front_side_button</property>
+                        <property name="can_focus">False</property>
+                        <property name="homogeneous">True</property>
+                        <child>
+                          <object class="GtkRadioButton" id="page_delay_3s_button">
+                            <property name="label" translatable="yes" comments="Preferences Dialog: Toggle 
button to select scanning on front side of a page">3</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <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">
+                            <property name="label" translatable="yes" comments="Preferences Dialog: Toggle 
button to select scanning on front side of a page">5</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="active">True</property>
+                            <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">
+                            <property name="label" translatable="yes" comments="Preferences Dialog: Toggle 
button to select scanning on front side of a page">7</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="active">True</property>
+                            <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">
+                            <property name="label" translatable="yes" comments="Preferences Dialog: Toggle 
button to select scanning on front side of a page">10</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="active">True</property>
+                            <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">
+                            <property name="label" translatable="yes" comments="Preferences Dialog: Toggle 
button to select scanning on front side of a page">15</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="active">True</property>
+                            <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>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes" comments="Label after page delay radio 
buttons">Seconds</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">1</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">2</property>
+                        <property name="left_attach">2</property>
+                        <property name="top_attach">1</property>
                       </packing>
                     </child>
-                    <style>
-                      <class name="linked"/>
-                    </style>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">1</property>
+                    <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>
+                <property name="tab_expand">True</property>
+              </packing>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes" comments="Preferences Dialog: Tab label for 
scanning settings">Scanning</property>
+              </object>
+              <packing>
+                <property name="tab_fill">False</property>
               </packing>
             </child>
             <child>
-              <object class="GtkGrid">
+              <object class="GtkBox">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="row_spacing">10</property>
-                <property name="column_spacing">10</property>
-                <child>
-                  <object class="GtkLabel" id="text_dpi_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes" comments="Label beside scan source combo 
box">_Text Resolution</property>
-                    <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">text_dpi_combo</property>
-                    <property name="xalign">1</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="photo_dpi_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes" comments="Label beside scan source combo 
box">_Photo Resolution</property>
-                    <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">photo_dpi_combo</property>
-                    <property name="xalign">1</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">1</property>
-                  </packing>
-                </child>
+                <property name="border_width">30</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">30</property>
                 <child>
-                  <object class="GtkComboBox" id="text_dpi_combo">
+                  <object class="GtkGrid">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="hexpand">True</property>
-                    <property name="model">text_dpi_model</property>
+                    <property name="row_spacing">14</property>
+                    <property name="column_spacing">10</property>
+                    <child>
+                      <object class="GtkLabel" id="text_dpi_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes" comments="Label beside scan source combo 
box">_Text Resolution</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">1</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="photo_dpi_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes" comments="Label beside scan source combo 
box">_Photo Resolution</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">1</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkComboBox" id="text_dpi_combo">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="model">text_dpi_model</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkComboBox" id="photo_dpi_combo">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="model">photo_dpi_model</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">0</property>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkComboBox" id="photo_dpi_combo">
+                  <object class="GtkGrid">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="hexpand">True</property>
-                    <property name="model">photo_dpi_model</property>
+                    <property name="row_spacing">15</property>
+                    <property name="column_spacing">10</property>
+                    <child>
+                      <object class="GtkLabel" id="brightness_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes" comments="Label beside brightness 
scale">Brightness</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">1</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="contrast_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes" comments="Label beside contrast 
scale">Contrast</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">1</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkScale" id="brightness_scale">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                        <property name="adjustment">brightness_adjustment</property>
+                        <property name="draw_value">False</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkScale" id="contrast_scale">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                        <property name="adjustment">contrast_adjustment</property>
+                        <property name="draw_value">False</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">1</property>
+                    <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>
+                <property name="tab_expand">True</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkGrid">
+            <child type="tab">
+              <object class="GtkLabel">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="row_spacing">10</property>
-                <property name="column_spacing">10</property>
-                <child>
-                  <object class="GtkLabel" id="brightness_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes" comments="Label beside brightness 
scale">Brightness</property>
-                    <property name="use_underline">True</property>
-                    <property name="xalign">1</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="contrast_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes" comments="Label beside contrast 
scale">Contrast</property>
-                    <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">contrast_scale</property>
-                    <property name="xalign">1</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="page_delay_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes" comments="Label beside page delay scale">Delay 
between pages</property>
-                    <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">page_delay_scale</property>
-                    <property name="xalign">1</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkScale" id="brightness_scale">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="hexpand">True</property>
-                    <property name="adjustment">brightness_adjustment</property>
-                    <property name="draw_value">False</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkScale" id="contrast_scale">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="hexpand">True</property>
-                    <property name="adjustment">contrast_adjustment</property>
-                    <property name="draw_value">False</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkScale" id="page_delay_scale">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="hexpand">True</property>
-                    <property name="adjustment">page_delay_adjustment</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">2</property>
-                  </packing>
-                </child>
+                <property name="label" translatable="yes" comments="Preferences Dialog: Tab for quality 
settings">Quality</property>
               </object>
               <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">2</property>
+                <property name="position">1</property>
+                <property name="tab_fill">False</property>
               </packing>
             </child>
           </object>
           <packing>
-            <property name="expand">False</property>
+            <property name="expand">True</property>
             <property name="fill">True</property>
             <property name="position">1</property>
           </packing>
@@ -436,11 +595,11 @@
       <widget name="source_label"/>
       <widget name="page_side_label"/>
       <widget name="paper_size_label"/>
+      <widget name="page_delay_label"/>
       <widget name="text_dpi_label"/>
       <widget name="photo_dpi_label"/>
       <widget name="brightness_label"/>
       <widget name="contrast_label"/>
-      <widget name="page_delay_label"/>
     </widgets>
   </object>
 </interface>
diff --git a/src/preferences-dialog.vala b/src/preferences-dialog.vala
index 7bf8505..7ce8ffc 100644
--- a/src/preferences-dialog.vala
+++ b/src/preferences-dialog.vala
@@ -31,19 +31,27 @@ private class PreferencesDialog : Gtk.Dialog
     [GtkChild]
     private Gtk.Scale contrast_scale;
     [GtkChild]
-    private Gtk.Scale page_delay_scale;
-    [GtkChild]
     private Gtk.ListStore device_model;
     [GtkChild]
+    private Gtk.RadioButton page_delay_3s_button;
+    [GtkChild]
+    private Gtk.RadioButton page_delay_5s_button;
+    [GtkChild]
+    private Gtk.RadioButton page_delay_7s_button;
+    [GtkChild]
+    private Gtk.RadioButton page_delay_10s_button;
+    [GtkChild]
+    private Gtk.RadioButton page_delay_15s_button;
+    [GtkChild]
     private Gtk.ListStore text_dpi_model;
     [GtkChild]
     private Gtk.ListStore photo_dpi_model;
     [GtkChild]
-    private Gtk.ToggleButton front_side_button;
+    private Gtk.RadioButton front_side_button;
     [GtkChild]
-    private Gtk.ToggleButton back_side_button;
+    private Gtk.RadioButton back_side_button;
     [GtkChild]
-    private Gtk.ToggleButton both_side_button;
+    private Gtk.RadioButton both_side_button;
     [GtkChild]
     private Gtk.ListStore paper_size_model;
     [GtkChild]
@@ -51,8 +59,6 @@ private class PreferencesDialog : Gtk.Dialog
     [GtkChild]
     private Gtk.Adjustment contrast_adjustment;
     [GtkChild]
-    private Gtk.Adjustment page_delay_adjustment;
-    [GtkChild]
     private Gtk.Button preferences_close_button;
 
     public PreferencesDialog (Settings settings, bool use_header_bar)
@@ -82,15 +88,6 @@ private class PreferencesDialog : Gtk.Dialog
         paper_size_model.append (out iter);
         paper_size_model.set (iter, 0, 1016, 1, 1524, 2, "4×6", -1);
 
-        page_delay_scale.add_mark (0, Gtk.PositionType.BOTTOM, null);
-        page_delay_scale.add_mark (500, Gtk.PositionType.BOTTOM, null);
-        page_delay_scale.add_mark (1000, Gtk.PositionType.BOTTOM, null);
-        page_delay_scale.add_mark (2000, Gtk.PositionType.BOTTOM, null);
-        page_delay_scale.add_mark (4000, Gtk.PositionType.BOTTOM, null);
-        page_delay_scale.add_mark (6000, Gtk.PositionType.BOTTOM, null);
-        page_delay_scale.add_mark (8000, Gtk.PositionType.BOTTOM, null);
-        page_delay_scale.add_mark (10000, Gtk.PositionType.BOTTOM, null);
-
         var renderer = new Gtk.CellRendererText ();
         device_combo.pack_start (renderer, true);
         device_combo.add_attribute (renderer, "text", 1);
@@ -147,8 +144,11 @@ private class PreferencesDialog : Gtk.Dialog
         });
 
         set_page_delay (settings.get_int ("page-delay"));
-        page_delay_scale.format_value.connect ((value) => { return "%.1fs".printf (value / 1000.0); });
-        page_delay_adjustment.value_changed.connect (() => { settings.set_int ("page-delay", get_page_delay 
()); });
+        page_delay_3s_button.toggled.connect ((button) => { if (button.active) settings.set_int 
("page-delay", 3); });
+        page_delay_5s_button.toggled.connect ((button) => { if (button.active) settings.set_int 
("page-delay", 5); });
+        page_delay_7s_button.toggled.connect ((button) => { if (button.active) settings.set_int 
("page-delay", 7); });
+        page_delay_10s_button.toggled.connect ((button) => { if (button.active) settings.set_int 
("page-delay", 10); });
+        page_delay_15s_button.toggled.connect ((button) => { if (button.active) settings.set_int 
("page-delay", 15); });
     }
 
     public void set_scan_devices (List<ScanDevice> devices)
@@ -398,12 +398,30 @@ private class PreferencesDialog : Gtk.Dialog
 
     public int get_page_delay ()
     {
-        return (int) page_delay_adjustment.value;
+        if (page_delay_15s_button.active)
+            return 15;
+        else if (page_delay_10s_button.active)
+            return 10;
+        else if (page_delay_7s_button.active)
+            return 7;
+        else if (page_delay_5s_button.active)
+            return 5;
+        else
+            return 3;
     }
 
     public void set_page_delay (int page_delay)
     {
-        page_delay_adjustment.value = page_delay;
+        if (page_delay >= 15)
+            page_delay_15s_button.active = true;
+        else if (page_delay >= 10)
+            page_delay_10s_button.active = true;
+        else if (page_delay >= 7)
+            page_delay_7s_button.active = true;
+        else if (page_delay >= 5)
+            page_delay_5s_button.active = true;
+        else
+            page_delay_3s_button.active = true;
     }
 
     private void set_dpi_combo (Gtk.ComboBox combo, int default_dpi, int current_dpi)



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