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



commit 0ac115007f456b42708def649d6c6e8634a9be91
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]