summaryrefslogtreecommitdiff
path: root/src/simple-scan.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2018-09-04 18:18:10 +0200
committerJörg Frings-Fürst <debian@jff.email>2018-09-04 18:18:10 +0200
commitfeffc9fa14d9edbd4cd924de55020c311607a8ff (patch)
tree82c0470b860b14b9fa075a9deb5952df0a65288a /src/simple-scan.vala
parentc7b10b6c255b81d54e165ae0564b626b0dbfad10 (diff)
New upstream version 3.30.0upstream/3.30.0
Diffstat (limited to 'src/simple-scan.vala')
-rw-r--r--src/simple-scan.vala15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/simple-scan.vala b/src/simple-scan.vala
index d029cd7..d30aa45 100644
--- a/src/simple-scan.vala
+++ b/src/simple-scan.vala
@@ -35,6 +35,7 @@ public class SimpleScan : Gtk.Application
private AppWindow app;
private Scanner scanner;
private Book book;
+ private Page scanned_page;
public SimpleScan (ScanDevice? device = null)
{
@@ -350,25 +351,24 @@ public class SimpleScan : Gtk.Application
info.width, info.height, info.depth);
/* Add a new page */
- var page = append_page ();
- page.set_page_info (info);
+ scanned_page = append_page ();
+ scanned_page.set_page_info (info);
/* Get ICC color profile */
/* FIXME: The ICC profile could change */
/* FIXME: Don't do a D-bus call for each page, cache color profiles */
- page.color_profile = get_profile_for_device (info.device);
+ scanned_page.color_profile = get_profile_for_device (info.device);
}
private void scanner_line_cb (Scanner scanner, ScanLine line)
{
- var page = book.get_page ((int) book.n_pages - 1);
- page.parse_scan_line (line);
+ scanned_page.parse_scan_line (line);
}
private void scanner_page_done_cb (Scanner scanner)
{
- var page = book.get_page ((int) book.n_pages - 1);
- page.finish ();
+ scanned_page.finish ();
+ scanned_page = null;
}
private void remove_empty_page ()
@@ -386,6 +386,7 @@ public class SimpleScan : Gtk.Application
private void scanner_failed_cb (Scanner scanner, int error_code, string error_string)
{
remove_empty_page ();
+ scanned_page = null;
if (error_code != Sane.Status.CANCELLED)
{
app.show_error_dialog (/* Title of error dialog when scan failed */