← Back to team overview

simple-scan-team team mailing list archive

[Merge] lp:~kroq-gar78/simple-scan/fix-765780 into lp:simple-scan

 

kroq-gar78 has proposed merging lp:~kroq-gar78/simple-scan/fix-765780 into lp:simple-scan.

Requested reviews:
  Simple Scan Development Team (simple-scan-team)

For more details, see:
https://code.launchpad.net/~kroq-gar78/simple-scan/fix-765780/+merge/99859

Add the page number to the first file in a multi-file scan, and start counting from one for multi-file scans.
-- 
https://code.launchpad.net/~kroq-gar78/simple-scan/fix-765780/+merge/99859
Your team Simple Scan Development Team is requested to review the proposed merge of lp:~kroq-gar78/simple-scan/fix-765780 into lp:simple-scan.
=== modified file 'src/book.vala'
--- src/book.vala	2012-03-17 01:40:08 +0000
+++ src/book.vala	2012-03-29 03:43:24 +0000
@@ -85,9 +85,6 @@
 
     private File make_indexed_file (string uri, int i)
     {
-        if (i == 0)
-            return File.new_for_uri (uri);
-
         /* Insert index before extension */
         var basename = Path.get_basename (uri);
         string prefix = uri, suffix = "";
@@ -103,7 +100,16 @@
 
     private void save_multi_file (string type, File file) throws Error
     {
-        int i = 0;
+        if (get_n_pages() == 1)
+        {
+            for (var page in pages)
+            {
+                page.save (type, File.new_for_uri (file.get_uri ()));
+                return;
+            }
+        }
+        
+        int i = 1;
         foreach (var page in pages)
         {
             page.save (type, make_indexed_file (file.get_uri (), i));


Follow ups