soliloque has proposed merging lp:~soliloque/simple-scan/burst into 
lp:simple-scan.

Commit message:
Add burst mode scan type

Requested reviews:
  Robert Ancell (robert-ancell)

For more details, see:
https://code.launchpad.net/~soliloque/simple-scan/burst/+merge/321243

As a simple-scan user, I routinely scan documents unfit for the charger because 
of binding or because it is made of thick paper. As of now, we must use the 
Single scan type and reach for the scan button for every page. This patch 
introduce a new scan type that use the flatbed, like Single, but run in burst 
mode, ie, after a scan is complete, it will automatically start another scan so 
we don't have to reach for the scan button but we can concentrate on putting 
the next page on the flatbed. This allow for faster, more pleasant, scanning.
-- 
Your team Simple Scan Development Team is subscribed to branch lp:simple-scan.
=== modified file 'data/simple-scan.ui'
--- data/simple-scan.ui	2016-03-17 01:51:46 +0000
+++ data/simple-scan.ui	2017-03-29 03:37:33 +0000
@@ -275,7 +275,7 @@
                                 <accelerator key="1" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                                 <signal name="activate" handler="scan_button_clicked_cb" swapped="no"/>
                               </object>
-                            </child>
+                            </child>                             
                             <child>
                               <object class="GtkMenuItem" id="scan_all_menuitem">
                                 <property name="visible">True</property>
@@ -287,6 +287,16 @@
                               </object>
                             </child>
                             <child>
+                              <object class="GtkMenuItem" id="burst_menuitem">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes" comments="Scan menu item to scan continuously from the flatbed">_Multiple Pages From Flatbed</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="m" signal="activate" modifiers="GDK_CONTROL_MASK"/>
+                                <signal name="activate" handler="burst_button_clicked_cb" swapped="no"/>
+                              </object>
+                            </child>              
+                            <child>
                               <object class="GtkMenuItem" id="stop_scan_menuitem">
                                 <property name="visible">True</property>
                                 <property name="sensitive">False</property>
@@ -1318,6 +1328,15 @@
       </object>
     </child>
     <child>
+      <object class="GtkMenuItem" id="burst_button_menuitem">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes" comments="Toolbar scan menu item to scan continuously from the flatbed">_Multiple Pages From Flatbed</property>
+        <property name="use_underline">True</property>
+        <signal name="activate" handler="burst_button_clicked_cb" swapped="no"/>
+      </object>
+    </child> 
+    <child>
       <object class="GtkSeparatorMenuItem" id="menuitem1">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
@@ -1368,6 +1387,15 @@
       </object>
     </child>
     <child>
+      <object class="GtkMenuItem" id="burst_button_hb_menuitem">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes" comments="Toolbar scan menu item to scan continuously from the flatbed">_Multiple Pages From Flatbed</property>
+        <property name="use_underline">True</property>
+        <signal name="activate" handler="burst_button_clicked_cb" swapped="no"/>
+      </object>
+    </child> 
+    <child>
       <object class="GtkSeparatorMenuItem" id="menuitem3">
         <property name="visible">True</property>
         <property name="can_focus">False</property>

=== modified file 'src/scanner.vala'
--- src/scanner.vala	2015-10-12 14:40:07 +0000
+++ src/scanner.vala	2017-03-29 03:37:33 +0000
@@ -69,7 +69,8 @@
     SINGLE,
     ADF_FRONT,
     ADF_BACK,
-    ADF_BOTH
+    ADF_BOTH,
+    BURST
 }
 
 public class ScanOptions
@@ -964,6 +965,11 @@
                         if (!set_constrained_string_option (handle, option, index, adf_sources, null))
                             warning ("Unable to set duplex ADF source, please file a bug");
                     break;
+                case ScanType.BURST:
+                    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;
                 }
             }
 
@@ -1040,7 +1046,7 @@
             if (option != null)
             {
                 if (option.type == Sane.ValueType.BOOL)
-                    set_bool_option (handle, option, index, job.type != ScanType.SINGLE, null);
+                    set_bool_option (handle, option, index, (job.type != ScanType.SINGLE) && (job.type != ScanType.BURST), null);
             }
 
             /* Disable compression, we will compress after scanning */
@@ -1550,6 +1556,8 @@
             return "ScanType.ADF_BACK";
         case ScanType.ADF_BOTH:
             return "ScanType.ADF_BOTH";
+        case ScanType.BURST:
+			return "ScanType.BURST";
         default:
             return "%d".printf (type);
         }

=== modified file 'src/ui.vala'
--- src/ui.vala	2016-11-28 10:08:17 +0000
+++ src/ui.vala	2017-03-29 03:37:33 +0000
@@ -897,6 +897,14 @@
         }
     }
 
+	[GtkCallback]
+	private void burst_button_clicked_cb (Gtk.Widget widget)
+	{
+		var options = make_scan_options ();
+		options.type = ScanType.BURST;
+		start_scan (selected_device, options);
+	}
+
     [GtkCallback]
     private void preferences_button_clicked_cb (Gtk.Widget widget)
     {

_______________________________________________
Mailing list: https://launchpad.net/~simple-scan-team
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~simple-scan-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to