[simple-scan/wip/ricotz/issue79: 4/4] Correctly copy device list



commit d342992e3b6b2297accc74f14318ba25c4f5afed
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Feb 7 14:52:29 2019 +0100

    Correctly copy device list
    
    Use GLib.Object.ref is not possible while ScanDevice is simple GType class.
    
    Fixes https://gitlab.gnome.org/GNOME/simple-scan/issues/79

 src/simple-scan.vala | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/simple-scan.vala b/src/simple-scan.vala
index 0c263f0..7c0bcf2 100644
--- a/src/simple-scan.vala
+++ b/src/simple-scan.vala
@@ -105,7 +105,12 @@ public class SimpleScan : Gtk.Application
 
     private void update_scan_devices_cb (Scanner scanner, List<ScanDevice> devices)
     {
-        var devices_copy = devices.copy_deep ((CopyFunc) Object.ref);
+        List<ScanDevice> devices_copy = new List<ScanDevice> ();
+        foreach (var device in devices)
+        {
+            devices_copy.prepend (device);
+        }
+        devices_copy.reverse ();
 
         /* If the default device is not detected add it to the list */
         if (default_device != null)


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