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



commit bd50eb5c21350761f3b12b9ed059cbb72712fc4d
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 87813099..0998439e 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 50f9b196..1f98e744 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -276,8 +276,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) {
@@ -390,9 +395,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]