From e9ca3b0060facd753744602a3baca5a1effdbd83 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Thu, 10 Apr 2014 15:37:02 +0100 Subject: Imported Upstream version 3.12.0 --- src/simple-scan.vala | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'src/simple-scan.vala') diff --git a/src/simple-scan.vala b/src/simple-scan.vala index 14e70ea..5ae73ab 100644 --- a/src/simple-scan.vala +++ b/src/simple-scan.vala @@ -46,7 +46,7 @@ public class SimpleScan : Gtk.Application base.startup (); ui = new UserInterface (); - book = ui.get_book (); + book = ui.book; ui.start_scan.connect (scan_cb); ui.stop_scan.connect (cancel_cb); ui.email.connect (email_cb); @@ -72,7 +72,7 @@ public class SimpleScan : Gtk.Application device_list.append (default_device); ui.set_scan_devices (device_list); - ui.set_selected_device (default_device.name); + ui.selected_device = default_device.name; } } @@ -128,9 +128,9 @@ public class SimpleScan : Gtk.Application { /* Use current page if not used */ var page = book.get_page (-1); - if (page != null && !page.has_data ()) + if (page != null && !page.has_data) { - ui.set_selected_page (page); + ui.selected_page = page; page.start (); return page; } @@ -142,20 +142,24 @@ public class SimpleScan : Gtk.Application var width = 100, height = 100, dpi = 100, cx = 0, cy = 0, cw = 0, ch = 0; if (page != null) { - scan_direction = page.get_scan_direction (); - width = page.get_width (); - height = page.get_height (); - dpi = page.get_dpi (); + scan_direction = page.scan_direction; + width = page.width; + height = page.height; + dpi = page.dpi; - do_crop = page.has_crop (); + do_crop = page.has_crop; if (do_crop) { - named_crop = page.get_named_crop (); - page.get_crop (out cx, out cy, out cw, out ch); + named_crop = page.crop_name; + cx = page.crop_x; + cy = page.crop_y; + cw = page.crop_width; + ch = page.crop_height; } } - page = book.append_page (width, height, dpi, scan_direction); + page = new Page (width, height, dpi, scan_direction); + book.append_page (page); if (do_crop) { if (named_crop != null) @@ -166,7 +170,7 @@ public class SimpleScan : Gtk.Application page.set_custom_crop (cw, ch); page.move_crop (cx, cy); } - ui.set_selected_page (page); + ui.selected_page = page; page.start (); return page; @@ -257,29 +261,25 @@ public class SimpleScan : Gtk.Application /* 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.set_color_profile (get_profile_for_device (info.device)); + 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.get_n_pages () - 1); + var page = book.get_page ((int) book.n_pages - 1); page.parse_scan_line (line); } private void scanner_page_done_cb (Scanner scanner) { - var page = book.get_page ((int) book.get_n_pages () - 1); + var page = book.get_page ((int) book.n_pages - 1); page.finish (); } private void remove_empty_page () { - var page = book.get_page ((int) book.get_n_pages () - 1); - - /* Remove a failed page */ - if (page.has_data ()) - page.finish (); - else + var page = book.get_page ((int) book.n_pages - 1); + if (!page.has_data) book.delete_page (page); } @@ -302,7 +302,7 @@ public class SimpleScan : Gtk.Application private void scanner_scanning_changed_cb (Scanner scanner) { - ui.set_scanning (scanner.is_scanning ()); + ui.scanning = scanner.is_scanning (); } private void scan_cb (UserInterface ui, string? device, ScanOptions options) @@ -320,7 +320,7 @@ public class SimpleScan : Gtk.Application else extension = "pdf"; var filename = "%s.%s".printf (filename_prefix, extension); - ui.set_default_file_name (filename); + ui.default_file_name = filename; scanner.scan (device, options); } @@ -379,7 +379,7 @@ public class SimpleScan : Gtk.Application } else { - for (var i = 0; i < book.get_n_pages (); i++) + for (var i = 0; i < book.n_pages; i++) { var path = get_temporary_filename ("scan", "jpg"); if (path == null) -- cgit v1.2.3