[simple-scan/gnome-3-12: 11/13] Correctly select the previous device after the device list is updated



commit e14e6c1ee0a4c470f9f70873e25487ac85a7f44b
Author: Robert Ancell <robert ancell canonical com>
Date:   Tue Sep 8 15:57:53 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 6f0eb75..19f840d 100644
--- a/src/ui.vala
+++ b/src/ui.vala
@@ -377,9 +377,15 @@ public class UserInterface
         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;
 
@@ -1603,13 +1609,6 @@ public class UserInterface
         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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]