summaryrefslogtreecommitdiff
path: root/src/simple-scan.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2018-09-05 17:20:51 +0200
committerJörg Frings-Fürst <debian@jff.email>2018-09-05 17:20:51 +0200
commit70e9dfc97f5a3c3bde70547a0a7d586d187f7245 (patch)
tree7bc1feeb2c3fe963185697c4c8eec4b717318938 /src/simple-scan.vala
parent3fbb9230e021593a66363b97e9da4fd3f3c64c62 (diff)
parentcceb61b6d24cf8e9f915247c2a09ead260c6834b (diff)
Merge branch 'release/debian/3.30.0-1'debian/3.30.0-1
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 */