[gnome-boxes/init-shared-folders] app, spice-display: Populate Shared Folders while connecting



commit 1de3c5bf1b5b6668d769c49f380f07302b1c7c6a
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Jun 12 11:33:35 2019 +0200

    app, spice-display: Populate Shared Folders while connecting
    
    Boxes was failing to list the users' shared folders for a machine
    because we were initializing the shared folders manager and setting
    the Spice Webdav channel shared_dir only when the Properties dialog
    was created. Now we initialize this when connecting to the machine.
    
    Fixes #372

 src/app.vala           |  1 +
 src/spice-display.vala | 10 ++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 2adbd23c..76de7511 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -44,6 +44,7 @@ public virtual async void add_source (CollectionSource source) throws GLib.Error
     public GVir.Connection default_connection { owned get { return LibvirtBroker.get_default 
().get_connection ("QEMU Session"); } }
     public CollectionSource default_source { get { return sources.get (DEFAULT_SOURCE_NAME); } }
     public AsyncLauncher async_launcher;
+    public SharedFoldersManager shared_folders_manager = SharedFoldersManager.get_default ();
 
     private uint inhibit_cookie = 0;
 
diff --git a/src/spice-display.vala b/src/spice-display.vala
index 40afdab1..28a0fb76 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -288,8 +288,13 @@ private void on_channel_new (Spice.Session session, Spice.Channel channel) {
             access_start ();
         }
 
-        if (channel is Spice.WebdavChannel)
+        if (channel is Spice.WebdavChannel) {
             webdav_channel = channel as Spice.PortChannel;
+
+            App.app.shared_folders_manager.get_folders (machine.config.uuid);
+            session.shared_dir = get_user_pkgconfig (machine.config.uuid);
+
+        }
     }
 
     private void on_channel_destroy (Spice.Session session, Spice.Channel channel) {
@@ -404,9 +409,6 @@ private void on_new_file_transfer (Spice.MainChannel main_channel, Object transf
             if (webdav_channel == null || !webdav_channel.port_opened)
                 break;
 
-            session.shared_dir = GLib.Path.build_filename (GLib.Environment.get_user_config_dir (),
-                                                           "gnome-boxes", machine.config.uuid);;
-
             var frame = create_shared_folders_frame ();
             add_property (ref list, _("Folder Shares"), new Gtk.Label (""), frame);
 


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