diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2021-08-22 19:00:53 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2021-08-22 19:00:53 +0200 |
commit | 9a828fe5ebd2383cce394eb76f44d14a9dbf143e (patch) | |
tree | ce52323fc58d008fd7894b6bdc68b878f405c7df /src | |
parent | aaee9a923e009ee33fad324687579ede5de7e6ce (diff) | |
parent | b97bb9c9e991504bb4fae916a75a8426b78b68b9 (diff) |
Merge branch 'release/debian/40.1-1'debian/40.1-1
Diffstat (limited to 'src')
-rw-r--r-- | src/app-window.ui | 843 | ||||
-rw-r--r-- | src/app-window.vala | 143 | ||||
-rw-r--r-- | src/authorize-dialog.ui | 111 | ||||
-rw-r--r-- | src/authorize-dialog.vala | 8 | ||||
-rw-r--r-- | src/book-view.vala | 9 | ||||
-rw-r--r-- | src/help-overlay.ui | 162 | ||||
-rw-r--r-- | src/meson.build | 6 | ||||
-rw-r--r-- | src/page-view.vala | 10 | ||||
-rw-r--r-- | src/page.vala | 4 | ||||
-rw-r--r-- | src/preferences-dialog.ui | 456 | ||||
-rw-r--r-- | src/preferences-dialog.vala | 92 | ||||
-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 | 225 | ||||
-rw-r--r-- | src/simple-scan.gresource.xml | 15 | ||||
-rw-r--r-- | src/simple-scan.vala | 4 |
16 files changed, 295 insertions, 1811 deletions
diff --git a/src/app-window.ui b/src/app-window.ui deleted file mode 100644 index 6f42a51..0000000 --- a/src/app-window.ui +++ /dev/null @@ -1,843 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.1 --> -<interface> - <requires lib="gtk+" version="3.12"/> - <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> - <object class="GtkListStore" id="device_model"> - <columns> - <!-- column-name device_name --> - <column type="gchararray"/> - <!-- column-name label --> - <column type="gchararray"/> - </columns> - </object> - <object class="GtkPopover" id="scan_options_popover"> - <property name="can_focus">False</property> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_left">12</property> - <property name="margin_right">12</property> - <property name="margin_top">12</property> - <property name="margin_bottom">12</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkRadioButton" id="scan_single_radio"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="receives_default">False</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="can_focus">False</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> - <property name="spacing">12</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">scanner-symbolic</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Single Page</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="scan_adf_radio"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="receives_default">False</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="can_focus">False</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> - <property name="spacing">12</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">scan-type-adf-symbolic</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">All Pages From _Feeder</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="scan_batch_radio"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="receives_default">False</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="can_focus">False</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> - <property name="spacing">12</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">scan-type-batch-symbolic</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Multiple Pages From Flatbed</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="text_radio"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="receives_default">False</property> - <property name="margin_top">12</property> - <property name="draw_indicator">False</property> - <signal name="toggled" handler="text_radio_toggled_cb" swapped="no"/> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</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> - <property name="spacing">12</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">x-office-document-symbolic</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Text</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkRadioButton" id="photo_radio"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="receives_default">False</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="can_focus">False</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> - <property name="spacing">12</property> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">image-x-generic-symbolic</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Image</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">4</property> - </packing> - </child> - <child> - <object class="GtkButton" id="preferences_button"> - <property name="label" translatable="yes">_Preferences</property> - <property name="height_request">40</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="margin_top">12</property> - <property name="use_underline">True</property> - <signal name="clicked" handler="preferences_button_clicked_cb" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">5</property> - </packing> - </child> - </object> - </child> - </object> - <template class="AppWindow" parent="GtkApplicationWindow"> - <property name="width_request">320</property> - <property name="height_request">480</property> - <property name="can_focus">False</property> - <property name="title" translatable="yes" comments="Title of scan window">Document Scanner</property> - <property name="icon_name">org.gnome.SimpleScan</property> - <signal name="delete-event" handler="window_delete_event_cb" swapped="no"/> - <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="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> - <signal name="clicked" handler="stop_scan_button_clicked_cb" swapped="no"/> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkSpinner" id="stop_button_spinner"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="active">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">S_top</property> - <property name="use_underline">True</property> - <property name="width_chars">6</property> - <property name="xalign">0.33</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - <style> - <class name="text-button"/> - <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="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> - <signal name="clicked" handler="scan_button_clicked_cb" swapped="no"/> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkImage" id="scan_options_image"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">scanner-symbolic</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_right">1</property> - <property name="label" translatable="yes">_Scan</property> - <property name="use_underline">True</property> - <property name="width_chars">6</property> - <property name="xalign">0.33</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - <style> - <class name="text-button"/> - <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"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="receives_default">False</property> - <property name="popover">scan_options_popover</property> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkImage" id="scan_hint_image"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">x-office-document-symbolic</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkImage"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="icon_name">pan-down-symbolic</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <style> - <class name="linked"/> - </style> - </object> - </child> - <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> - <accelerator key="F10" signal="activate"/> - <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> - </child> - <style> - <class name="image-button"/> - </style> - </object> - <packing> - <property name="pack_type">end</property> - <property name="position">1</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> - <signal name="clicked" handler="save_file_button_clicked_cb" swapped="no"/> - <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> - </child> - <style> - <class name="image-button"/> - </style> - </object> - <packing> - <property name="pack_type">end</property> - <property name="position">2</property> - </packing> - </child> - <style> - <class name="titlebar"/> - </style> - </object> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</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">True</property> - <property name="has_focus">True</property> - <property name="is_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="opacity">0.5</property> - <property name="pixel_size">120</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> - <attributes> - <attribute name="weight" value="bold"/> - <attribute name="scale" value="1.5"/> - </attributes> - <style> - <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="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> - <child> - <object class="GtkComboBox" id="device_combo"> - <property name="visible">False</property> - <property name="model">device_model</property> - <signal name="changed" handler="device_combo_changed_cb" swapped="no"/> - </object> - </child> - </object> - </child> - </object> - <packing> - <property name="name">startup</property> - </packing> - </child> - <child> - <object class="GtkBox" id="main_vbox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <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">0</property> - </packing> - </child> - </object> - <packing> - <property name="name">document</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - </object> - </child> - </template> -</interface> diff --git a/src/app-window.vala b/src/app-window.vala index 67f10a8..c1d4ea3 100644 --- a/src/app-window.vala +++ b/src/app-window.vala @@ -13,8 +13,8 @@ private const int DEFAULT_TEXT_DPI = 150; private const int DEFAULT_PHOTO_DPI = 300; -[GtkTemplate (ui = "/org/gnome/SimpleScan/app-window.ui")] -public class AppWindow : Gtk.ApplicationWindow +[GtkTemplate (ui = "/org/gnome/SimpleScan/ui/app-window.ui")] +public class AppWindow : Hdy.ApplicationWindow { private const GLib.ActionEntry[] action_entries = { @@ -48,77 +48,79 @@ public class AppWindow : Gtk.ApplicationWindow private bool user_selected_device; [GtkChild] - private Gtk.HeaderBar header_bar; + private unowned Hdy.HeaderBar header_bar; [GtkChild] - private Gtk.Menu page_menu; + private unowned Gtk.Menu page_menu; [GtkChild] - private Gtk.Stack stack; + private unowned Gtk.Stack stack; [GtkChild] - private Gtk.Label status_primary_label; + private unowned Hdy.StatusPage status_page; [GtkChild] - private Gtk.ListStore device_model; + private unowned Gtk.Label status_secondary_label; [GtkChild] - private Gtk.ComboBox device_combo; + private unowned Gtk.ListStore device_model; [GtkChild] - private Gtk.Label status_secondary_label; + private unowned Gtk.Box device_buttons_box; [GtkChild] - private Gtk.Box main_vbox; + private unowned Gtk.ComboBox device_combo; [GtkChild] - private Gtk.RadioMenuItem custom_crop_menuitem; + private unowned Gtk.Box main_vbox; [GtkChild] - private Gtk.RadioMenuItem a3_menuitem; + private unowned Gtk.RadioMenuItem custom_crop_menuitem; [GtkChild] - private Gtk.RadioMenuItem a4_menuitem; + private unowned Gtk.RadioMenuItem a3_menuitem; [GtkChild] - private Gtk.RadioMenuItem a5_menuitem; + private unowned Gtk.RadioMenuItem a4_menuitem; [GtkChild] - private Gtk.RadioMenuItem a6_menuitem; + private unowned Gtk.RadioMenuItem a5_menuitem; [GtkChild] - private Gtk.RadioMenuItem letter_menuitem; + private unowned Gtk.RadioMenuItem a6_menuitem; [GtkChild] - private Gtk.RadioMenuItem legal_menuitem; + private unowned Gtk.RadioMenuItem letter_menuitem; [GtkChild] - private Gtk.RadioMenuItem four_by_six_menuitem; + private unowned Gtk.RadioMenuItem legal_menuitem; [GtkChild] - private Gtk.RadioMenuItem no_crop_menuitem; + private unowned Gtk.RadioMenuItem four_by_six_menuitem; [GtkChild] - private Gtk.MenuItem page_move_left_menuitem; + private unowned Gtk.RadioMenuItem no_crop_menuitem; [GtkChild] - private Gtk.MenuItem page_move_right_menuitem; + private unowned Gtk.MenuItem page_move_left_menuitem; [GtkChild] - private Gtk.MenuItem page_delete_menuitem; + private unowned Gtk.MenuItem page_move_right_menuitem; [GtkChild] - private Gtk.MenuItem crop_rotate_menuitem; + private unowned Gtk.MenuItem page_delete_menuitem; [GtkChild] - private Gtk.MenuItem copy_to_clipboard_menuitem; + private unowned Gtk.MenuItem crop_rotate_menuitem; [GtkChild] - private Gtk.Button save_button; + private unowned Gtk.MenuItem copy_to_clipboard_menuitem; [GtkChild] - private Gtk.Button stop_button; + private unowned Gtk.Button save_button; [GtkChild] - private Gtk.Button scan_button; + private unowned Gtk.Button stop_button; [GtkChild] - private Gtk.ActionBar action_bar; + private unowned Gtk.Button scan_button; + [GtkChild] + private unowned Gtk.ActionBar action_bar; private Gtk.ToggleButton crop_button; private Gtk.Button delete_button; [GtkChild] - private Gtk.Image scan_options_image; + private unowned Gtk.Image scan_options_image; [GtkChild] - private Gtk.Image scan_hint_image; + private unowned Gtk.Image scan_hint_image; [GtkChild] - private Gtk.RadioButton scan_single_radio; + private unowned Gtk.RadioButton scan_single_radio; [GtkChild] - private Gtk.RadioButton scan_adf_radio; + private unowned Gtk.RadioButton scan_adf_radio; [GtkChild] - private Gtk.RadioButton scan_batch_radio; + private unowned Gtk.RadioButton scan_batch_radio; [GtkChild] - private Gtk.RadioButton text_radio; + private unowned Gtk.RadioButton text_radio; [GtkChild] - private Gtk.RadioButton photo_radio; + private unowned Gtk.RadioButton photo_radio; [GtkChild] - private Gtk.MenuButton menu_button; + private unowned Gtk.MenuButton menu_button; private bool have_devices = false; private string? missing_driver = null; @@ -249,38 +251,41 @@ public class AppWindow : Gtk.ApplicationWindow scan_button.sensitive = false; if (!have_devices) { - status_primary_label.set_text (/* Label shown when searching for scanners */ - _("Searching for Scanners…")); + status_page.set_title (/* Label shown when searching for scanners */ + _("Searching for Scanners…")); status_secondary_label.visible = false; - device_combo.visible = false; + device_buttons_box.visible = false; } else if (get_selected_device () != null) { scan_button.sensitive = true; - status_primary_label.set_text (/* Label shown when detected a scanner */ - _("Ready to Scan")); + status_page.set_title (/* Label shown when detected a scanner */ + _("Ready to Scan")); status_secondary_label.set_text (get_selected_device_label ()); status_secondary_label.visible = false; - device_combo.visible = true; + device_buttons_box.visible = true; + device_buttons_box.sensitive = true; device_combo.sensitive = true; } 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")); + status_page.set_title (/* Warning displayed when no drivers are installed but a compatible scanner is detected */ + _("Additional Software Needed")); /* Instructions to install driver software */ status_secondary_label.set_markup (_("You need to <a href=\"install-firmware\">install driver software</a> for your scanner.")); status_secondary_label.visible = true; - device_combo.visible = false; + device_buttons_box.visible = false; } else { /* Warning displayed when no scanners are detected */ - status_primary_label.set_text (_("No scanners detected")); + status_page.set_title (_("No Scanners Detected")); /* Hint to user on why there are no scanners detected */ - status_secondary_label.set_text (_("Please check your scanner is connected and powered on")); + status_secondary_label.set_text (_("Please check your scanner is connected and powered on.")); status_secondary_label.visible = true; - device_combo.visible = false; + device_buttons_box.visible = true; + device_buttons_box.sensitive = true; + device_combo.sensitive = false; // We would like to be refresh button to be active } } @@ -796,9 +801,6 @@ public class AppWindow : Gtk.ApplicationWindow if (scanning) stop_scan (); - have_devices = false; - /* Refresh list of devices to detect network scanners, and fix issues with disconnected scanners */ - redetect (); clear_document (); }); } @@ -820,11 +822,20 @@ public class AppWindow : Gtk.ApplicationWindow new_document (); } + [GtkCallback] + private void redetect_button_clicked_cb (Gtk.Button button) + { + have_devices = false; + update_scan_status (); + redetect (); + } + private void scan (ScanOptions options) { - status_primary_label.set_text (/* Label shown when scan started */ - _("Contacting scanner…")); - device_combo.sensitive = false; + status_page.set_title (/* Label shown when scan started */ + _("Contacting Scanner…")); + device_buttons_box.visible = true; + device_buttons_box.sensitive = false; start_scan (get_selected_device (), options); } @@ -838,8 +849,7 @@ public class AppWindow : Gtk.ApplicationWindow private void scan_adf_cb () { var options = make_scan_options (); - options.type = ScanType.ADF_BOTH; - options.type = preferences_dialog.get_page_side (); + options.type = ScanType.ADF; scan (options); } @@ -895,7 +905,7 @@ public class AppWindow : Gtk.ApplicationWindow scan_single_radio.active = true; scan_options_image.icon_name = "scanner-symbolic"; break; - case ScanType.ADF_BOTH: + case ScanType.ADF: scan_adf_radio.active = true; scan_options_image.icon_name = "scan-type-adf-symbolic"; break; @@ -917,7 +927,7 @@ public class AppWindow : Gtk.ApplicationWindow private void scan_adf_radio_toggled_cb (Gtk.ToggleButton button) { if (button.active) - set_scan_type (ScanType.ADF_BOTH); + set_scan_type (ScanType.ADF); } [GtkCallback] @@ -985,6 +995,7 @@ public class AppWindow : Gtk.ApplicationWindow options.brightness = brightness; options.contrast = contrast; options.page_delay = page_delay; + options.side = preferences_dialog.get_page_side (); return options; } @@ -1006,8 +1017,6 @@ public class AppWindow : Gtk.ApplicationWindow stop_button.visible = true; var options = make_scan_options (); options.type = scan_type; - if (options.type == ScanType.ADF_BOTH) - options.type = preferences_dialog.get_page_side (); scan (options); } @@ -1834,8 +1843,12 @@ public class AppWindow : Gtk.ApplicationWindow private void load () { preferences_dialog = new PreferencesDialog (settings); - preferences_dialog.delete_event.connect (() => { return true; }); - preferences_dialog.response.connect (() => { preferences_dialog.visible = false; }); + preferences_dialog.delete_event.connect (() => { + preferences_dialog.visible = false; + return true; + }); + preferences_dialog.transient_for = this; + preferences_dialog.modal = true; Gtk.Window.set_default_icon_name ("org.gnome.SimpleScan"); @@ -1872,9 +1885,9 @@ public class AppWindow : Gtk.ApplicationWindow section.append (_("Email"), "app.email"); section.append (_("Print"), "app.print"); section.append (C_("menu", "Reorder Pages"), "app.reorder"); - section.append (_("Preferences"), "app.preferences"); 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 Document Scanner"), "app.about"); @@ -1885,7 +1898,7 @@ public class AppWindow : Gtk.ApplicationWindow /* Populate ActionBar (not supported in Glade) */ /* https://bugzilla.gnome.org/show_bug.cgi?id=769966 */ var button = new Gtk.Button.with_label (/* Label on new document button */ - _("Start Again…")); + _("New Document")); button.visible = true; button.clicked.connect (new_document_cb); action_bar.pack_start (button); @@ -1919,7 +1932,7 @@ public class AppWindow : Gtk.ApplicationWindow crop_button = new Gtk.ToggleButton (); crop_button.visible = true; - var image = new Gtk.Image.from_icon_name ("edit-cut-symbolic", Gtk.IconSize.BUTTON); + var image = new Gtk.Image.from_icon_name ("crop-symbolic", Gtk.IconSize.BUTTON); image.visible = true; image.margin_start = 18; image.margin_end = 18; diff --git a/src/authorize-dialog.ui b/src/authorize-dialog.ui deleted file mode 100644 index 79e43fd..0000000 --- a/src/authorize-dialog.ui +++ /dev/null @@ -1,111 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> -<interface> - <requires lib="gtk+" version="3.10"/> - <template class="AuthorizeDialog" parent="GtkDialog"> - <property name="border_width">12</property> - <property name="resizable">False</property> - <property name="modal">True</property> - <property name="type_hint">normal</property> - <property name="urgency_hint">True</property> - <child internal-child="vbox"> - <object class="GtkBox" id="dialog-vbox1"> - <property name="visible">True</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="layout_style">end</property> - <child> - <object class="GtkButton" id="authorize_button"> - <property name="label" translatable="yes" comments="Button to submit authorization dialog">_Authorize</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_underline">True</property> - </object> - </child> - </object> - <packing> - <property name="pack_type">end</property> - </packing> - </child> - <child> - <object class="GtkBox" id="vbox5"> - <property name="visible">True</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="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> - </child> - <child> - <object class="GtkGrid" id="grid2"> - <property name="visible">True</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - <child> - <object class="GtkEntry" id="username_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="password_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="visibility">False</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="username_label"> - <property name="visible">True</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> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="password_label"> - <property name="visible">True</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> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - </packing> - </child> - </object> - </child> - </object> - </child> - </object> - </child> - <action-widgets> - <action-widget response="0">authorize_button</action-widget> - </action-widgets> - </template> -</interface> diff --git a/src/authorize-dialog.vala b/src/authorize-dialog.vala index a6e5ab0..7cb2a66 100644 --- a/src/authorize-dialog.vala +++ b/src/authorize-dialog.vala @@ -10,15 +10,15 @@ * license. */ -[GtkTemplate (ui = "/org/gnome/SimpleScan/authorize-dialog.ui")] +[GtkTemplate (ui = "/org/gnome/SimpleScan/ui/authorize-dialog.ui")] private class AuthorizeDialog : Gtk.Dialog { [GtkChild] - private Gtk.Label authorize_label; + private unowned Gtk.Label authorize_label; [GtkChild] - private Gtk.Entry username_entry; + private unowned Gtk.Entry username_entry; [GtkChild] - private Gtk.Entry password_entry; + private unowned Gtk.Entry password_entry; public AuthorizeDialog (string title) { diff --git a/src/book-view.vala b/src/book-view.vala index 12da06f..59e2469 100644 --- a/src/book-view.vala +++ b/src/book-view.vala @@ -189,7 +189,14 @@ public class BookView : Gtk.Box private void add_cb (Book book, Page page) { - var page_view = new PageView (page); + Gdk.RGBA page_ruler_color; + if (!get_style_context ().lookup_color ("theme_fg_color", out page_ruler_color)) + { + warning ("Couldn't get theme_fg_color from GTK theme, needed to draw the page view ruler"); + /* Use a bright color so that theme makers notice it. */ + page_ruler_color.parse ("#00ff00"); + } + var page_view = new PageView (page, page_ruler_color); page_view.changed.connect (page_view_changed_cb); page_view.size_changed.connect (page_view_size_changed_cb); page_data.insert (page, page_view); diff --git a/src/help-overlay.ui b/src/help-overlay.ui deleted file mode 100644 index 105d876..0000000 --- a/src/help-overlay.ui +++ /dev/null @@ -1,162 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.17 --> - <object class="GtkShortcutsWindow" id="help_overlay"> - <property name="modal">1</property> - <child> - <object class="GtkShortcutsSection"> - <property name="visible">1</property> - <child> - <object class="GtkShortcutsGroup"> - <property name="visible">1</property> - <property name="title" translatable="yes" context="shortcut window">Scanning</property> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator"><ctrl>1</property> - <property name="title" translatable="yes" context="shortcut window">Scan a single page</property> - </object> - </child> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator"><ctrl>f</property> - <property name="title" translatable="yes" context="shortcut window">Scan all pages from document feeder</property> - </object> - </child> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator"><ctrl>m</property> - <property name="title" translatable="yes" context="shortcut window">Scan continuously from a flatbed scanner</property> - </object> - </child> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator">Escape</property> - <property name="title" translatable="yes" context="shortcut window">Stop scan in progress</property> - </object> - </child> - </object> - </child> - <child> - <object class="GtkShortcutsGroup"> - <property name="visible">1</property> - <property name="title" translatable="yes" context="shortcut window">Document Modification</property> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator">less</property> - <property name="title" translatable="yes" context="shortcut window">Move page left</property> - </object> - </child> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator">greater</property> - <property name="title" translatable="yes" context="shortcut window">Move page right</property> - </object> - </child> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator">bracketleft</property> - <property name="title" translatable="yes" context="shortcut window">Rotate page to the left (anti-clockwise)</property> - </object> - </child> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator">bracketright</property> - <property name="title" translatable="yes" context="shortcut window">Rotate page to the right (clockwise)</property> - </object> - </child> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator">Delete</property> - <property name="title" translatable="yes" context="shortcut window">Delete page</property> - </object> - </child> - </object> - </child> - <child> - <object class="GtkShortcutsGroup"> - <property name="visible">1</property> - <property name="title" translatable="yes" context="shortcut window">Document Management</property> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator"><ctrl>n</property> - <property name="title" translatable="yes" context="shortcut window">Start new document</property> - </object> - </child> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator"><ctrl>s</property> - <property name="title" translatable="yes" context="shortcut window">Save scanned document</property> - </object> - </child> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator"><ctrl>e</property> - <property name="title" translatable="yes" context="shortcut window">Email scanned document</property> - </object> - </child> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator"><ctrl>p</property> - <property name="title" translatable="yes" context="shortcut window">Print scanned document</property> - </object> - </child> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator"><ctrl>c</property> - <property name="title" translatable="yes" context="shortcut window">Copy current page to clipboard</property> - </object> - </child> - </object> - </child> - <child> - <object class="GtkShortcutsGroup"> - <property name="visible">1</property> - <property name="title" translatable="yes" context="shortcut window">General</property> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator">F1</property> - <property name="title" translatable="yes" context="shortcut window">Show help</property> - </object> - </child> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator">F10</property> - <property name="title" translatable="yes" context="shortcut window">Open menu</property> - </object> - </child> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator"><ctrl>question</property> - <property name="title" translatable="yes" context="shortcut window">Keyboard shortcuts</property> - </object> - </child> - <child> - <object class="GtkShortcutsShortcut"> - <property name="visible">1</property> - <property name="accelerator"><ctrl>q</property> - <property name="title" translatable="yes" context="shortcut window">Quit</property> - </object> - </child> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/src/meson.build b/src/meson.build index 419ed06..3f699eb 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,9 +1,5 @@ -resources = gnome.compile_resources ('resources', 'simple-scan.gresource.xml', - source_dir: '.', - c_name: 'resources') - vala_args = [ '--pkg=posix', '--vapidir=' + meson.current_source_dir () ] -dependencies = [ glib_dep, gtk_dep, zlib_dep, cairo_dep, gdk_pixbuf_dep, gusb_dep, sane_dep ] +dependencies = [ glib_dep, gtk_dep, libhandy_dep, zlib_dep, cairo_dep, gdk_pixbuf_dep, gusb_dep, sane_dep ] if colord_dep.found () vala_args += [ '-D', 'HAVE_COLORD' ] dependencies += colord_dep diff --git a/src/page-view.vala b/src/page-view.vala index 90a8071..342df27 100644 --- a/src/page-view.vala +++ b/src/page-view.vala @@ -45,6 +45,8 @@ public class PageView : Object } } + private Gdk.RGBA ruler_color; + private int ruler_width = 8; private int border_width = 2; @@ -84,9 +86,13 @@ public class PageView : Object public signal void size_changed (); public signal void changed (); - public PageView (Page page) + /* It is necessary to ask the ruler color since it is themed with the GTK */ + /* theme foreground color, and this class doesn't have any GTK widget */ + /* available to lookup the color. */ + public PageView (Page page, Gdk.RGBA ruler_color) { this.page = page; + this.ruler_color = ruler_color; page.pixels_changed.connect (page_pixels_changed_cb); page.size_changed.connect (page_size_changed_cb); page.crop_changed.connect (page_overlay_changed_cb); @@ -839,7 +845,7 @@ public class PageView : Object context.paint (); /* Draw page border */ - context.set_source_rgb (0, 0, 0); + context.set_source_rgb (ruler_color.red, ruler_color.green, ruler_color.blue); context.set_line_width (border_width); context.rectangle (0, diff --git a/src/page.vala b/src/page.vala index c6b532e..62af773 100644 --- a/src/page.vala +++ b/src/page.vala @@ -216,8 +216,8 @@ public class Page : Object this.crop_name = crop_name; this.crop_x = crop_x; this.crop_y = crop_y; - this.crop_width = crop_width; - this.crop_height = crop_height; + this.crop_width = (crop_x + crop_width > scan_width) ? scan_width : crop_width; + this.crop_height = (crop_y + crop_height > scan_height) ? scan_height : crop_height; } public void set_page_info (ScanPageInfo info) diff --git a/src/preferences-dialog.ui b/src/preferences-dialog.ui deleted file mode 100644 index 63d06e0..0000000 --- a/src/preferences-dialog.ui +++ /dev/null @@ -1,456 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> -<interface> - <requires lib="gtk+" version="3.10"/> - <object class="GtkAdjustment" id="brightness_adjustment"> - <property name="lower">-100</property> - <property name="upper">100</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> - <object class="GtkAdjustment" id="contrast_adjustment"> - <property name="lower">-100</property> - <property name="upper">100</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> - <object class="GtkListStore" id="paper_size_model"> - <columns> - <!-- column-name width --> - <column type="gint"/> - <!-- column-name height --> - <column type="gint"/> - <!-- column-name label --> - <column type="gchararray"/> - </columns> - </object> - <object class="GtkListStore" id="photo_dpi_model"> - <columns> - <!-- column-name dpi --> - <column type="gint"/> - <!-- column-name label --> - <column type="gchararray"/> - </columns> - </object> - <object class="GtkListStore" id="text_dpi_model"> - <columns> - <!-- column-name dpi --> - <column type="gint"/> - <!-- column-name label --> - <column type="gchararray"/> - </columns> - </object> - <template class="PreferencesDialog" parent="GtkDialog"> - <property name="title" translatable="yes" comments="Title of preferences dialog">Preferences</property> - <property name="resizable">False</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="orientation">vertical</property> - <property name="spacing">2</property> - <child> - <object class="GtkNotebook"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="show_border">False</property> - <child> - <object class="GtkBox"> - <property name="visible">True</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="row_spacing">15</property> - <property name="column_spacing">10</property> - <child> - <object class="GtkLabel" id="page_side_label"> - <property name="visible">True</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">front_side_button</property> - <property name="xalign">1</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="paper_size_label"> - <property name="visible">True</property> - <property name="label" translatable="yes" comments="Label beside page size combo box">_Page Size</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">paper_size_combo</property> - <property name="xalign">1</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="paper_size_combo"> - <property name="visible">True</property> - <property name="hexpand">True</property> - <property name="model">paper_size_model</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="scan_side_box"> - <property name="visible">True</property> - <property name="homogeneous">True</property> - <child> - <object class="GtkRadioButton" id="front_side_button"> - <property name="label" translatable="yes" comments="Preferences Dialog: Toggle button to select scanning on front side of a page">Front</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="active">True</property> - <property name="draw_indicator">False</property> - </object> - </child> - <child> - <object class="GtkRadioButton" id="back_side_button"> - <property name="label" translatable="yes" comments="Preferences Dialog: Toggle button to select scanning on the back side of a page">Back</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="draw_indicator">False</property> - <property name="group">front_side_button</property> - </object> - </child> - <child> - <object class="GtkRadioButton" id="both_side_button"> - <property name="label" translatable="yes" comments="Preferences Dialog: Toggle button to select scanning on both sides of a page">Both</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="draw_indicator">False</property> - <property name="group">front_side_button</property> - </object> - </child> - <style> - <class name="linked"/> - </style> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> - </child> - </object> - </child> - <child> - <object class="GtkGrid"> - <property name="visible">True</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="label" translatable="yes" comments="Label beside page delay scale">_Delay</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">page_delay_3s_button</property> - <property name="xalign">1</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</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> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">3</property> - </packing> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="homogeneous">True</property> - <child> - <object class="GtkRadioButton" id="page_delay_3s_button"> - <property name="label" translatable="yes" comments="Preferences Dialog: Toggle button to select scanning on front side of a page">3</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="active">True</property> - <property name="draw_indicator">False</property> - </object> - </child> - <child> - <object class="GtkRadioButton" id="page_delay_5s_button"> - <property name="label" translatable="yes" comments="Preferences Dialog: Toggle button to select scanning on front side of a page">5</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="active">True</property> - <property name="draw_indicator">False</property> - <property name="group">page_delay_3s_button</property> - </object> - </child> - <child> - <object class="GtkRadioButton" id="page_delay_7s_button"> - <property name="label" translatable="yes" comments="Preferences Dialog: Toggle button to select scanning on front side of a page">7</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="active">True</property> - <property name="draw_indicator">False</property> - <property name="group">page_delay_3s_button</property> - </object> - </child> - <child> - <object class="GtkRadioButton" id="page_delay_10s_button"> - <property name="label" translatable="yes" comments="Preferences Dialog: Toggle button to select scanning on front side of a page">10</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="active">True</property> - <property name="draw_indicator">False</property> - <property name="group">page_delay_3s_button</property> - </object> - </child> - <child> - <object class="GtkRadioButton" id="page_delay_15s_button"> - <property name="label" translatable="yes" comments="Preferences Dialog: Toggle button to select scanning on front side of a page">15</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="active">True</property> - <property name="draw_indicator">False</property> - <property name="group">page_delay_3s_button</property> - </object> - </child> - <style> - <class name="linked"/> - </style> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="label" translatable="yes" comments="Label after page delay radio buttons">Seconds</property> - <property name="use_underline">True</property> - <property name="xalign">1</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">1</property> - </packing> - </child> - </object> - </child> - </object> - <packing> - <property name="tab_expand">True</property> - </packing> - </child> - <child type="tab"> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="label" translatable="yes" comments="Preferences Dialog: Tab label for scanning settings">_Scanning</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="tab_fill">False</property> - </packing> - </child> - <child> - <object class="GtkBox"> - <property name="visible">True</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="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="label" translatable="yes" comments="Label beside scan resolution combo box">_Text Resolution</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">text_dpi_combo</property> - <property name="xalign">1</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="photo_dpi_label"> - <property name="visible">True</property> - <property name="label" translatable="yes" comments="Label beside scan resolution combo box">_Image Resolution</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">photo_dpi_combo</property> - <property name="xalign">1</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="text_dpi_combo"> - <property name="visible">True</property> - <property name="hexpand">True</property> - <property name="model">text_dpi_model</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="photo_dpi_combo"> - <property name="visible">True</property> - <property name="hexpand">True</property> - <property name="model">photo_dpi_model</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - </object> - </child> - <child> - <object class="GtkGrid"> - <property name="visible">True</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="label" translatable="yes" comments="Label beside brightness scale">_Brightness</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">brightness_scale</property> - <property name="xalign">1</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="contrast_label"> - <property name="visible">True</property> - <property name="label" translatable="yes" comments="Label beside contrast scale">_Contrast</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">contrast_scale</property> - <property name="xalign">1</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkScale" id="brightness_scale"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="adjustment">brightness_adjustment</property> - <property name="draw_value">False</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkScale" id="contrast_scale"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="adjustment">contrast_adjustment</property> - <property name="draw_value">False</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - </object> - </child> - </object> - <packing> - <property name="tab_expand">True</property> - </packing> - </child> - <child type="tab"> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="label" translatable="yes" comments="Preferences Dialog: Tab for quality settings">_Quality</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="tab_fill">False</property> - </packing> - </child> - </object> - </child> - </object> - </child> - </template> - <object class="GtkSizeGroup" id="label_size_group"> - <widgets> - <widget name="page_side_label"/> - <widget name="paper_size_label"/> - <widget name="page_delay_label"/> - <widget name="text_dpi_label"/> - <widget name="photo_dpi_label"/> - <widget name="brightness_label"/> - <widget name="contrast_label"/> - </widgets> - </object> -</interface> - diff --git a/src/preferences-dialog.vala b/src/preferences-dialog.vala index 06dca75..8d992ab 100644 --- a/src/preferences-dialog.vala +++ b/src/preferences-dialog.vala @@ -10,52 +10,50 @@ * license. */ -[GtkTemplate (ui = "/org/gnome/SimpleScan/preferences-dialog.ui")] -private class PreferencesDialog : Gtk.Dialog +[GtkTemplate (ui = "/org/gnome/SimpleScan/ui/preferences-dialog.ui")] +private class PreferencesDialog : Hdy.PreferencesWindow { private Settings settings; [GtkChild] - private Gtk.ComboBox text_dpi_combo; + private unowned Gtk.ComboBox text_dpi_combo; [GtkChild] - private Gtk.ComboBox photo_dpi_combo; + private unowned Gtk.ComboBox photo_dpi_combo; [GtkChild] - private Gtk.ComboBox paper_size_combo; + private unowned Gtk.ComboBox paper_size_combo; [GtkChild] - private Gtk.Scale brightness_scale; + private unowned Gtk.Scale brightness_scale; [GtkChild] - private Gtk.Scale contrast_scale; + private unowned Gtk.Scale contrast_scale; [GtkChild] - private Gtk.RadioButton page_delay_3s_button; + private unowned Gtk.RadioButton page_delay_0s_button; [GtkChild] - private Gtk.RadioButton page_delay_5s_button; + private unowned Gtk.RadioButton page_delay_3s_button; [GtkChild] - private Gtk.RadioButton page_delay_7s_button; + private unowned Gtk.RadioButton page_delay_6s_button; [GtkChild] - private Gtk.RadioButton page_delay_10s_button; + private unowned Gtk.RadioButton page_delay_10s_button; [GtkChild] - private Gtk.RadioButton page_delay_15s_button; + private unowned Gtk.RadioButton page_delay_15s_button; [GtkChild] - private Gtk.ListStore text_dpi_model; + private unowned Gtk.ListStore text_dpi_model; [GtkChild] - private Gtk.ListStore photo_dpi_model; + private unowned Gtk.ListStore photo_dpi_model; [GtkChild] - private Gtk.RadioButton front_side_button; + private unowned Gtk.RadioButton front_side_button; [GtkChild] - private Gtk.RadioButton back_side_button; + private unowned Gtk.RadioButton back_side_button; [GtkChild] - private Gtk.RadioButton both_side_button; + private unowned Gtk.RadioButton both_side_button; [GtkChild] - private Gtk.ListStore paper_size_model; + private unowned Gtk.ListStore paper_size_model; [GtkChild] - private Gtk.Adjustment brightness_adjustment; + private unowned Gtk.Adjustment brightness_adjustment; [GtkChild] - private Gtk.Adjustment contrast_adjustment; + private unowned Gtk.Adjustment contrast_adjustment; public PreferencesDialog (Settings settings) { - Object (use_header_bar: 1); - this.settings = settings; Gtk.TreeIter iter; @@ -89,10 +87,10 @@ private class PreferencesDialog : Gtk.Dialog set_dpi_combo (photo_dpi_combo, DEFAULT_PHOTO_DPI, dpi); photo_dpi_combo.changed.connect (() => { settings.set_int ("photo-dpi", get_photo_dpi ()); }); - set_page_side ((ScanType) settings.get_enum ("page-side")); - front_side_button.toggled.connect ((button) => { if (button.active) settings.set_enum ("page-side", ScanType.ADF_FRONT); }); - back_side_button.toggled.connect ((button) => { if (button.active) settings.set_enum ("page-side", ScanType.ADF_BACK); }); - both_side_button.toggled.connect ((button) => { if (button.active) settings.set_enum ("page-side", ScanType.ADF_BOTH); }); + set_page_side ((ScanSide) settings.get_enum ("page-side")); + front_side_button.toggled.connect ((button) => { if (button.active) settings.set_enum ("page-side", ScanSide.FRONT); }); + back_side_button.toggled.connect ((button) => { if (button.active) settings.set_enum ("page-side", ScanSide.BACK); }); + both_side_button.toggled.connect ((button) => { if (button.active) settings.set_enum ("page-side", ScanSide.BOTH); }); var renderer = new Gtk.CellRendererText (); paper_size_combo.pack_start (renderer, true); @@ -130,38 +128,38 @@ private class PreferencesDialog : Gtk.Dialog }); set_page_delay (settings.get_int ("page-delay")); + page_delay_0s_button.toggled.connect ((button) => { if (button.active) settings.set_int ("page-delay", 0); }); page_delay_3s_button.toggled.connect ((button) => { if (button.active) settings.set_int ("page-delay", 3000); }); - page_delay_5s_button.toggled.connect ((button) => { if (button.active) settings.set_int ("page-delay", 5000); }); - page_delay_7s_button.toggled.connect ((button) => { if (button.active) settings.set_int ("page-delay", 7000); }); + page_delay_6s_button.toggled.connect ((button) => { if (button.active) settings.set_int ("page-delay", 6000); }); page_delay_10s_button.toggled.connect ((button) => { if (button.active) settings.set_int ("page-delay", 10000); }); page_delay_15s_button.toggled.connect ((button) => { if (button.active) settings.set_int ("page-delay", 15000); }); } - private void set_page_side (ScanType page_side) + private void set_page_side (ScanSide page_side) { switch (page_side) { - case ScanType.ADF_FRONT: + case ScanSide.FRONT: front_side_button.active = true; break; - case ScanType.ADF_BACK: + case ScanSide.BACK: back_side_button.active = true; break; default: - case ScanType.ADF_BOTH: + case ScanSide.BOTH: both_side_button.active = true; break; } } - public ScanType get_page_side () + public ScanSide get_page_side () { if (front_side_button.active) - return ScanType.ADF_FRONT; + return ScanSide.FRONT; else if (back_side_button.active) - return ScanType.ADF_BACK; + return ScanSide.BACK; else - return ScanType.ADF_BOTH; + return ScanSide.BOTH; } public void set_paper_size (int width, int height) @@ -247,12 +245,12 @@ private class PreferencesDialog : Gtk.Dialog return 15000; else if (page_delay_10s_button.active) return 10000; - else if (page_delay_7s_button.active) - return 7000; - else if (page_delay_5s_button.active) - return 5000; - else + else if (page_delay_6s_button.active) + return 6000; + else if (page_delay_3s_button.active) return 3000; + else + return 0; } public void set_page_delay (int page_delay) @@ -261,12 +259,12 @@ private class PreferencesDialog : Gtk.Dialog page_delay_15s_button.active = true; else if (page_delay >= 10000) page_delay_10s_button.active = true; - else if (page_delay >= 7000) - page_delay_7s_button.active = true; - else if (page_delay >= 5000) - page_delay_5s_button.active = true; - else + else if (page_delay >= 6000) + page_delay_6s_button.active = true; + else if (page_delay >= 3000) page_delay_3s_button.active = true; + else + page_delay_0s_button.active = true; } private void set_dpi_combo (Gtk.ComboBox combo, int default_dpi, int current_dpi) @@ -276,7 +274,7 @@ private class PreferencesDialog : Gtk.Dialog combo.add_attribute (renderer, "text", 1); var model = combo.model as Gtk.ListStore; - int[] scan_resolutions = {75, 150, 300, 600, 1200, 2400}; + int[] scan_resolutions = {75, 150, 200, 300, 600, 1200, 2400}; foreach (var dpi in scan_resolutions) { string label; diff --git a/src/scan-type-adf-symbolic.svg b/src/scan-type-adf-symbolic.svg deleted file mode 100644 index 4ddb4de..0000000 --- a/src/scan-type-adf-symbolic.svg +++ /dev/null @@ -1,9 +0,0 @@ -<?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 deleted file mode 100644 index a11715d..0000000 --- a/src/scan-type-batch-symbolic.svg +++ /dev/null @@ -1,9 +0,0 @@ -<?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 becb9fa..745b779 100644 --- a/src/scanner.vala +++ b/src/scanner.vala @@ -67,18 +67,24 @@ public enum ScanMode public enum ScanType { SINGLE, - ADF_FRONT, - ADF_BACK, - ADF_BOTH, + ADF, BATCH } +public enum ScanSide +{ + FRONT, + BACK, + BOTH +} + public class ScanOptions : Object { public int dpi; public ScanMode scan_mode; public int depth; public ScanType type; + public ScanSide side; public int paper_width; public int paper_height; public int brightness; @@ -94,6 +100,7 @@ private class ScanJob : Object public ScanMode scan_mode; public int depth; public ScanType type; + public ScanSide side; public int page_width; public int page_height; public int brightness; @@ -361,7 +368,12 @@ public class Scanner : Object if (vendor == "Hewlett-Packard") vendor = "HP"; - scan_device.label = "%s %s".printf (vendor, device_list[i].model); + /* Don't repeat vendor name */ + if (device_list[i].model.down().has_prefix (vendor.down())) + scan_device.label = device_list[i].model; + else + scan_device.label = "%s %s".printf (vendor, device_list[i].model); + /* Replace underscores in name */ scan_device.label.replace ("_", " "); @@ -662,10 +674,12 @@ public class Scanner : Object switch (option.constraint_type) { case Sane.ConstraintType.RANGE: - if (option.type == Sane.ValueType.FIXED) - s += " min=%f, max=%f, quant=%d".printf (Sane.UNFIX (option.range.min), Sane.UNFIX (option.range.max), (int) option.range.quant); - else - s += " min=%d, max=%d, quant=%d".printf ((int) option.range.min, (int) option.range.max, (int) option.range.quant); + if (option.range != null) { + if (option.type == Sane.ValueType.FIXED) + s += " min=%f, max=%f, quant=%d".printf (Sane.UNFIX (option.range.min), Sane.UNFIX (option.range.max), (int) option.range.quant); + else + s += " min=%d, max=%d, quant=%d".printf ((int) option.range.min, (int) option.range.max, (int) option.range.quant); + } break; case Sane.ConstraintType.WORD_LIST: s += " values=["; @@ -682,11 +696,13 @@ public class Scanner : Object break; case Sane.ConstraintType.STRING_LIST: s += " values=["; - for (var i = 0; option.string_list[i] != null; i++) - { - if (i != 0) - s += ", "; - s += "\"%s\"".printf (option.string_list[i]); + if (option.string_list != null) { + for (var i = 0; option.string_list[i] != null; i++) + { + if (i != 0) + s += ", "; + s += "\"%s\"".printf (option.string_list[i]); + } } s += "]"; break; @@ -902,6 +918,62 @@ public class Scanner : Object state = ScanState.GET_OPTION; } + private void set_adf (ScanJob job, Sane.OptionDescriptor option, Sane.Int index) + { + string[] adf_sources = + { + "Automatic Document Feeder", + Sane.I18N ("Automatic Document Feeder"), + "ADF", + "Automatic Document Feeder(left aligned)", /* Seen in the proprietary brother3 driver */ + "Automatic Document Feeder(centrally aligned)", /* Seen in the proprietary brother3 driver */ + "ADF Simplex" /* Samsung unified driver. LP: # 892915 */ + }; + + string[] adf_front_sources = + { + "ADF Front", + Sane.I18N ("ADF Front") + }; + + string[] adf_back_sources = + { + "ADF Back", + Sane.I18N ("ADF Back") + }; + + string[] adf_duplex_sources = + { + "ADF Duplex", + "Duplex ADF", /* Brother DS-720, #157 */ + Sane.I18N ("ADF Duplex"), + "ADF Duplex - Long-Edge Binding", /* Samsung unified driver. LP: # 892915 */ + "ADF Duplex - Short-Edge Binding", + "Duplex", /* HP duplex scan support. LP: #1353599 */ + "Automatic Document Feeder(centrally aligned,Duplex)", /* Brother duplex scan support. LP: #1343773 */ + "Automatic Document Feeder(left aligned,Duplex)" + }; + + if (job.side == ScanSide.FRONT) + { + if (!set_constrained_string_option (handle, option, index, adf_front_sources, null)) + if (!set_constrained_string_option (handle, option, index, adf_sources, null)) + warning ("Unable to set front ADF source, please file a bug"); + } + else if (job.side == ScanSide.BACK) + { + if (!set_constrained_string_option (handle, option, index, adf_back_sources, null)) + if (!set_constrained_string_option (handle, option, index, adf_sources, null)) + warning ("Unable to set back ADF source, please file a bug"); + } + else if (job.side == ScanSide.BOTH) + { + if (!set_constrained_string_option (handle, option, index, adf_duplex_sources, null)) + if (!set_constrained_string_option (handle, option, index, adf_sources, null)) + warning ("Unable to set duplex ADF source, please file a bug"); + } + } + private void do_get_option () { var job = (ScanJob) job_queue.data; @@ -934,62 +1006,20 @@ public class Scanner : Object "Document Table" /* Epson scanners, eg. ET-3760 */ }; - string[] adf_sources = - { - "Automatic Document Feeder", - Sane.I18N ("Automatic Document Feeder"), - "ADF", - "Automatic Document Feeder(left aligned)", /* Seen in the proprietary brother3 driver */ - "Automatic Document Feeder(centrally aligned)", /* Seen in the proprietary brother3 driver */ - "ADF Simplex" /* Samsung unified driver. LP: # 892915 */ - }; - - string[] adf_front_sources = - { - "ADF Front", - Sane.I18N ("ADF Front") - }; - - string[] adf_back_sources = - { - "ADF Back", - Sane.I18N ("ADF Back") - }; - - string[] adf_duplex_sources = - { - "ADF Duplex", - "Duplex ADF", /* Brother DS-720, #157 */ - Sane.I18N ("ADF Duplex"), - "ADF Duplex - Long-Edge Binding", /* Samsung unified driver. LP: # 892915 */ - "ADF Duplex - Short-Edge Binding", - "Duplex", /* HP duplex scan support. LP: #1353599 */ - "Automatic Document Feeder(centrally aligned,Duplex)", /* Brother duplex scan support. LP: #1343773 */ - "Automatic Document Feeder(left aligned,Duplex)" - }; - switch (job.type) { case ScanType.SINGLE: case ScanType.BATCH: if (!set_default_option (handle, option, index)) if (!set_constrained_string_option (handle, option, index, flatbed_sources, null)) - warning ("Unable to set single page source, please file a bug"); - break; - case ScanType.ADF_FRONT: - if (!set_constrained_string_option (handle, option, index, adf_front_sources, null)) - if (!set_constrained_string_option (handle, option, index, adf_sources, null)) - warning ("Unable to set front ADF source, please file a bug"); - break; - case ScanType.ADF_BACK: - if (!set_constrained_string_option (handle, option, index, adf_back_sources, null)) - if (!set_constrained_string_option (handle, option, index, adf_sources, null)) - warning ("Unable to set back ADF source, please file a bug"); + { + warning ("Unable to set single page source, trying to set ADF instead"); + warning ("If Flatbed is existing and it is not set, please file a bug"); + set_adf (job, option, index); + } break; - case ScanType.ADF_BOTH: - if (!set_constrained_string_option (handle, option, index, adf_duplex_sources, null)) - if (!set_constrained_string_option (handle, option, index, adf_sources, null)) - warning ("Unable to set duplex ADF source, please file a bug"); + case ScanType.ADF: + set_adf (job, option, index); break; } } @@ -1067,7 +1097,7 @@ public class Scanner : Object if (option != null) { if (option.type == Sane.ValueType.BOOL) - set_bool_option (handle, option, index, job.type == ScanType.ADF_BOTH, null); + set_bool_option (handle, option, index, job.side == ScanSide.BOTH, null); } /* Non-standard Epson GT-S50 ADF options */ @@ -1082,7 +1112,7 @@ public class Scanner : Object { "Duplex" }; - if (job.type == ScanType.ADF_BOTH) + if (job.side == ScanSide.BOTH) set_constrained_string_option (handle, option, index, adf_duplex_modes, null); else set_constrained_string_option (handle, option, index, adf_simplex_modes, null); @@ -1103,7 +1133,15 @@ public class Scanner : Object } /* Set resolution and bit depth */ - option = get_option_by_name (handle, Sane.NAME_SCAN_RESOLUTION, out index); + /* Epson may have separate resolution settings for x and y axes, which is preferable options to set */ + option = get_option_by_name (handle, Sane.NAME_SCAN_X_RESOLUTION, out index); + if (option != null && (0 != (option.cap & Sane.Capability.SOFT_SELECT))) // L4160 has non-selectable separate options + { + set_fixed_or_int_option (handle, option, index, job.dpi, out job.dpi); + option = get_option_by_name (handle, Sane.NAME_SCAN_Y_RESOLUTION, out index); + } + else + option = get_option_by_name (handle, Sane.NAME_SCAN_RESOLUTION, out index); if (option == null) /* #161 Lexmark CX310dn Duplex */ option = get_option_by_name (handle, "scan-resolution", out index); if (option != null) @@ -1422,6 +1460,10 @@ public class Scanner : Object if (status == Sane.Status.NO_DOCS) { do_complete_document (); + if (page_number == 0) + fail_scan (status, + /* Error displayed when no documents at the start of scanning */ + _("Document feeder empty")); return; } @@ -1647,12 +1689,8 @@ public class Scanner : Object return "single"; case ScanType.BATCH: return "batch"; - case ScanType.ADF_FRONT: - return "adf-front"; - case ScanType.ADF_BACK: - return "adf-back"; - case ScanType.ADF_BOTH: - return "adf-both"; + case ScanType.ADF: + return "adf"; default: return "%d".printf (type); } @@ -1666,23 +1704,51 @@ public class Scanner : Object return ScanType.SINGLE; case "batch": return ScanType.BATCH; - case "adf-front": - return ScanType.ADF_FRONT; - case "adf-back": - return ScanType.ADF_BACK; - case "adf-both": - return ScanType.ADF_BOTH; + case "adf": + return ScanType.ADF; default: warning ("Unknown ScanType: %s. Please report this error.", type); return ScanType.SINGLE; } } + public static string side_to_string (ScanSide side) + { + switch (side) + { + case ScanSide.FRONT: + return "front"; + case ScanSide.BACK: + return "back"; + case ScanSide.BOTH: + return "both"; + default: + return "%d".printf (side); + } + } + + public static ScanSide side_from_string (string side) + { + switch (side) + { + case "front": + return ScanSide.FRONT; + case "back": + return ScanSide.BACK; + case "both": + return ScanSide.BOTH; + default: + warning ("Unknown ScanSide: %s. Please report this error.", side); + return ScanSide.FRONT; + } + } + public void scan (string? device, ScanOptions options) { - debug ("Scanner.scan (\"%s\", dpi=%d, scan_mode=%s, depth=%d, type=%s, paper_width=%d, paper_height=%d, brightness=%d, contrast=%d, delay=%dms)", + debug ("Scanner.scan (\"%s\", dpi=%d, scan_mode=%s, depth=%d, type=%s, side=%s, paper_width=%d, paper_height=%d, brightness=%d, contrast=%d, delay=%dms)", device != null ? device : "(null)", options.dpi, get_scan_mode_string (options.scan_mode), options.depth, - type_to_string (options.type), options.paper_width, options.paper_height, + type_to_string (options.type), side_to_string (options.side), + options.paper_width, options.paper_height, options.brightness, options.contrast, options.page_delay); var request = new RequestStartScan (); request.job = new ScanJob (); @@ -1692,6 +1758,7 @@ public class Scanner : Object request.job.scan_mode = options.scan_mode; request.job.depth = options.depth; request.job.type = options.type; + request.job.side = options.side; request.job.page_width = options.paper_width; request.job.page_height = options.paper_height; request.job.brightness = options.brightness; diff --git a/src/simple-scan.gresource.xml b/src/simple-scan.gresource.xml deleted file mode 100644 index 2348f75..0000000 --- a/src/simple-scan.gresource.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<gresources> - <gresource prefix="/org/gnome/SimpleScan"> - <file preprocess="xml-stripblanks">app-window.ui</file> - <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> -</gresources> diff --git a/src/simple-scan.vala b/src/simple-scan.vala index 3f495e5..c15a541 100644 --- a/src/simple-scan.vala +++ b/src/simple-scan.vala @@ -50,6 +50,8 @@ public class SimpleScan : Gtk.Application { base.startup (); + Hdy.init (); + app = new AppWindow (); book = app.book; app.start_scan.connect (scan_cb); @@ -1773,7 +1775,7 @@ public class SimpleScan : Gtk.Application * but will not work on KDE, LXDE, XFCE, ... */ inhibit_cookie = inhibit (app, Gtk.ApplicationInhibitFlags.IDLE, reason); - if (!is_inhibited (Gtk.ApplicationInhibitFlags.IDLE)) + if (inhibit_cookie == 0) { /* If the previous method didn't work, try the one * provided by Freedesktop. It should work with KDE, |