[gnome-boxes] spice-display: Implement explicit file transfer



commit 6802802fc3ef0b05096c01e7d261e7508a5fa578
Author: Visarion Alexandru <viorel visarion gmail com>
Date:   Sat Nov 11 20:13:39 2017 +0200

    spice-display: Implement explicit file transfer
    
    Let's implement for SPICE displays the explicit file transfer API
    introduced in a previous patch, which enables the transfer of files
    at the click of a button.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762321

 src/spice-display.vala | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/src/spice-display.vala b/src/spice-display.vala
index 7e5af1c9..3dd02eaf 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -13,6 +13,7 @@
             return session.uri;
         }
     }
+    public override bool can_transfer_files { get { return main_channel.agent_connected; } }
     public GLib.ByteArray ca_cert { owned get { return session.ca; } set { session.ca = value; } }
 
     private weak Machine machine; // Weak ref for avoiding cyclic ref
@@ -488,6 +489,17 @@ private void main_event (ChannelEvent event) {
         }
     }
 
+    public override void transfer_files (GLib.List<string> uris) {
+        GLib.File[] files = {};
+        foreach (string uri in uris) {
+            var file = GLib.File.new_for_uri (uri);
+            files += file;
+        }
+        files += null;
+
+        main_file_copy_async.begin (main_channel, files, FileCopyFlags.NONE, null, null);
+    }
+
     public override List<Boxes.Property> get_properties (Boxes.PropertiesPage page) {
         var list = new List<Boxes.Property> ();
 


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