[gnome-boxes] app-window: Add file transfer dialog



commit 0301b9108bff4b1a1019463bc14fcf3f4f5e3685
Author: Visarion Alexandru <viorel visarion gmail com>
Date:   Wed Nov 1 16:27:49 2017 +0200

    app-window: Add file transfer dialog
    
    Add a dialog corresponding to the new "Send Files" popover action,
    through which users can send files to a guest machine which has the
    ability to receive files.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762321

 src/actions-popover.vala |  1 +
 src/app-window.vala      | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+)
---
diff --git a/src/actions-popover.vala b/src/actions-popover.vala
index 7a9e3d8c..7d1e0cdd 100644
--- a/src/actions-popover.vala
+++ b/src/actions-popover.vala
@@ -162,6 +162,7 @@ private void clone_activated () {
     }
 
     private void send_file_activated () {
+        window.show_send_file ();
     }
 
 
diff --git a/src/app-window.vala b/src/app-window.vala
index 20fd119d..e2635d3d 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -311,6 +311,29 @@ public void show_properties () {
         }
     }
 
+    public void show_send_file () {
+        var dialog = new Gtk.FileChooserDialog (
+                "Select files to transfer", this, Gtk.FileChooserAction.OPEN,
+                _("_Cancel"),
+                Gtk.ResponseType.CANCEL,
+                _("_Open"),
+                Gtk.ResponseType.ACCEPT);
+        dialog.select_multiple = true;
+
+        if (dialog.run () == Gtk.ResponseType.ACCEPT) {
+            SList<string> uris = dialog.get_uris ();
+
+            GLib.List<string> uris_param = null;
+            foreach (var uri in uris) {
+                uris_param.append (uri);
+            }
+
+            (current_item as Machine).display.transfer_files (uris_param);
+        }
+
+        dialog.destroy ();
+    }
+
     public void connect_to (Machine machine) {
         current_item = machine;
         machine.window = this;


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