[simple-scan/gnome-3-4: 25/25] Correctly select the previous device after the device list is updated
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [simple-scan/gnome-3-4: 25/25] Correctly select the previous device after the device list is updated
- Date: Thu, 27 Apr 2017 09:18:55 +0000 (UTC)
commit fe7b890d9df531bf975663780c2dafc908c7ddce
Author: Robert Ancell <robert ancell canonical com>
Date: Tue Sep 8 15:59:22 2015 +1200
Correctly select the previous device after the device list is updated
src/ui.vala | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/src/ui.vala b/src/ui.vala
index 4397e6f..2e23f05 100644
--- a/src/ui.vala
+++ b/src/ui.vala
@@ -273,9 +273,15 @@ public class SimpleScan
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;
@@ -1382,13 +1388,6 @@ public class SimpleScan
var paper_height = settings.get_int ("paper-height");
set_paper_size (paper_width, paper_height);
- 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]