From f64f5d0c9e37828bc1a42f8e69bbc4d3d8c549f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 27 Sep 2015 14:23:15 +0200 Subject: Imported Upstream version 3.18.0 --- src/ui.vala | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'src/ui.vala') diff --git a/src/ui.vala b/src/ui.vala index 17392bc..ab1cfd4 100644 --- a/src/ui.vala +++ b/src/ui.vala @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2011 Canonical Ltd. + * Copyright (C) 2009-2015 Canonical Ltd. * Author: Robert Ancell , * Eduard Gotwig * @@ -467,9 +467,15 @@ public class UserInterface : Gtk.ApplicationWindow while (device_model.iter_nth_child (out iter, null, index)) device_model.remove (iter); - /* Select the first available device */ - if (!have_selection && devices != null) - device_combo.set_active (0); + /* Select the previously selected device or the first available device */ + if (!have_selection) + { + var device = settings.get_string ("selected-device"); + if (device != null && find_scan_device (device, out iter)) + device_combo.set_active_iter (iter); + else + device_combo.set_active (0); + } setting_devices = false; @@ -1479,7 +1485,7 @@ public class UserInterface : Gtk.ApplicationWindow "authors", authors, "translator-credits", _("translator-credits"), "website", "https://launchpad.net/simple-scan", - "copyright", "Copyright © 2009-2011 Canonical Ltd.", + "copyright", "Copyright © 2009-2015 Canonical Ltd.", "license", license, "wrap-license", true, null); @@ -1654,14 +1660,13 @@ public class UserInterface : Gtk.ApplicationWindow { var e = results.get_error_code (); /* Label shown if failed to install drivers */ - var error_text = _("Failed to install drivers (error code %d).").printf (e.code); + result_text = _("Failed to install drivers (error code %d).").printf (e.code); } - } catch (Error e) { /* Label shown if failed to install drivers */ - error_text = _("Failed to install drivers."); + result_text = _("Failed to install drivers."); warning ("Failed to install drivers: %s", e.message); } instructions_label.set_text (result_text); @@ -1952,13 +1957,6 @@ public class UserInterface : Gtk.ApplicationWindow quality = settings.get_int ("jpeg-quality"); quality_adjustment.value_changed.connect (() => { settings.set_int ("jpeg-quality", quality); }); - var device = settings.get_string ("selected-device"); - if (device != null) - { - if (find_scan_device (device, out iter)) - device_combo.set_active_iter (iter); - } - var document_type = settings.get_string ("document-type"); if (document_type != null) set_document_hint (document_type); -- cgit v1.2.3