diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/app-window.ui | 974 | ||||
| -rw-r--r-- | src/app-window.vala | 420 | ||||
| -rw-r--r-- | src/authorize-dialog.ui | 32 | ||||
| -rw-r--r-- | src/book-view.vala | 5 | ||||
| -rw-r--r-- | src/book.vala | 2 | ||||
| -rw-r--r-- | src/config.vapi | 2 | ||||
| -rw-r--r-- | src/meson.build | 1 | ||||
| -rw-r--r-- | src/page-view.vala | 4 | ||||
| -rw-r--r-- | src/page.vala | 2 | ||||
| -rw-r--r-- | src/preferences-dialog.ui | 127 | ||||
| -rw-r--r-- | src/preferences-dialog.vala | 9 | ||||
| -rw-r--r-- | src/scan-type-adf-symbolic.svg | 9 | ||||
| -rw-r--r-- | src/scan-type-batch-symbolic.svg | 9 | ||||
| -rw-r--r-- | src/scanner.vala | 60 | ||||
| -rw-r--r-- | src/simple-scan.gresource.xml | 4 | ||||
| -rw-r--r-- | src/simple-scan.vala | 2 | 
16 files changed, 571 insertions, 1091 deletions
| diff --git a/src/app-window.ui b/src/app-window.ui index 6e13088..fbde173 100644 --- a/src/app-window.ui +++ b/src/app-window.ui @@ -2,624 +2,215 @@  <!-- Generated with glade 3.20.0 -->  <interface>    <requires lib="gtk+" version="3.12"/> -  <object class="GtkImage" id="email_image"> +  <object class="GtkMenu" id="page_menu">      <property name="visible">True</property> -    <property name="can_focus">False</property> -    <property name="icon_name">mail-send</property> -  </object> -  <object class="GtkImage" id="help_image"> -    <property name="visible">True</property> -    <property name="can_focus">False</property> -    <property name="stock">gtk-help</property> -  </object> -  <object class="GtkMenu" id="scan_button_hb_menu"> -    <property name="visible">True</property> -    <property name="can_focus">False</property>      <child> -      <object class="GtkMenuItem" id="scan_single_button_hb_menuitem"> +      <object class="GtkMenuItem" id="rotate_left_menuitem">          <property name="visible">True</property> -        <property name="can_focus">False</property> -        <property name="label" translatable="yes" comments="Toolbar scan menu item to scan a single page from the scanner">Single _Page</property> +        <property name="label" translatable="yes" comments="Menu item to rotate page to left (anti-clockwise)">Rotate _Left</property>          <property name="use_underline">True</property> -        <signal name="activate" handler="scan_button_clicked_cb" swapped="no"/> +        <signal name="activate" handler="rotate_left_button_clicked_cb" swapped="no"/> +        <accelerator key="bracketleft" signal="activate"/>        </object>      </child>      <child> -      <object class="GtkMenuItem" id="scan_all_button_hb_menuitem"> +      <object class="GtkMenuItem" id="rotate_right_menuitem">          <property name="visible">True</property> -        <property name="can_focus">False</property> -        <property name="label" translatable="yes" comments="Toolbar scan menu item to scan all pages from a document feeder">All Pages From _Feeder</property> +        <property name="label" translatable="yes" comments="Menu item to rotate page to right (clockwise)">Rotate _Right</property>          <property name="use_underline">True</property> -        <signal name="activate" handler="continuous_scan_button_clicked_cb" swapped="no"/> +        <signal name="activate" handler="rotate_right_button_clicked_cb" swapped="no"/> +        <accelerator key="bracketright" signal="activate"/>        </object>      </child>      <child> -      <object class="GtkMenuItem" id="batch_button_hb_menuitem"> +      <object class="GtkMenuItem" id="crop_menuitem">          <property name="visible">True</property> -        <property name="can_focus">False</property> -        <property name="label" translatable="yes" comments="Toolbar scan menu item to scan continuously from the flatbed">_Multiple Pages From Flatbed</property> +        <property name="label" translatable="yes" comments="Label for page crop submenu">_Crop</property>          <property name="use_underline">True</property> -        <signal name="activate" handler="batch_button_clicked_cb" swapped="no"/> -      </object> -    </child> -    <child> -      <object class="GtkSeparatorMenuItem" id="menuitem3"> -        <property name="visible">True</property> -        <property name="can_focus">False</property> -      </object> -    </child> -    <child> -      <object class="GtkRadioMenuItem" id="text_button_hb_menuitem"> -        <property name="visible">True</property> -        <property name="can_focus">False</property> -        <property name="label" translatable="yes">Text</property> -        <property name="use_underline">True</property> -        <property name="draw_as_radio">True</property> -        <signal name="toggled" handler="text_menuitem_toggled_cb" swapped="no"/> -      </object> -    </child> -    <child> -      <object class="GtkRadioMenuItem" id="photo_button_hb_menuitem"> -        <property name="visible">True</property> -        <property name="can_focus">False</property> -        <property name="label" translatable="yes">Photo</property> -        <property name="use_underline">True</property> -        <property name="active">True</property> -        <property name="draw_as_radio">True</property> -        <property name="group">text_button_hb_menuitem</property> -        <signal name="toggled" handler="photo_menuitem_toggled_cb" swapped="no"/> -      </object> -    </child> -  </object> -  <template class="AppWindow" parent="GtkApplicationWindow"> -    <property name="can_focus">False</property> -    <property name="title" translatable="yes" comments="Title of scan window">Simple Scan</property> -    <property name="icon_name">scanner</property> -    <signal name="delete-event" handler="window_delete_event_cb" swapped="no"/> -    <child> -      <object class="GtkBox"> -        <property name="visible">True</property> -        <property name="can_focus">False</property> -        <property name="orientation">vertical</property> -        <child> -          <object class="GtkMenuBar" id="menubar"> -            <property name="can_focus">False</property> +        <child type="submenu"> +          <object class="GtkMenu" id="crop_menu"> +            <property name="visible">True</property>              <child> -              <object class="GtkMenuItem" id="document_menuitem"> +              <object class="GtkRadioMenuItem" id="no_crop_menuitem">                  <property name="visible">True</property> -                <property name="can_focus">False</property> -                <property name="label" translatable="yes" comments="Label on document menu (contains actions for this document, e.g. save, print)">_Document</property> +                <property name="label" translatable="yes" comments="Radio button for no crop">_None</property>                  <property name="use_underline">True</property> -                <child type="submenu"> -                  <object class="GtkMenu" id="document_menu"> -                    <property name="visible">True</property> -                    <property name="can_focus">False</property> -                    <child> -                      <object class="GtkImageMenuItem" id="new_menuitem"> -                        <property name="label">gtk-new</property> -                        <property name="visible">True</property> -                        <property name="can_focus">False</property> -                        <property name="use_underline">True</property> -                        <property name="use_stock">True</property> -                        <signal name="activate" handler="new_button_clicked_cb" swapped="no"/> -                        <accelerator key="n" signal="activate" modifiers="GDK_CONTROL_MASK"/> -                      </object> -                    </child> -                    <child> -                      <object class="GtkImageMenuItem" id="scan_menuitem"> -                        <property name="label" translatable="yes" comments="Scan menu item">Sc_an</property> -                        <property name="visible">True</property> -                        <property name="can_focus">False</property> -                        <property name="use_underline">True</property> -                        <property name="use_stock">False</property> -                        <child type="submenu"> -                          <object class="GtkMenu" id="scan_menu"> -                            <property name="visible">True</property> -                            <property name="can_focus">False</property> -                            <child> -                              <object class="GtkMenuItem" id="scan_single_menuitem"> -                                <property name="visible">True</property> -                                <property name="can_focus">False</property> -                                <property name="label" translatable="yes" comments="Scan menu item to scan a single page from the scanner">Single _Page</property> -                                <property name="use_underline">True</property> -                                <signal name="activate" handler="scan_button_clicked_cb" swapped="no"/> -                                <accelerator key="1" signal="activate" modifiers="GDK_CONTROL_MASK"/> -                              </object> -                            </child> -                            <child> -                              <object class="GtkMenuItem" id="scan_all_menuitem"> -                                <property name="visible">True</property> -                                <property name="can_focus">False</property> -                                <property name="label" translatable="yes" comments="Scan menu item to scan all pages from a document feeder">All Pages From _Feeder</property> -                                <property name="use_underline">True</property> -                                <signal name="activate" handler="continuous_scan_button_clicked_cb" swapped="no"/> -                                <accelerator key="f" signal="activate" modifiers="GDK_CONTROL_MASK"/> -                              </object> -                            </child> -                            <child> -                              <object class="GtkMenuItem" id="batch_menuitem"> -                                <property name="visible">True</property> -                                <property name="can_focus">False</property> -                                <property name="label" translatable="yes" comments="Scan menu item to scan continuously from the flatbed">_Multiple Pages From Flatbed</property> -                                <property name="use_underline">True</property> -                                <signal name="activate" handler="batch_button_clicked_cb" swapped="no"/> -                                <accelerator key="m" signal="activate" modifiers="GDK_CONTROL_MASK"/> -                              </object> -                            </child> -                            <child> -                              <object class="GtkMenuItem" id="stop_scan_menuitem"> -                                <property name="visible">True</property> -                                <property name="sensitive">False</property> -                                <property name="can_focus">False</property> -                                <property name="label" translatable="yes" comments="Menu entry to stop current scan">_Stop Scan</property> -                                <property name="use_underline">True</property> -                                <signal name="activate" handler="stop_scan_button_clicked_cb" swapped="no"/> -                                <accelerator key="Escape" signal="activate"/> -                              </object> -                            </child> -                            <child> -                              <object class="GtkSeparatorMenuItem" id="menuitem2"> -                                <property name="visible">True</property> -                                <property name="can_focus">False</property> -                              </object> -                            </child> -                            <child> -                              <object class="GtkRadioMenuItem" id="text_menuitem"> -                                <property name="visible">True</property> -                                <property name="can_focus">False</property> -                                <property name="label" translatable="yes">Text</property> -                                <property name="use_underline">True</property> -                                <property name="draw_as_radio">True</property> -                                <signal name="toggled" handler="text_menuitem_toggled_cb" swapped="no"/> -                              </object> -                            </child> -                            <child> -                              <object class="GtkRadioMenuItem" id="photo_menuitem"> -                                <property name="visible">True</property> -                                <property name="can_focus">False</property> -                                <property name="label" translatable="yes">Photo</property> -                                <property name="use_underline">True</property> -                                <property name="active">True</property> -                                <property name="draw_as_radio">True</property> -                                <property name="group">text_menuitem</property> -                                <signal name="toggled" handler="photo_menuitem_toggled_cb" swapped="no"/> -                              </object> -                            </child> -                          </object> -                        </child> -                      </object> -                    </child> -                    <child> -                      <object class="GtkMenuItem" id="reorder_menuitem"> -                        <property name="visible">True</property> -                        <property name="can_focus">False</property> -                        <property name="label" translatable="yes" comments="Menu item to reorder pages">Reorder Pages</property> -                        <property name="use_underline">True</property> -                        <signal name="activate" handler="reorder_menuitem_activate_cb" swapped="no"/> -                      </object> -                    </child> -                    <child> -                      <object class="GtkImageMenuItem" id="save_menuitem"> -                        <property name="label">gtk-save</property> -                        <property name="visible">True</property> -                        <property name="sensitive">False</property> -                        <property name="can_focus">False</property> -                        <property name="use_underline">True</property> -                        <property name="use_stock">True</property> -                        <signal name="activate" handler="save_file_button_clicked_cb" swapped="no"/> -                        <accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/> -                      </object> -                    </child> -                    <child> -                      <object class="GtkImageMenuItem" id="email_menuitem"> -                        <property name="label" translatable="yes" comments="Label on email menu item">_Email</property> -                        <property name="visible">True</property> -                        <property name="sensitive">False</property> -                        <property name="can_focus">False</property> -                        <property name="use_underline">True</property> -                        <property name="image">email_image</property> -                        <property name="use_stock">False</property> -                        <signal name="activate" handler="email_button_clicked_cb" swapped="no"/> -                        <accelerator key="e" signal="activate" modifiers="GDK_CONTROL_MASK"/> -                      </object> -                    </child> -                    <child> -                      <object class="GtkImageMenuItem" id="print_menuitem"> -                        <property name="label">gtk-print</property> -                        <property name="visible">True</property> -                        <property name="sensitive">False</property> -                        <property name="can_focus">False</property> -                        <property name="use_underline">True</property> -                        <property name="use_stock">True</property> -                        <signal name="activate" handler="print_button_clicked_cb" swapped="no"/> -                        <accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> -                      </object> -                    </child> -                    <child> -                      <object class="GtkSeparatorMenuItem" id="document_sep_menuitem"> -                        <property name="visible">True</property> -                        <property name="can_focus">False</property> -                      </object> -                    </child> -                    <child> -                      <object class="GtkImageMenuItem" id="preferences_menuitem"> -                        <property name="label">gtk-preferences</property> -                        <property name="visible">True</property> -                        <property name="can_focus">False</property> -                        <property name="use_underline">True</property> -                        <property name="use_stock">True</property> -                        <signal name="activate" handler="preferences_button_clicked_cb" swapped="no"/> -                      </object> -                    </child> -                    <child> -                      <object class="GtkSeparatorMenuItem" id="separatormenuitem1"> -                        <property name="visible">True</property> -                        <property name="can_focus">False</property> -                      </object> -                    </child> -                    <child> -                      <object class="GtkImageMenuItem" id="quit_menuitem"> -                        <property name="label">gtk-quit</property> -                        <property name="visible">True</property> -                        <property name="can_focus">False</property> -                        <property name="use_underline">True</property> -                        <property name="use_stock">True</property> -                        <signal name="activate" handler="quit_menuitem_activate_cb" swapped="no"/> -                        <accelerator key="w" signal="activate" modifiers="GDK_CONTROL_MASK"/> -                        <accelerator key="q" signal="activate" modifiers="GDK_CONTROL_MASK"/> -                      </object> -                    </child> -                  </object> -                </child> +                <property name="active">True</property> +                <property name="draw_as_radio">True</property> +                <signal name="toggled" handler="no_crop_menuitem_toggled_cb" swapped="no"/>                </object>              </child>              <child> -              <object class="GtkMenuItem" id="page_menuitem"> +              <object class="GtkRadioMenuItem" id="a4_menuitem">                  <property name="visible">True</property> -                <property name="can_focus">False</property> -                <property name="label" translatable="yes" comments="Page menu (contains action for each page, e.g. delete, crop)">_Page</property> +                <property name="label" translatable="yes" comments="Radio button for cropping page to A4 size">A_4</property>                  <property name="use_underline">True</property> -                <child type="submenu"> -                  <object class="GtkMenu" id="page_menu"> -                    <property name="visible">True</property> -                    <property name="can_focus">False</property> -                    <child> -                      <object class="GtkMenuItem" id="rotate_left_menuitem"> -                        <property name="visible">True</property> -                        <property name="can_focus">False</property> -                        <property name="label" translatable="yes" comments="Menu item to rotate page to left (anti-clockwise)">Rotate _Left</property> -                        <property name="use_underline">True</property> -                        <signal name="activate" handler="rotate_left_button_clicked_cb" swapped="no"/> -                        <accelerator key="bracketleft" signal="activate"/> -                      </object> -                    </child> -                    <child> -                      <object class="GtkMenuItem" id="rotate_right_menuitem"> -                        <property name="visible">True</property> -                        <property name="can_focus">False</property> -                        <property name="label" translatable="yes" comments="Menu item to rotate page to right (clockwise)">Rotate _Right</property> -                        <property name="use_underline">True</property> -                        <signal name="activate" handler="rotate_right_button_clicked_cb" swapped="no"/> -                        <accelerator key="bracketright" signal="activate"/> -                      </object> -                    </child> -                    <child> -                      <object class="GtkMenuItem" id="crop_menuitem"> -                        <property name="visible">True</property> -                        <property name="can_focus">False</property> -                        <property name="label" translatable="yes" comments="Label for page crop submenu">_Crop</property> -                        <property name="use_underline">True</property> -                        <child type="submenu"> -                          <object class="GtkMenu" id="crop_menu"> -                            <property name="visible">True</property> -                            <property name="can_focus">False</property> -                            <child> -                              <object class="GtkRadioMenuItem" id="no_crop_menuitem"> -                                <property name="visible">True</property> -                                <property name="can_focus">False</property> -                                <property name="label" translatable="yes" comments="Radio button for no crop">_None</property> -                                <property name="use_underline">True</property> -                                <property name="active">True</property> -                                <property name="draw_as_radio">True</property> -                                <signal name="toggled" handler="no_crop_menuitem_toggled_cb" swapped="no"/> -                              </object> -                            </child> -                            <child> -                              <object class="GtkRadioMenuItem" id="a4_menuitem"> -                                <property name="visible">True</property> -                                <property name="can_focus">False</property> -                                <property name="label" translatable="yes" comments="Radio button for cropping page to A4 size">A_4</property> -                                <property name="use_underline">True</property> -                                <property name="draw_as_radio">True</property> -                                <property name="group">no_crop_menuitem</property> -                                <signal name="toggled" handler="a4_menuitem_toggled_cb" swapped="no"/> -                              </object> -                            </child> -                            <child> -                              <object class="GtkRadioMenuItem" id="a5_menuitem"> -                                <property name="visible">True</property> -                                <property name="can_focus">False</property> -                                <property name="label" translatable="yes" comments="Radio button for cropping page to A5 size">A_5</property> -                                <property name="use_underline">True</property> -                                <property name="draw_as_radio">True</property> -                                <property name="group">no_crop_menuitem</property> -                                <signal name="toggled" handler="a5_menuitem_toggled_cb" swapped="no"/> -                              </object> -                            </child> -                            <child> -                              <object class="GtkRadioMenuItem" id="a6_menuitem"> -                                <property name="visible">True</property> -                                <property name="can_focus">False</property> -                                <property name="label" translatable="yes" comments="Radio button for cropping page to A6 size">A_6</property> -                                <property name="use_underline">True</property> -                                <property name="draw_as_radio">True</property> -                                <property name="group">no_crop_menuitem</property> -                                <signal name="toggled" handler="a6_menuitem_toggled_cb" swapped="no"/> -                              </object> -                            </child> -                            <child> -                              <object class="GtkRadioMenuItem" id="letter_menuitem"> -                                <property name="visible">True</property> -                                <property name="can_focus">False</property> -                                <property name="label" translatable="yes" comments="Radio button for cropping page to US letter size">_Letter</property> -                                <property name="use_underline">True</property> -                                <property name="draw_as_radio">True</property> -                                <property name="group">no_crop_menuitem</property> -                                <signal name="toggled" handler="letter_menuitem_toggled_cb" swapped="no"/> -                              </object> -                            </child> -                            <child> -                              <object class="GtkRadioMenuItem" id="legal_menuitem"> -                                <property name="visible">True</property> -                                <property name="can_focus">False</property> -                                <property name="label" translatable="yes" comments="Radio button for cropping to page to US legal size">Le_gal</property> -                                <property name="use_underline">True</property> -                                <property name="draw_as_radio">True</property> -                                <property name="group">no_crop_menuitem</property> -                                <signal name="toggled" handler="legal_menuitem_toggled_cb" swapped="no"/> -                              </object> -                            </child> -                            <child> -                              <object class="GtkRadioMenuItem" id="four_by_six_menuitem"> -                                <property name="visible">True</property> -                                <property name="can_focus">False</property> -                                <property name="label" translatable="yes" comments="Radio button for cropping page to 4x6 inch">4×6</property> -                                <property name="use_underline">True</property> -                                <property name="draw_as_radio">True</property> -                                <property name="group">no_crop_menuitem</property> -                                <signal name="toggled" handler="four_by_six_menuitem_toggled_cb" swapped="no"/> -                              </object> -                            </child> -                            <child> -                              <object class="GtkRadioMenuItem" id="a3_menuitem"> -                                <property name="visible">True</property> -                                <property name="can_focus">False</property> -                                <property name="label" translatable="yes" comments="Radio button for cropping page to A3">A_3</property> -                                <property name="use_underline">True</property> -                                <property name="draw_as_radio">True</property> -                                <property name="group">no_crop_menuitem</property> -                                <signal name="toggled" handler="a3_menuitem_toggled_cb" swapped="no"/> -                              </object> -                            </child> -                            <child> -                              <object class="GtkRadioMenuItem" id="custom_crop_menuitem"> -                                <property name="visible">True</property> -                                <property name="can_focus">False</property> -                                <property name="label" translatable="yes" comments="Radio button for cropping to custom page size">_Custom</property> -                                <property name="use_underline">True</property> -                                <property name="draw_as_radio">True</property> -                                <property name="group">no_crop_menuitem</property> -                                <signal name="toggled" handler="custom_crop_menuitem_toggled_cb" swapped="no"/> -                              </object> -                            </child> -                            <child> -                              <object class="GtkSeparatorMenuItem" id="crop_sep_menuitem"> -                                <property name="visible">True</property> -                                <property name="can_focus">False</property> -                              </object> -                            </child> -                            <child> -                              <object class="GtkMenuItem" id="crop_rotate_menuitem"> -                                <property name="visible">True</property> -                                <property name="sensitive">False</property> -                                <property name="can_focus">False</property> -                                <property name="label" translatable="yes" comments="Menu item to rotate the crop area">_Rotate Crop</property> -                                <property name="use_underline">True</property> -                                <signal name="activate" handler="crop_rotate_menuitem_activate_cb" swapped="no"/> -                              </object> -                            </child> -                          </object> -                        </child> -                      </object> -                    </child> -                    <child> -                      <object class="GtkMenuItem" id="page_move_left_menuitem"> -                        <property name="visible">True</property> -                        <property name="can_focus">False</property> -                        <property name="label" translatable="yes" comments="Menu item to move the selected page to the left">Move Left</property> -                        <signal name="activate" handler="page_move_left_menuitem_activate_cb" swapped="no"/> -                        <accelerator key="less" signal="activate"/> -                      </object> -                    </child> -                    <child> -                      <object class="GtkMenuItem" id="page_move_right_menuitem"> -                        <property name="visible">True</property> -                        <property name="can_focus">False</property> -                        <property name="label" translatable="yes" comments="Menu item to move the selected page to the right">Move Right</property> -                        <property name="use_underline">True</property> -                        <signal name="activate" handler="page_move_right_menuitem_activate_cb" swapped="no"/> -                        <accelerator key="greater" signal="activate"/> -                      </object> -                    </child> -                    <child> -                      <object class="GtkImageMenuItem" id="copy_to_clipboard_menuitem"> -                        <property name="label">gtk-copy</property> -                        <property name="visible">True</property> -                        <property name="sensitive">False</property> -                        <property name="can_focus">False</property> -                        <property name="use_underline">True</property> -                        <property name="use_stock">True</property> -                        <signal name="activate" handler="copy_to_clipboard_button_clicked_cb" swapped="no"/> -                        <accelerator key="c" signal="activate" modifiers="GDK_CONTROL_MASK"/> -                      </object> -                    </child> -                    <child> -                      <object class="GtkImageMenuItem" id="page_delete_menuitem"> -                        <property name="label">gtk-delete</property> -                        <property name="visible">True</property> -                        <property name="can_focus">False</property> -                        <property name="use_underline">True</property> -                        <property name="use_stock">True</property> -                        <signal name="activate" handler="page_delete_menuitem_activate_cb" swapped="no"/> -                        <accelerator key="Delete" signal="activate"/> -                      </object> -                    </child> -                  </object> -                </child> +                <property name="draw_as_radio">True</property> +                <property name="group">no_crop_menuitem</property> +                <signal name="toggled" handler="a4_menuitem_toggled_cb" swapped="no"/>                </object>              </child>              <child> -              <object class="GtkMenuItem" id="help_menuitem"> +              <object class="GtkRadioMenuItem" id="a5_menuitem">                  <property name="visible">True</property> -                <property name="can_focus">False</property> -                <property name="label" translatable="yes" comments="Label on help menu">_Help</property> +                <property name="label" translatable="yes" comments="Radio button for cropping page to A5 size">A_5</property>                  <property name="use_underline">True</property> -                <child type="submenu"> -                  <object class="GtkMenu" id="help_menu"> -                    <property name="visible">True</property> -                    <property name="can_focus">False</property> -                    <child> -                      <object class="GtkImageMenuItem" id="help_contents_menuitem"> -                        <property name="label" translatable="yes" comments="Help|Contents menu">_Contents</property> -                        <property name="visible">True</property> -                        <property name="can_focus">False</property> -                        <property name="use_underline">True</property> -                        <property name="image">help_image</property> -                        <property name="use_stock">False</property> -                        <signal name="activate" handler="help_contents_menuitem_activate_cb" swapped="no"/> -                        <accelerator key="F1" signal="activate"/> -                      </object> -                    </child> -                    <child> -                      <object class="GtkImageMenuItem" id="about_menuitem"> -                        <property name="label">gtk-about</property> -                        <property name="visible">True</property> -                        <property name="can_focus">False</property> -                        <property name="use_underline">True</property> -                        <property name="use_stock">True</property> -                        <signal name="activate" handler="about_menuitem_activate_cb" swapped="no"/> -                      </object> -                    </child> -                  </object> -                </child> +                <property name="draw_as_radio">True</property> +                <property name="group">no_crop_menuitem</property> +                <signal name="toggled" handler="a5_menuitem_toggled_cb" swapped="no"/>                </object>              </child> -          </object> -          <packing> -            <property name="expand">False</property> -            <property name="fill">True</property> -            <property name="position">0</property> -          </packing> -        </child> -        <child> -          <object class="GtkToolbar" id="toolbar"> -            <property name="can_focus">False</property>              <child> -              <object class="GtkMenuToolButton" id="scan_toolbutton"> +              <object class="GtkRadioMenuItem" id="a6_menuitem">                  <property name="visible">True</property> -                <property name="can_focus">False</property> -                <property name="tooltip_text" translatable="yes" comments="Tooltip for scan toolbar button">Scan a single page from the scanner</property> -                <property name="is_important">True</property> -                <property name="label" translatable="yes" comments="Label on scan toolbar item">Scan</property> +                <property name="label" translatable="yes" comments="Radio button for cropping page to A6 size">A_6</property>                  <property name="use_underline">True</property> -                <property name="icon_name">scanner</property> -                <property name="menu">scan_button_menu</property> -                <signal name="clicked" handler="scan_button_clicked_cb" swapped="no"/> +                <property name="draw_as_radio">True</property> +                <property name="group">no_crop_menuitem</property> +                <signal name="toggled" handler="a6_menuitem_toggled_cb" swapped="no"/>                </object> -              <packing> -                <property name="expand">False</property> -                <property name="homogeneous">False</property> -              </packing>              </child>              <child> -              <object class="GtkToolButton" id="save_toolbutton"> +              <object class="GtkRadioMenuItem" id="letter_menuitem">                  <property name="visible">True</property> -                <property name="sensitive">False</property> -                <property name="can_focus">False</property> -                <property name="tooltip_text" translatable="yes" comments="Tooltip for save toolbar button">Save document to a file</property> -                <property name="is_important">True</property> -                <property name="label" translatable="yes">Save</property> +                <property name="label" translatable="yes" comments="Radio button for cropping page to US letter size">_Letter</property>                  <property name="use_underline">True</property> -                <property name="stock_id">gtk-save</property> -                <signal name="clicked" handler="save_file_button_clicked_cb" swapped="no"/> +                <property name="draw_as_radio">True</property> +                <property name="group">no_crop_menuitem</property> +                <signal name="toggled" handler="letter_menuitem_toggled_cb" swapped="no"/> +              </object> +            </child> +            <child> +              <object class="GtkRadioMenuItem" id="legal_menuitem"> +                <property name="visible">True</property> +                <property name="label" translatable="yes" comments="Radio button for cropping to page to US legal size">Le_gal</property> +                <property name="use_underline">True</property> +                <property name="draw_as_radio">True</property> +                <property name="group">no_crop_menuitem</property> +                <signal name="toggled" handler="legal_menuitem_toggled_cb" swapped="no"/> +              </object> +            </child> +            <child> +              <object class="GtkRadioMenuItem" id="four_by_six_menuitem"> +                <property name="visible">True</property> +                <property name="label" translatable="yes" comments="Radio button for cropping page to 4x6 inch">4×6</property> +                <property name="use_underline">True</property> +                <property name="draw_as_radio">True</property> +                <property name="group">no_crop_menuitem</property> +                <signal name="toggled" handler="four_by_six_menuitem_toggled_cb" swapped="no"/> +              </object> +            </child> +            <child> +              <object class="GtkRadioMenuItem" id="a3_menuitem"> +                <property name="visible">True</property> +                <property name="label" translatable="yes" comments="Radio button for cropping page to A3">A_3</property> +                <property name="use_underline">True</property> +                <property name="draw_as_radio">True</property> +                <property name="group">no_crop_menuitem</property> +                <signal name="toggled" handler="a3_menuitem_toggled_cb" swapped="no"/>                </object> -              <packing> -                <property name="expand">False</property> -                <property name="homogeneous">True</property> -              </packing>              </child>              <child> -              <object class="GtkToolButton" id="stop_toolbutton"> +              <object class="GtkRadioMenuItem" id="custom_crop_menuitem"> +                <property name="visible">True</property> +                <property name="label" translatable="yes" comments="Radio button for cropping to custom page size">_Custom</property> +                <property name="use_underline">True</property> +                <property name="draw_as_radio">True</property> +                <property name="group">no_crop_menuitem</property> +                <signal name="toggled" handler="custom_crop_menuitem_toggled_cb" swapped="no"/> +              </object> +            </child> +            <child> +              <object class="GtkSeparatorMenuItem" id="crop_sep_menuitem"> +                <property name="visible">True</property> +              </object> +            </child> +            <child> +              <object class="GtkMenuItem" id="crop_rotate_menuitem">                  <property name="visible">True</property>                  <property name="sensitive">False</property> -                <property name="can_focus">False</property> -                <property name="tooltip_text" translatable="yes" comments="Tooltip for stop button">Stop the current scan</property> -                <property name="label" translatable="yes">Stop</property> +                <property name="label" translatable="yes" comments="Menu item to rotate the crop area">_Rotate Crop</property>                  <property name="use_underline">True</property> -                <property name="stock_id">gtk-stop</property> -                <signal name="clicked" handler="stop_scan_button_clicked_cb" swapped="no"/> +                <signal name="activate" handler="crop_rotate_menuitem_activate_cb" swapped="no"/>                </object> -              <packing> -                <property name="expand">False</property> -                <property name="homogeneous">True</property> -              </packing>              </child> -            <style> -              <class name="primary-toolbar"/> -            </style>            </object> -          <packing> -            <property name="expand">False</property> -            <property name="fill">True</property> -            <property name="position">1</property> -          </packing>          </child> +      </object> +    </child> +    <child> +      <object class="GtkMenuItem" id="page_move_left_menuitem"> +        <property name="visible">True</property> +        <property name="label" translatable="yes" comments="Menu item to move the selected page to the left">Move Left</property> +        <signal name="activate" handler="page_move_left_menuitem_activate_cb" swapped="no"/> +        <accelerator key="less" signal="activate"/> +      </object> +    </child> +    <child> +      <object class="GtkMenuItem" id="page_move_right_menuitem"> +        <property name="visible">True</property> +        <property name="label" translatable="yes" comments="Menu item to move the selected page to the right">Move Right</property> +        <property name="use_underline">True</property> +        <signal name="activate" handler="page_move_right_menuitem_activate_cb" swapped="no"/> +        <accelerator key="greater" signal="activate"/> +      </object> +    </child> +    <child> +      <object class="GtkImageMenuItem" id="copy_to_clipboard_menuitem"> +        <property name="label">gtk-copy</property> +        <property name="visible">True</property> +        <property name="sensitive">False</property> +        <property name="use_underline">True</property> +        <property name="use_stock">True</property> +        <signal name="activate" handler="copy_to_clipboard_button_clicked_cb" swapped="no"/> +        <accelerator key="c" signal="activate" modifiers="GDK_CONTROL_MASK"/> +      </object> +    </child> +    <child> +      <object class="GtkImageMenuItem" id="page_delete_menuitem"> +        <property name="label">gtk-delete</property> +        <property name="visible">True</property> +        <property name="use_underline">True</property> +        <property name="use_stock">True</property> +        <signal name="activate" handler="page_delete_menuitem_activate_cb" swapped="no"/> +        <accelerator key="Delete" signal="activate"/> +      </object> +    </child> +  </object> +  <template class="AppWindow" parent="GtkApplicationWindow"> +    <property name="title" translatable="yes" comments="Title of scan window">Simple Scan</property> +    <property name="icon_name">org.gnome.SimpleScan</property> +    <signal name="delete-event" handler="window_delete_event_cb" swapped="no"/> +    <child> +      <object class="GtkBox"> +        <property name="visible">True</property> +        <property name="orientation">vertical</property>          <child>            <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> -                <property name="can_focus">False</property>                  <property name="xscale">0</property>                  <property name="yscale">0</property>                  <child>                    <object class="GtkBox">                      <property name="visible">True</property> -                    <property name="can_focus">False</property>                      <property name="orientation">vertical</property>                      <property name="spacing">10</property>                      <child>                        <object class="GtkImage">                          <property name="visible">True</property> -                        <property name="can_focus">False</property>                          <property name="opacity">0.5</property>                          <property name="pixel_size">120</property> -                        <property name="icon_name">scanner-symbolic</property> +                        <property name="icon_name">org.gnome.SimpleScan-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">                          <property name="visible">True</property> -                        <property name="can_focus">False</property> -                        <property name="label" translatable="yes" comments="Label shown when searching for scanners">Searching for Scanners…</property>                          <attributes>                            <attribute name="weight" value="bold"/>                            <attribute name="scale" value="1.5"/> @@ -628,27 +219,16 @@                            <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">                          <property name="visible">False</property> -                        <property name="can_focus">False</property>                          <property name="track_visited_links">False</property>                          <signal name="activate_link" handler="status_label_activate_link_cb" swapped="no"/>                          <style>                            <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> @@ -660,53 +240,36 @@              <child>                <object class="GtkBox" id="main_vbox">                  <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>      <child type="titlebar">        <object class="GtkHeaderBar" id="header_bar">          <property name="visible">True</property> -        <property name="can_focus">False</property>          <property name="vexpand">True</property>          <property name="show_close_button">True</property>          <child>            <object class="GtkBox" id="open_box">              <property name="visible">True</property> -            <property name="can_focus">False</property>              <property name="valign">center</property>              <child>                <object class="GtkButton" id="stop_button">                  <property name="label" translatable="yes">Stop</property> -                <property name="can_focus">False</property>                  <property name="receives_default">False</property>                  <property name="tooltip_text" translatable="yes" comments="Tooltip for stop button">Stop the current scan</property>                  <property name="use_underline">True</property> @@ -716,17 +279,11 @@                    <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">                  <property name="label" translatable="yes" comments="Label on scan toolbar item">Scan</property>                  <property name="visible">True</property> -                <property name="can_focus">False</property>                  <property name="receives_default">False</property>                  <property name="tooltip_text" translatable="yes" comments="Tooltip for scan toolbar button">Scan a single page from the scanner</property>                  <property name="use_underline">True</property> @@ -736,30 +293,31 @@                    <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" id="open_button"> +              <object class="GtkMenuButton">                  <property name="visible">True</property> -                <property name="can_focus">False</property>                  <property name="receives_default">False</property> -                <property name="popup">scan_button_hb_menu</property> +                <property name="popover">scan_options_popover</property>                  <child> -                  <placeholder/> +                  <object class="GtkBox"> +                    <property name="visible">True</property> +                    <property name="spacing">6</property> +                    <child> +                      <object class="GtkImage" id="scan_options_image"> +                        <property name="visible">True</property> +                        <property name="icon_name">scanner-symbolic</property> +                      </object> +                    </child> +                    <child> +                      <object class="GtkImage"> +                        <property name="visible">True</property> +                        <property name="icon_name">pan-down-symbolic</property> +                      </object> +                    </child> +                  </object>                  </child> -                <style> -                  <class name="text-button"/> -                </style>                </object> -              <packing> -                <property name="expand">False</property> -                <property name="fill">True</property> -                <property name="position">2</property> -              </packing>              </child>              <style>                <class name="linked"/> @@ -769,13 +327,11 @@          <child>            <object class="GtkMenuButton" id="menu_button">              <property name="visible">True</property> -            <property name="can_focus">False</property>              <property name="receives_default">False</property>              <property name="use_underline">True</property>              <child>                <object class="GtkImage">                  <property name="visible">True</property> -                <property name="can_focus">False</property>                  <property name="icon_name">open-menu-symbolic</property>                  <property name="icon_size">1</property>                </object> @@ -786,14 +342,12 @@            </object>            <packing>              <property name="pack_type">end</property> -            <property name="position">2</property>            </packing>          </child>          <child>            <object class="GtkButton" id="save_button">              <property name="visible">True</property>              <property name="sensitive">False</property> -            <property name="can_focus">False</property>              <property name="receives_default">False</property>              <property name="tooltip_text" translatable="yes" comments="Tooltip for save toolbar button">Save document to a file</property>              <property name="use_underline">True</property> @@ -801,7 +355,6 @@              <child>                <object class="GtkImage" id="save_image">                  <property name="visible">True</property> -                <property name="can_focus">False</property>                  <property name="icon_name">document-save-symbolic</property>                  <property name="icon_size">1</property>                </object> @@ -812,7 +365,6 @@            </object>            <packing>              <property name="pack_type">end</property> -            <property name="position">3</property>            </packing>          </child>          <style> @@ -821,63 +373,169 @@        </object>      </child>    </template> -  <object class="GtkMenu" id="scan_button_menu"> -    <property name="visible">True</property> -    <property name="can_focus">False</property> -    <child> -      <object class="GtkMenuItem" id="scan_single_button_menuitem"> -        <property name="visible">True</property> -        <property name="can_focus">False</property> -        <property name="label" translatable="yes" comments="Toolbar scan menu item to scan a single page from the scanner">Single _Page</property> -        <property name="use_underline">True</property> -        <signal name="activate" handler="scan_button_clicked_cb" swapped="no"/> -      </object> -    </child> -    <child> -      <object class="GtkMenuItem" id="scan_all_button_menuitem"> -        <property name="visible">True</property> -        <property name="can_focus">False</property> -        <property name="label" translatable="yes" comments="Toolbar scan menu item to scan all pages from a document feeder">All Pages From _Feeder</property> -        <property name="use_underline">True</property> -        <signal name="activate" handler="continuous_scan_button_clicked_cb" swapped="no"/> -      </object> -    </child> -    <child> -      <object class="GtkMenuItem" id="batch_button_menuitem"> -        <property name="visible">True</property> -        <property name="can_focus">False</property> -        <property name="label" translatable="yes" comments="Toolbar scan menu item to scan continuously from the flatbed">_Multiple Pages From Flatbed</property> -        <property name="use_underline">True</property> -        <signal name="activate" handler="batch_button_clicked_cb" swapped="no"/> -      </object> -    </child> -    <child> -      <object class="GtkSeparatorMenuItem" id="menuitem1"> -        <property name="visible">True</property> -        <property name="can_focus">False</property> -      </object> -    </child> -    <child> -      <object class="GtkRadioMenuItem" id="text_button_menuitem"> -        <property name="visible">True</property> -        <property name="can_focus">False</property> -        <property name="label" translatable="yes">Text</property> -        <property name="use_underline">True</property> -        <property name="draw_as_radio">True</property> -        <signal name="toggled" handler="text_menuitem_toggled_cb" swapped="no"/> -      </object> -    </child> +  <object class="GtkPopover" id="scan_options_popover">      <child> -      <object class="GtkRadioMenuItem" id="photo_button_menuitem"> +      <object class="GtkBox">          <property name="visible">True</property> -        <property name="can_focus">False</property> -        <property name="label" translatable="yes">Photo</property> -        <property name="use_underline">True</property> -        <property name="active">True</property> -        <property name="draw_as_radio">True</property> -        <property name="group">text_button_menuitem</property> -        <signal name="toggled" handler="photo_menuitem_toggled_cb" swapped="no"/> +        <property name="orientation">vertical</property> +        <property name="margin">12</property> +        <property name="spacing">6</property> +        <child> +          <object class="GtkRadioButton" id="scan_single_radio"> +            <property name="visible">True</property> +            <property name="draw_indicator">False</property> +            <signal name="toggled" handler="scan_single_radio_toggled_cb" swapped="no"/> +            <child> +              <object class="GtkBox"> +                <property name="visible">True</property> +                <property name="spacing">12</property> +                <property name="margin_start">12</property> +                <property name="margin_end">12</property> +                <property name="margin_top">6</property> +                <property name="margin_bottom">6</property> +                <child> +                  <object class="GtkImage"> +                    <property name="visible">True</property> +                    <property name="icon_name">scanner-symbolic</property> +                  </object> +                </child> +                <child> +                  <object class="GtkLabel"> +                    <property name="visible">True</property> +                    <property name="label" translatable="yes">_Single Page</property> +                    <property name="use_underline">True</property> +                  </object> +                </child> +              </object> +            </child> +          </object> +        </child> +        <child> +          <object class="GtkRadioButton" id="scan_adf_radio"> +            <property name="visible">True</property> +            <property name="draw_indicator">False</property> +            <property name="group">scan_single_radio</property> +            <signal name="toggled" handler="scan_adf_radio_toggled_cb" swapped="no"/> +            <child> +              <object class="GtkBox"> +                <property name="visible">True</property> +                <property name="spacing">12</property> +                <property name="margin_start">12</property> +                <property name="margin_end">12</property> +                <property name="margin_top">6</property> +                <property name="margin_bottom">6</property> +                <child> +                  <object class="GtkImage"> +                    <property name="visible">True</property> +                    <property name="icon_name">scan-type-adf-symbolic</property> +                  </object> +                </child> +                <child> +                  <object class="GtkLabel"> +                    <property name="visible">True</property> +                    <property name="label" translatable="yes">All Pages From _Feeder</property> +                    <property name="use_underline">True</property> +                  </object> +                </child> +              </object> +            </child> +          </object> +        </child> +        <child> +          <object class="GtkRadioButton" id="scan_batch_radio"> +            <property name="visible">True</property> +            <property name="draw_indicator">False</property> +            <property name="group">scan_single_radio</property> +            <signal name="toggled" handler="scan_batch_radio_toggled_cb" swapped="no"/> +            <child> +              <object class="GtkBox"> +                <property name="visible">True</property> +                <property name="spacing">12</property> +                <property name="margin_start">12</property> +                <property name="margin_end">12</property> +                <property name="margin_top">6</property> +                <property name="margin_bottom">6</property> +                <child> +                  <object class="GtkImage"> +                    <property name="visible">True</property> +                    <property name="icon_name">scan-type-batch-symbolic</property> +                  </object> +                </child> +                <child> +                  <object class="GtkLabel"> +                    <property name="visible">True</property> +                    <property name="label" translatable="yes">_Multiple Pages From Flatbed</property> +                    <property name="use_underline">True</property> +                  </object> +                </child> +              </object> +            </child> +          </object> +        </child> +        <child> +          <object class="GtkRadioButton" id="text_radio"> +            <property name="visible">True</property> +            <property name="draw_indicator">False</property> +            <property name="margin_top">12</property> +            <signal name="toggled" handler="text_radio_toggled_cb" swapped="no"/> +            <child> +              <object class="GtkBox"> +                <property name="visible">True</property> +                <property name="spacing">12</property> +                <property name="margin_start">12</property> +                <property name="margin_end">12</property> +                <property name="margin_top">6</property> +                <property name="margin_bottom">6</property> +                <child> +                  <object class="GtkImage"> +                    <property name="visible">True</property> +                    <property name="icon_name">text-x-generic-symbolic</property> +                  </object> +                </child> +                <child> +                  <object class="GtkLabel"> +                    <property name="visible">True</property> +                    <property name="label" translatable="yes">_Text</property> +                    <property name="use_underline">True</property> +                  </object> +                </child> +              </object> +            </child> +          </object> +        </child> +        <child> +          <object class="GtkRadioButton" id="photo_radio"> +            <property name="visible">True</property> +            <property name="draw_indicator">False</property> +            <property name="group">text_radio</property> +            <signal name="toggled" handler="photo_radio_toggled_cb" swapped="no"/> +            <child> +              <object class="GtkBox"> +                <property name="visible">True</property> +                <property name="spacing">12</property> +                <property name="margin_start">12</property> +                <property name="margin_end">12</property> +                <property name="margin_top">6</property> +                <property name="margin_bottom">6</property> +                <child> +                  <object class="GtkImage"> +                    <property name="visible">True</property> +                    <property name="icon_name">image-x-generic-symbolic</property> +                  </object> +                </child> +                <child> +                  <object class="GtkLabel"> +                    <property name="visible">True</property> +                    <property name="label" translatable="yes">_Image</property> +                    <property name="use_underline">True</property> +                  </object> +                </child> +              </object> +            </child> +          </object> +        </child>        </object>      </child>    </object>  </interface> + diff --git a/src/app-window.vala b/src/app-window.vala index 67c882c..efcaaf2 100644 --- a/src/app-window.vala +++ b/src/app-window.vala @@ -18,28 +18,25 @@ public class AppWindow : Gtk.ApplicationWindow  {      private const GLib.ActionEntry[] action_entries =      { -        { "new_document", new_document_activate_cb }, -        { "reorder", reorder_document_activate_cb }, +        { "new_document", new_document_cb }, +        { "reorder", reorder_document_cb },          { "save", save_document_activate_cb }, -        { "email", email_document_activate_cb }, -        { "print", print_document_activate_cb }, -        { "preferences", preferences_activate_cb }, -        { "help", help_contents_activate_cb }, -        { "about", about_activate_cb }, -        { "quit", quit_activate_cb } +        { "email", email_document_cb }, +        { "print", print_document_cb }, +        { "preferences", preferences_cb }, +        { "help", help_cb }, +        { "about", about_cb }, +        { "quit", quit_cb }      };      private Settings settings; +    private ScanType scan_type = ScanType.SINGLE;      private PreferencesDialog preferences_dialog;      [GtkChild]      private Gtk.HeaderBar header_bar;      [GtkChild] -    private Gtk.MenuBar menubar; -    [GtkChild] -    private Gtk.Toolbar toolbar; -    [GtkChild]      private Gtk.Menu page_menu;      [GtkChild]      private Gtk.Stack stack; @@ -76,22 +73,10 @@ public class AppWindow : Gtk.ApplicationWindow      [GtkChild]      private Gtk.MenuItem crop_rotate_menuitem;      [GtkChild] -    private Gtk.MenuItem save_menuitem; -    [GtkChild] -    private Gtk.MenuItem email_menuitem; -    [GtkChild] -    private Gtk.MenuItem print_menuitem; -    [GtkChild]      private Gtk.MenuItem copy_to_clipboard_menuitem;      [GtkChild]      private Gtk.Button save_button;      [GtkChild] -    private Gtk.ToolButton save_toolbutton; -    [GtkChild] -    private Gtk.MenuItem stop_scan_menuitem; -    [GtkChild] -    private Gtk.ToolButton stop_toolbutton; -    [GtkChild]      private Gtk.Button stop_button;      [GtkChild]      private Gtk.Button scan_button; @@ -101,25 +86,24 @@ public class AppWindow : Gtk.ApplicationWindow      private Gtk.Button delete_button;      [GtkChild] -    private Gtk.RadioMenuItem text_button_menuitem; +    private Gtk.Image scan_options_image;      [GtkChild] -    private Gtk.RadioMenuItem text_button_hb_menuitem; +    private Gtk.RadioButton scan_single_radio;      [GtkChild] -    private Gtk.RadioMenuItem text_menuitem; +    private Gtk.RadioButton scan_adf_radio;      [GtkChild] -    private Gtk.RadioMenuItem photo_button_menuitem; +    private Gtk.RadioButton scan_batch_radio;      [GtkChild] -    private Gtk.RadioMenuItem photo_button_hb_menuitem; +    private Gtk.RadioButton text_radio;      [GtkChild] -    private Gtk.RadioMenuItem photo_menuitem; +    private Gtk.RadioButton photo_radio;      [GtkChild]      private Gtk.MenuButton menu_button; +    private bool have_devices = false;      private string? missing_driver = null; -    private Gtk.FileChooserDialog? save_dialog; -      public Book book { get; private set; }      private bool book_needs_saving;      private string? book_uri = null; @@ -153,8 +137,6 @@ public class AppWindow : Gtk.ApplicationWindow              stack.set_visible_child_name ("document");              page_delete_menuitem.sensitive = !value;              delete_button.sensitive = !value; -            stop_scan_menuitem.sensitive = value; -            stop_toolbutton.sensitive = value;              scan_button.visible = !value;              stop_button.visible = value;          } @@ -256,20 +238,22 @@ public class AppWindow : Gtk.ApplicationWindow          password = authorize_dialog.get_password ();      } -    public void set_scan_devices (List<ScanDevice> devices, string? missing_driver = null) +    private void update_scan_status ()      { -        this.missing_driver = missing_driver; - -        preferences_dialog.set_scan_devices (devices); - -        if (devices != null) +        if (!have_devices) +        { +            status_primary_label.set_text (/* Label shown when searching for scanners */ +                                           _("Searching for Scanners…")); +            status_secondary_label.visible = false; +        } +        else if (selected_device != null)          {              status_primary_label.set_text (/* Label shown when detected a scanner */                                             _("Ready to Scan"));              status_secondary_label.set_text (preferences_dialog.get_selected_device_label ());              status_secondary_label.visible = true;          } -        else if (missing_driver != null) +        else if (this.missing_driver != null)          {              status_primary_label.set_text (/* Warning displayed when no drivers are installed but a compatible scanner is detected */                                             _("Additional software needed")); @@ -287,7 +271,15 @@ public class AppWindow : Gtk.ApplicationWindow          }      } -    private string choose_file_location () +    public void set_scan_devices (List<ScanDevice> devices, string? missing_driver = null) +    { +        have_devices = true; +        this.missing_driver = missing_driver; +        preferences_dialog.set_scan_devices (devices); +        update_scan_status (); +    } + +    private string? choose_file_location ()      {          /* Get directory to save to */          string? directory = null; @@ -296,13 +288,12 @@ public class AppWindow : Gtk.ApplicationWindow          if (directory == null || directory == "")              directory = Environment.get_user_special_dir (UserDirectory.DOCUMENTS); -        save_dialog = new Gtk.FileChooserDialog (/* Save dialog: Dialog title */ -                                                 _("Save As…"), -                                                 this, -                                                 Gtk.FileChooserAction.SAVE, -                                                 _("_Cancel"), Gtk.ResponseType.CANCEL, -                                                 _("_Save"), Gtk.ResponseType.ACCEPT, -                                                 null); +        var save_dialog = new Gtk.FileChooserNative (/* Save dialog: Dialog title */ +                                                     _("Save As…"), +                                                     this, +                                                     Gtk.FileChooserAction.SAVE, +                                                     _("_Save"), +                                                     _("_Cancel"));          save_dialog.local_only = false;          if (book_uri != null)              save_dialog.set_uri (book_uri); @@ -365,18 +356,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); @@ -388,7 +379,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 (() => @@ -412,12 +403,14 @@ public class AppWindow : Gtk.ApplicationWindow              quality_scale.visible = quality_label.visible = (extension != ".png");          }); -        string? uri = null;          while (true)          {              var response = save_dialog.run ();              if (response != Gtk.ResponseType.ACCEPT) -                break; +            { +                save_dialog.destroy (); +                return null; +            }              var extension = "";              Gtk.TreeIter i; @@ -431,7 +424,7 @@ public class AppWindow : Gtk.ApplicationWindow              if (extension_index < 0)                  path += extension; -            uri = File.new_for_path (path).get_uri (); +            var uri = File.new_for_path (path).get_uri ();              /* Check the file(s) don't already exist */              var files = new List<File> (); @@ -448,16 +441,14 @@ public class AppWindow : Gtk.ApplicationWindow              else                  files.append (File.new_for_uri (uri)); -            if (check_overwrite (save_dialog, files)) -                break; +            if (check_overwrite (save_dialog.transient_for, files)) +            { +                settings.set_string ("save-directory", save_dialog.get_current_folder ()); +                save_dialog.destroy (); +                return uri; +            }          } -        settings.set_string ("save-directory", save_dialog.get_current_folder ()); - -        save_dialog.destroy (); -        save_dialog = null; - -        return uri;      }      private bool check_overwrite (Gtk.Window parent, List<File> files) @@ -514,6 +505,7 @@ public class AppWindow : Gtk.ApplicationWindow          var progress_bar =  new CancellableProgressBar (_("Saving"), cancellable);          action_bar.pack_end (progress_bar);          progress_bar.visible = true; +        save_button.sensitive = false;          try          {              yield book.save_async (format, settings.get_int ("jpeg-quality"), file, (fraction) => @@ -523,6 +515,7 @@ public class AppWindow : Gtk.ApplicationWindow          }          catch (Error e)          { +            save_button.sensitive = true;              progress_bar.destroy ();              warning ("Error saving file: %s", e.message);              show_error_dialog (/* Title of error dialog when save failed */ @@ -530,6 +523,7 @@ public class AppWindow : Gtk.ApplicationWindow                                 e.message);              return false;          } +        save_button.sensitive = true;          progress_bar.destroy_with_delay (500);          book_needs_saving = false; @@ -576,14 +570,9 @@ public class AppWindow : Gtk.ApplicationWindow          book.clear ();          book_needs_saving = false;          book_uri = null; -        save_menuitem.sensitive = false; -        email_menuitem.sensitive = false; -        print_menuitem.sensitive = false;          save_button.sensitive = false; -        save_toolbutton.sensitive = false;          copy_to_clipboard_menuitem.sensitive = false; -        status_primary_label.set_text (/* Label shown when detected a scanner */ -                                       _("Ready to Scan")); +        update_scan_status ();          stack.set_visible_child_name ("startup");      } @@ -616,15 +605,51 @@ public class AppWindow : Gtk.ApplicationWindow          return false;      } -    [GtkCallback] -    private void new_button_clicked_cb (Gtk.Widget widget) +    private void new_document_cb ()      {          new_document();      } -    public void new_document_activate_cb () +    private void set_scan_type (ScanType scan_type)      { -        new_document(); +        this.scan_type = scan_type; + +        switch (scan_type) +        { +        case ScanType.SINGLE: +            scan_single_radio.active = true; +            scan_options_image.icon_name = "scanner-symbolic"; +            break; +        case ScanType.ADF_BOTH: +            scan_adf_radio.active = true; +            scan_options_image.icon_name = "scan-type-adf-symbolic"; +            break; +        case ScanType.BATCH: +            scan_batch_radio.active = true; +            scan_options_image.icon_name = "scan-type-batch-symbolic"; +            break; +        } +    } + +    [GtkCallback] +    private void scan_single_radio_toggled_cb (Gtk.ToggleButton button) +    { +        if (button.active) +            set_scan_type (ScanType.SINGLE); +    } + +    [GtkCallback] +    private void scan_adf_radio_toggled_cb (Gtk.ToggleButton button) +    { +        if (button.active) +            set_scan_type (ScanType.ADF_BOTH); +    } + +    [GtkCallback] +    private void scan_batch_radio_toggled_cb (Gtk.ToggleButton button) +    { +        if (button.active) +            set_scan_type (ScanType.BATCH);      }      private void set_document_hint (string document_hint, bool save = false) @@ -633,15 +658,11 @@ public class AppWindow : Gtk.ApplicationWindow          if (document_hint == "text")          { -            text_button_menuitem.active = true; -            text_button_hb_menuitem.active = true; -            text_menuitem.active = true; +            text_radio.active = true;          }          else if (document_hint == "photo")          { -            photo_button_menuitem.active = true; -            photo_button_hb_menuitem.active = true; -            photo_menuitem.active = true; +            photo_radio.active = true;          }          if (save) @@ -649,16 +670,16 @@ public class AppWindow : Gtk.ApplicationWindow      }      [GtkCallback] -    private void text_menuitem_toggled_cb (Gtk.CheckMenuItem widget) +    private void text_radio_toggled_cb (Gtk.ToggleButton button)      { -        if (widget.active) +        if (button.active)              set_document_hint ("text", true);      }      [GtkCallback] -    private void photo_menuitem_toggled_cb (Gtk.CheckMenuItem widget) +    private void photo_radio_toggled_cb (Gtk.ToggleButton button)      { -        if (widget.active) +        if (button.active)              set_document_hint ("photo", true);      } @@ -689,7 +710,9 @@ public class AppWindow : Gtk.ApplicationWindow      private void scan_button_clicked_cb (Gtk.Widget widget)      {          var options = make_scan_options (); -        options.type = ScanType.SINGLE; +        options.type = scan_type; +        if (options.type == ScanType.ADF_BOTH) +            options.type = preferences_dialog.get_page_side ();          status_primary_label.set_text (/* Label shown when scan started */                                         _("Contacting scanner…"));          start_scan (selected_device, options); @@ -701,34 +724,7 @@ public class AppWindow : Gtk.ApplicationWindow          stop_scan ();      } -    [GtkCallback] -    private void continuous_scan_button_clicked_cb (Gtk.Widget widget) -    { -        if (scanning) -            stop_scan (); -        else -        { -            var options = make_scan_options (); -            options.type = preferences_dialog.get_page_side (); -            start_scan (selected_device, options); -        } -    } - -    [GtkCallback] -    private void batch_button_clicked_cb (Gtk.Widget widget) -    { -        var options = make_scan_options (); -        options.type = ScanType.BATCH; -        start_scan (selected_device, options); -    } - -    [GtkCallback] -    private void preferences_button_clicked_cb (Gtk.Widget widget) -    { -        preferences_dialog.present (); -    } - -    public void preferences_activate_cb () +    private void preferences_cb ()      {          preferences_dialog.present ();      } @@ -975,7 +971,7 @@ public class AppWindow : Gtk.ApplicationWindow          dialog.modal = true;          dialog.border_width = 12;          /* Title of dialog to reorder pages */ -        dialog.title = _("Reorder Pages"); +        dialog.title = C_("dialog title", "Reorder Pages");          dialog.set_transient_for (this);          dialog.key_press_event.connect ((e) =>          { @@ -1039,13 +1035,7 @@ public class AppWindow : Gtk.ApplicationWindow          dialog.present ();      } -    public void reorder_document_activate_cb () -    { -        reorder_document (); -    } - -    [GtkCallback] -    private void reorder_menuitem_activate_cb (Gtk.Widget widget) +    private void reorder_document_cb ()      {          reorder_document ();      } @@ -1060,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;      } @@ -1081,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;              } @@ -1096,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) */ @@ -1133,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; @@ -1183,13 +1175,7 @@ public class AppWindow : Gtk.ApplicationWindow          context.paint ();      } -    [GtkCallback] -    private void email_button_clicked_cb (Gtk.Widget widget) -    { -        email_document_async.begin (); -    } - -    public void email_document_activate_cb () +    private void email_document_cb ()      {          email_document_async.begin ();      } @@ -1238,13 +1224,7 @@ public class AppWindow : Gtk.ApplicationWindow          print.draw_page.disconnect (draw_page);      } -    [GtkCallback] -    private void print_button_clicked_cb (Gtk.Widget widget) -    { -        print_document (); -    } - -    public void print_document_activate_cb () +    private void print_document_cb ()      {          print_document ();      } @@ -1263,13 +1243,7 @@ public class AppWindow : Gtk.ApplicationWindow          }      } -    [GtkCallback] -    private void help_contents_menuitem_activate_cb (Gtk.Widget widget) -    { -        launch_help (); -    } - -    public void help_contents_activate_cb () +    private void help_cb ()      {          launch_help ();      } @@ -1289,10 +1263,10 @@ public class AppWindow : Gtk.ApplicationWindow          Gtk.show_about_dialog (this,                                 "title", title, -                               "program-name", "Simple Scan", +                               "program-name", _("Simple Scan"),                                 "version", VERSION,                                 "comments", description, -                               "logo-icon-name", "scanner", +                               "logo-icon-name", "org.gnome.SimpleScan",                                 "authors", authors,                                 "translator-credits", _("translator-credits"),                                 "website", "https://gitlab.gnome.org/GNOME/simple-scan", @@ -1302,13 +1276,7 @@ public class AppWindow : Gtk.ApplicationWindow                                 null);      } -    [GtkCallback] -    private void about_menuitem_activate_cb (Gtk.Widget widget) -    { -        show_about (); -    } - -    public void about_activate_cb () +    private void about_cb ()      {          show_about ();      } @@ -1332,13 +1300,7 @@ public class AppWindow : Gtk.ApplicationWindow          });      } -    [GtkCallback] -    private void quit_menuitem_activate_cb (Gtk.Widget widget) -    { -        on_quit (); -    } - -    public void quit_activate_cb () +    private void quit_cb ()      {          on_quit ();      } @@ -1395,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; @@ -1416,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)          { @@ -1534,64 +1499,48 @@ public class AppWindow : Gtk.ApplicationWindow      private void book_changed_cb (Book book)      { -        save_menuitem.sensitive = true; -        email_menuitem.sensitive = true; -        print_menuitem.sensitive = true;          save_button.sensitive = true; -        save_toolbutton.sensitive = true;          book_needs_saving = true;          copy_to_clipboard_menuitem.sensitive = true;      }      private void load ()      { -        var use_header_bar = !is_traditional_desktop (); - -        preferences_dialog = new PreferencesDialog (settings, use_header_bar); +        preferences_dialog = new PreferencesDialog (settings);          preferences_dialog.delete_event.connect (() => { return true; });          preferences_dialog.response.connect (() => { preferences_dialog.visible = false; }); -        Gtk.IconTheme.get_default ().append_search_path (ICON_DIR); - -        Gtk.Window.set_default_icon_name ("scanner"); +        Gtk.Window.set_default_icon_name ("org.gnome.SimpleScan");          var app = Application.get_default () as Gtk.Application; -        if (!use_header_bar) -        { -            set_titlebar (null); -            menubar.visible = true; -            toolbar.visible = true; -        } -        else -        { -            /* Set HeaderBar title here because Glade doesn't keep it translated */ -            /* https://bugzilla.gnome.org/show_bug.cgi?id=782753 */ -            /* Title of scan window */ -            header_bar.title = _("Simple Scan"); - -            app.add_action_entries (action_entries, this); - -            app.set_accels_for_action ("app.new_document", { "<Ctrl>N" }); -            app.set_accels_for_action ("app.save", { "<Ctrl>S" }); -            app.set_accels_for_action ("app.email", { "<Ctrl>E" }); -            app.set_accels_for_action ("app.print", { "<Ctrl>P" }); -            app.set_accels_for_action ("app.help", { "F1" }); -            app.set_accels_for_action ("app.quit", { "<Ctrl>Q" }); - -            var gear_menu = new Menu (); -            var section = new Menu (); -            gear_menu.append_section (null, section); -            section.append (_("Email"), "app.email"); -            section.append (_("Reorder Pages"), "app.reorder"); -            section = new Menu (); -            gear_menu.append_section (null, section); -            section.append (_("Preferences"), "app.preferences"); -            section.append (_("Keyboard Shortcuts"), "win.show-help-overlay"); -            section.append (_("Help"), "app.help"); -            section.append (_("About"), "app.about"); -            menu_button.set_menu_model (gear_menu); -        } +        /* Set HeaderBar title here because Glade doesn't keep it translated */ +        /* https://bugzilla.gnome.org/show_bug.cgi?id=782753 */ +        /* Title of scan window */ +        header_bar.title = _("Simple Scan"); + +        app.add_action_entries (action_entries, this); + +        app.set_accels_for_action ("app.new_document", { "<Ctrl>N" }); +        app.set_accels_for_action ("app.save", { "<Ctrl>S" }); +        app.set_accels_for_action ("app.email", { "<Ctrl>E" }); +        app.set_accels_for_action ("app.print", { "<Ctrl>P" }); +        app.set_accels_for_action ("app.help", { "F1" }); +        app.set_accels_for_action ("app.quit", { "<Ctrl>Q" }); + +        var gear_menu = new Menu (); +        var section = new Menu (); +        gear_menu.append_section (null, section); +        section.append (_("Email"), "app.email"); +        section.append (C_("menu", "Reorder Pages"), "app.reorder"); +        section = new Menu (); +        gear_menu.append_section (null, section); +        section.append (_("Preferences"), "app.preferences"); +        section.append (_("Keyboard Shortcuts"), "win.show-help-overlay"); +        section.append (_("Help"), "app.help"); +        section.append (_("About Simple Scan"), "app.about"); +        menu_button.set_menu_model (gear_menu); +          app.add_window (this);          /* Populate ActionBar (not supported in Glade) */ @@ -1599,7 +1548,7 @@ public class AppWindow : Gtk.ApplicationWindow          var button = new Gtk.Button.with_label (/* Label on new document button */                                                 _("Start Again…"));          button.visible = true; -        button.clicked.connect (new_button_clicked_cb); +        button.clicked.connect (new_document_cb);          action_bar.pack_start (button);          var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 10); @@ -1609,26 +1558,32 @@ 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; +        button.image.margin_start = 18; +        button.image.margin_end = 18;          /* 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; +        button.image.margin_start = 18; +        button.image.margin_end = 18;          /* 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;          var image = new Gtk.Image.from_icon_name ("edit-cut-symbolic", Gtk.IconSize.BUTTON);          image.visible = true; +        image.margin_start = 18; +        image.margin_end = 18;          crop_button.add (image);          /* Tooltip for crop button */          crop_button.tooltip_text = _("Crop the selected page"); @@ -1642,14 +1597,16 @@ 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; +        delete_button.image.margin_start = 18; +        delete_button.image.margin_end = 18;          /* 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) @@ -1657,7 +1614,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); @@ -1683,28 +1641,6 @@ public class AppWindow : Gtk.ApplicationWindow          }      } -    private bool is_desktop (string name) -    { -        var desktop_name_list = Environment.get_variable ("XDG_CURRENT_DESKTOP"); -        if (desktop_name_list == null) -            return false; - -        foreach (var n in desktop_name_list.split (":")) -            if (n == name) -                return true; - -        return false; -    } - -    private bool is_traditional_desktop () -    { -        const string[] traditional_desktops = { "Unity", "XFCE", "MATE", "LXDE", "Cinnamon", "X-Cinnamon", "i3" }; -        foreach (var name in traditional_desktops) -            if (is_desktop (name)) -                return true; -        return false; -    } -      private string state_filename      {          owned get { return Path.build_filename (Environment.get_user_cache_dir (), "simple-scan", "state"); } diff --git a/src/authorize-dialog.ui b/src/authorize-dialog.ui index c099563..79e43fd 100644 --- a/src/authorize-dialog.ui +++ b/src/authorize-dialog.ui @@ -3,7 +3,6 @@  <interface>    <requires lib="gtk+" version="3.10"/>    <template class="AuthorizeDialog" parent="GtkDialog"> -    <property name="can_focus">False</property>      <property name="border_width">12</property>      <property name="resizable">False</property>      <property name="modal">True</property> @@ -12,13 +11,11 @@      <child internal-child="vbox">        <object class="GtkBox" id="dialog-vbox1">          <property name="visible">True</property> -        <property name="can_focus">False</property>          <property name="orientation">vertical</property>          <property name="spacing">12</property>          <child internal-child="action_area">            <object class="GtkButtonBox" id="dialog-action_area1">              <property name="visible">True</property> -            <property name="can_focus">False</property>              <property name="layout_style">end</property>              <child>                <object class="GtkButton" id="authorize_button"> @@ -28,43 +25,28 @@                  <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>            <object class="GtkBox" id="vbox5">              <property name="visible">True</property> -            <property name="can_focus">False</property>              <property name="border_width">5</property>              <property name="orientation">vertical</property>              <property name="spacing">12</property>              <child>                <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">                  <property name="visible">True</property> -                <property name="can_focus">False</property>                  <property name="row_spacing">6</property>                  <property name="column_spacing">6</property>                  <child> @@ -95,7 +77,6 @@                  <child>                    <object class="GtkLabel" id="username_label">                      <property name="visible">True</property> -                    <property name="can_focus">False</property>                      <property name="label" translatable="yes" comments="Label beside username entry">_Username for resource:</property>                      <property name="use_underline">True</property>                      <property name="mnemonic_widget">username_entry</property> @@ -108,7 +89,6 @@                  <child>                    <object class="GtkLabel" id="password_label">                      <property name="visible">True</property> -                    <property name="can_focus">False</property>                      <property name="label" translatable="yes" comments="Label beside password entry">_Password:</property>                      <property name="use_underline">True</property>                      <property name="mnemonic_widget">password_entry</property> @@ -119,18 +99,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/book.vala b/src/book.vala index d53b31a..6db2952 100644 --- a/src/book.vala +++ b/src/book.vala @@ -11,7 +11,7 @@  public delegate void ProgressionCallback (double fraction); -public class Book +public class Book : Object  {      private List<Page> pages; diff --git a/src/config.vapi b/src/config.vapi index e6efeda..4c114e4 100644 --- a/src/config.vapi +++ b/src/config.vapi @@ -3,5 +3,3 @@ public const string PKGDATADIR;  public const string LOCALE_DIR;  public const string GETTEXT_PACKAGE;  public const string VERSION; -public const string UI_DIR; -public const string ICON_DIR; diff --git a/src/meson.build b/src/meson.build index 9e40e42..7d535c8 100644 --- a/src/meson.build +++ b/src/meson.build @@ -35,7 +35,6 @@ simple_scan = executable ('simple-scan',                            c_args: [ '-DVERSION="@0@"'.format (meson.project_version ()),                                      '-DGETTEXT_PACKAGE="simple-scan"',                                      '-DLOCALE_DIR="@0@"'.format (localedir), -                                    '-DICON_DIR="@0@"'.format (icondir),                                      '-DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE' ],                            link_args: [ '-lm' ],                            install: true ) diff --git a/src/page-view.vala b/src/page-view.vala index 03fecfb..abe5e69 100644 --- a/src/page-view.vala +++ b/src/page-view.vala @@ -23,7 +23,7 @@ public enum CropLocation      BOTTOM_RIGHT  } -public class PageView +public class PageView : Object  {      /* Page being rendered */      public Page page { get; private set; } @@ -563,7 +563,7 @@ public class PageView      private CropLocation get_crop_location (int x, int y)      {          if (!page.has_crop) -            return 0; +            return CropLocation.NONE;          var cx = page.crop_x;          var cy = page.crop_y; diff --git a/src/page.vala b/src/page.vala index 13de4d2..026fdcc 100644 --- a/src/page.vala +++ b/src/page.vala @@ -17,7 +17,7 @@ public enum ScanDirection      RIGHT_TO_LEFT  } -public class Page +public class Page : Object  {      /* Width of the page in pixels after rotation applied */      public int width diff --git a/src/preferences-dialog.ui b/src/preferences-dialog.ui index 2272b77..75d8a4c 100644 --- a/src/preferences-dialog.ui +++ b/src/preferences-dialog.ui @@ -49,45 +49,15 @@      </columns>    </object>    <template class="PreferencesDialog" parent="GtkDialog"> -    <property name="can_focus">False</property>      <property name="title" translatable="yes" comments="Title of preferences dialog">Preferences</property>      <property name="resizable">False</property> -    <property name="icon_name">scanner</property> +    <property name="icon_name">org.gnome.SimpleScan</property>      <property name="type_hint">normal</property>      <child internal-child="vbox">        <object class="GtkBox" id="dialog-vbox2">          <property name="visible">True</property> -        <property name="can_focus">False</property>          <property name="orientation">vertical</property>          <property name="spacing">2</property> -        <child internal-child="action_area"> -          <object class="GtkButtonBox" id="dialog-action_area2"> -            <property name="visible">True</property> -            <property name="can_focus">False</property> -            <property name="margin_top">30</property> -            <property name="layout_style">end</property> -            <child> -              <object class="GtkButton" id="preferences_close_button"> -                <property name="label">gtk-close</property> -                <property name="visible">True</property> -                <property name="can_focus">True</property> -                <property name="receives_default">True</property> -                <property name="use_stock">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>            <object class="GtkNotebook">              <property name="visible">True</property> @@ -96,20 +66,17 @@              <child>                <object class="GtkBox">                  <property name="visible">True</property> -                <property name="can_focus">False</property>                  <property name="border_width">30</property>                  <property name="orientation">vertical</property>                  <property name="spacing">30</property>                  <child>                    <object class="GtkGrid">                      <property name="visible">True</property> -                    <property name="can_focus">False</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> @@ -126,7 +93,6 @@                      <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"/> @@ -139,7 +105,6 @@                      <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> @@ -156,7 +121,6 @@                      <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> @@ -172,7 +136,6 @@                      <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> @@ -184,7 +147,6 @@                      <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"> @@ -195,11 +157,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"> @@ -210,11 +167,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"> @@ -225,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">2</property> -                          </packing>                          </child>                          <style>                            <class name="linked"/> @@ -241,22 +188,15 @@                        </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">                      <property name="visible">True</property> -                    <property name="can_focus">False</property>                      <property name="row_spacing">15</property>                      <property name="column_spacing">10</property>                      <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</property>                          <property name="use_underline">True</property>                          <property name="xalign">1</property> @@ -272,7 +212,6 @@                      <child>                        <object class="GtkLabel">                          <property name="visible">True</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 pages from flatbed</property>                          <property name="xalign">0</property>                          <attributes> @@ -288,7 +227,6 @@                      <child>                        <object class="GtkBox">                          <property name="visible">True</property> -                        <property name="can_focus">False</property>                          <property name="homogeneous">True</property>                          <child>                            <object class="GtkRadioButton" id="page_delay_3s_button"> @@ -299,11 +237,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"> @@ -315,11 +248,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"> @@ -331,11 +259,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"> @@ -347,11 +270,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"> @@ -363,11 +281,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"/> @@ -381,7 +294,6 @@                      <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> @@ -395,11 +307,6 @@                        </packing>                      </child>                    </object> -                  <packing> -                    <property name="expand">False</property> -                    <property name="fill">True</property> -                    <property name="position">1</property> -                  </packing>                  </child>                </object>                <packing> @@ -409,7 +316,6 @@              <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> @@ -419,20 +325,17 @@              <child>                <object class="GtkBox">                  <property name="visible">True</property> -                <property name="can_focus">False</property>                  <property name="border_width">30</property>                  <property name="orientation">vertical</property>                  <property name="spacing">30</property>                  <child>                    <object class="GtkGrid">                      <property name="visible">True</property> -                    <property name="can_focus">False</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> @@ -448,7 +351,6 @@                      <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> @@ -464,7 +366,6 @@                      <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> @@ -476,7 +377,6 @@                      <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> @@ -486,22 +386,15 @@                        </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">                      <property name="visible">True</property> -                    <property name="can_focus">False</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> @@ -517,7 +410,6 @@                      <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> @@ -557,41 +449,25 @@                        </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>              <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 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> -    <action-widgets> -      <action-widget response="1">preferences_close_button</action-widget> -    </action-widgets>    </template>    <object class="GtkSizeGroup" id="label_size_group">      <widgets> @@ -606,3 +482,4 @@      </widgets>    </object>  </interface> + diff --git a/src/preferences-dialog.vala b/src/preferences-dialog.vala index d58c066..43f49af 100644 --- a/src/preferences-dialog.vala +++ b/src/preferences-dialog.vala @@ -58,15 +58,10 @@ private class PreferencesDialog : Gtk.Dialog      private Gtk.Adjustment brightness_adjustment;      [GtkChild]      private Gtk.Adjustment contrast_adjustment; -    [GtkChild] -    private Gtk.Button preferences_close_button; -    public PreferencesDialog (Settings settings, bool use_header_bar) +    public PreferencesDialog (Settings settings)      { -        Object (use_header_bar: use_header_bar ? 1 : -1); - -        if (use_header_bar) -            preferences_close_button.visible = false; +        Object (use_header_bar: 1);          this.settings = settings; diff --git a/src/scan-type-adf-symbolic.svg b/src/scan-type-adf-symbolic.svg new file mode 100644 index 0000000..4ddb4de --- /dev/null +++ b/src/scan-type-adf-symbolic.svg @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg width="16" height="16" version="1.1" viewBox="0 0 4.2333 4.2333" xmlns="http://www.w3.org/2000/svg"> + <g fill="#474747"> +  <path d="m0.52917 3.9688c-0.13229 0-0.26458-0.13229-0.26458-0.26459v-2.1167c0-0.13229 0.13229-0.26459 0.26458-0.26459h0.26458v1.5875h2.6458v-1.5875h0.26458c0.13229 0 0.26458 0.1323 0.26458 0.26459v2.1167c0 0.1323-0.13229 0.26459-0.26458 0.26459z"/> +  <path d="m1.0583 2.6458v-1.5875h2.1167v1.5875z"/> +  <path d="m1.0583 0.79376v-0.26459h2.1167v0.26459z"/> +  <path d="m1.0583 0.26459v-0.26458h2.1167v0.26458z"/> + </g> +</svg> diff --git a/src/scan-type-batch-symbolic.svg b/src/scan-type-batch-symbolic.svg new file mode 100644 index 0000000..a11715d --- /dev/null +++ b/src/scan-type-batch-symbolic.svg @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg width="16" height="16" version="1.1" viewBox="0 0 4.2333 4.2333" xmlns="http://www.w3.org/2000/svg"> + <g fill="#474747"> +  <path d="m2.2521 0.79056c-0.94667 0-1.7198 0.7731-1.7198 1.7198s0.7731 1.7198 1.7198 1.7198 1.7198-0.7731 1.7198-1.7198-0.7731-1.7198-1.7198-1.7198zm0 0.52916c0.66068 0 1.1906 0.52993 1.1906 1.1906s-0.52993 1.1906-1.1906 1.1906-1.1906-0.52993-1.1906-1.1906 0.52993-1.1906 1.1906-1.1906z" color="#000000" color-rendering="auto" dominant-baseline="auto" enable-background="new" image-rendering="auto" shape-rendering="auto" solid-color="#000000" stroke-width=".26458" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> +  <path d="m1.8552-0.00318h0.79374c0.14658 0 0.26458 0.118 0.26458 0.26458s-0.118 0.26458-0.26458 0.26458h-0.79374c-0.14658 0-0.26458-0.118-0.26458-0.26458s0.118-0.26458 0.26458-0.26458z" color="#000000" color-rendering="auto" image-rendering="auto" shape-rendering="auto" solid-color="#000000" stroke-width=".26458" style="isolation:auto;mix-blend-mode:normal"/> +  <path d="m2.3844-0.00318v1.0583h-0.26458v-1.0583z" color="#000000" color-rendering="auto" image-rendering="auto" shape-rendering="auto" solid-color="#000000" stroke-width=".26458" style="isolation:auto;mix-blend-mode:normal"/> +  <path d="m2.1198 1.5843a1.0583 1.0583 0 0 1 1.0583 1.0583h-1.0583z" color="#000000" enable-background="new" stroke-width="0"/> + </g> +</svg> diff --git a/src/scanner.vala b/src/scanner.vala index 58141b8..8bc587f 100644 --- a/src/scanner.vala +++ b/src/scanner.vala @@ -11,13 +11,13 @@  /* TODO: Could indicate the start of the next page immediately after the last page is received (i.e. before the sane_cancel()) */ -public class ScanDevice +public class ScanDevice : Object  {      public string name;      public string label;  } -public class ScanPageInfo +public class ScanPageInfo : Object  {      /* Width, height in pixels */      public int width; @@ -36,7 +36,7 @@ public class ScanPageInfo      public string device;  } -public class ScanLine +public class ScanLine : Object  {      /* Line number */      public int number; @@ -73,7 +73,7 @@ public enum ScanType      BATCH  } -public class ScanOptions +public class ScanOptions : Object  {      public int dpi;      public ScanMode scan_mode; @@ -86,7 +86,7 @@ public class ScanOptions      public int page_delay;  } -private class ScanJob +private class ScanJob : Object  {      public int id;      public string device; @@ -208,7 +208,7 @@ private class NotifyGotLine : Notify      }  } -public class Scanner +public class Scanner : Object  {      /* Singleton object */      private static Scanner scanner_object = null; @@ -292,7 +292,7 @@ public class Scanner          return false;      } -    private void notify (Notify notification) +    private void notify_event (Notify notification)      {          notify_queue.push (notification);          Idle.add (notify_idle_cb); @@ -303,7 +303,7 @@ public class Scanner          if ((scanning && !is_scanning) || (!scanning && is_scanning))          {              scanning = is_scanning; -            notify (new NotifyScanningChanged ()); +            notify_event (new NotifyScanningChanged ());          }      } @@ -382,7 +382,7 @@ public class Scanner          else              default_device = null; -        notify (new NotifyUpdateDevices ((owned) devices)); +        notify_event (new NotifyUpdateDevices ((owned) devices));      }      private int scale_int (int source_min, int source_max, Sane.OptionDescriptor option, int value) @@ -743,7 +743,7 @@ public class Scanner      private static void authorization_cb (string resource, char[] username, char[] password)      { -        scanner_object.notify (new NotifyRequestAuthorization (resource)); +        scanner_object.notify_event (new NotifyRequestAuthorization (resource));          var credentials = scanner_object.authorize_queue.pop ();          for (var i = 0; credentials.username[i] != '\0' && i < Sane.MAX_USERNAME_LEN; i++) @@ -783,7 +783,7 @@ public class Scanner      {          close_device ();          state = ScanState.IDLE; -        notify (new NotifyScanFailed (error_code, error_string)); +        notify_event (new NotifyScanFailed (error_code, error_string));      }      private bool handle_requests () @@ -868,7 +868,7 @@ public class Scanner          if (status != Sane.Status.GOOD)          { -            warning ("Unable to get open device: %s", Sane.strstatus (status)); +            warning ("Unable to open device: %s", Sane.strstatus (status));              fail_scan (status,                         /* Error displayed when cannot connect to scanner */                         _("Unable to connect to scanner")); @@ -1039,6 +1039,30 @@ public class Scanner                      set_bool_option (handle, option, index, job.type == ScanType.ADF_BOTH, null);              } +            /* Non-standard Epson GT-S50 ADF options */ +            option = get_option_by_name (handle, "adf-mode", out index); +            if (option != null) +            { +                string[] adf_simplex_modes = +                { +                    "Simplex" +                }; +                string[] adf_duplex_modes = +                { +                    "Duplex" +                }; +                if (job.type == ScanType.ADF_BOTH) +                    set_constrained_string_option (handle, option, index, adf_duplex_modes, null); +                else +                    set_constrained_string_option (handle, option, index, adf_simplex_modes, null); +            } +            option = get_option_by_name (handle, "adf-auto-scan", out index); +            if (option != null) +            { +                if (option.type == Sane.ValueType.BOOL) +                    set_bool_option (handle, option, index, true, null); +            } +              /* Multi-page options */              option = get_option_by_name (handle, "batch-scan", out index);              if (option != null) @@ -1203,7 +1227,7 @@ public class Scanner          /* Trigger timeout to close */          // TODO -        notify (new NotifyDocumentDone ()); +        notify_event (new NotifyDocumentDone ());          set_scanning (false);      } @@ -1211,7 +1235,7 @@ public class Scanner      {          Sane.Status status; -        notify (new NotifyExpectPage ()); +        notify_event (new NotifyExpectPage ());          status = Sane.start (handle);          debug ("sane_start (page=%d, pass=%d) -> %s", page_number, pass_number, Sane.status_to_string (status)); @@ -1265,7 +1289,7 @@ public class Scanner          if (page_number != notified_page)          { -            notify (new NotifyGotPageInfo (job.id, info)); +            notify_event (new NotifyGotPageInfo (job.id, info));              notified_page = page_number;          } @@ -1282,7 +1306,7 @@ public class Scanner      {          var job = (ScanJob) job_queue.data; -        notify (new NotifyPageDone (job.id)); +        notify_event (new NotifyPageDone (job.id));          /* If multi-pass then scan another page */          if (!parameters.last_frame) @@ -1300,7 +1324,7 @@ public class Scanner              page_number++;              pass_number = 0; -            notify (new NotifyPageDone (job.id)); +            notify_event (new NotifyPageDone (job.id));              state = ScanState.START;              return;          } @@ -1448,7 +1472,7 @@ public class Scanner                  line.data_length = (line.width * 2 + 7) / 8;              } -            notify (new NotifyGotLine (job.id, line)); +            notify_event (new NotifyGotLine (job.id, line));          }      } diff --git a/src/simple-scan.gresource.xml b/src/simple-scan.gresource.xml index a62619e..2348f75 100644 --- a/src/simple-scan.gresource.xml +++ b/src/simple-scan.gresource.xml @@ -5,6 +5,10 @@      <file preprocess="xml-stripblanks">preferences-dialog.ui</file>      <file preprocess="xml-stripblanks">authorize-dialog.ui</file>    </gresource> +  <gresource prefix="/org/gnome/SimpleScan/icons/scalable/actions"> +    <file>scan-type-adf-symbolic.svg</file> +    <file>scan-type-batch-symbolic.svg</file> +  </gresource>    <gresource prefix="/org/gnome/SimpleScan/gtk">      <file preprocess="xml-stripblanks">help-overlay.ui</file>    </gresource> diff --git a/src/simple-scan.vala b/src/simple-scan.vala index d30aa45..0c263f0 100644 --- a/src/simple-scan.vala +++ b/src/simple-scan.vala @@ -105,7 +105,7 @@ public class SimpleScan : Gtk.Application      private void update_scan_devices_cb (Scanner scanner, List<ScanDevice> devices)      { -        var devices_copy = devices.copy (); +        var devices_copy = devices.copy_deep ((CopyFunc) Object.ref);          /* If the default device is not detected add it to the list */          if (default_device != null) | 
