After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 730259 - Allow shared folders from host to guest
Allow shared folders from host to guest
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: spice
unspecified
Other All
: Normal enhancement
: --
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
: 776230 783605 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-05-16 15:38 UTC by Lasse Schuirmann
Modified: 2017-06-15 14:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
spice-display: Add UI elements for shared folders (15.35 KB, patch)
2016-06-08 12:48 UTC, Visarion Alexandru
none Details | Review
spice-display: Add folder share in 'Device' page (12.10 KB, patch)
2016-06-24 22:35 UTC, Visarion Alexandru
none Details | Review
spice-display: Implement folder sharing (6.44 KB, patch)
2016-06-24 22:36 UTC, Visarion Alexandru
none Details | Review
spice-display: Add folder share in DEVICES page (12.72 KB, patch)
2016-06-24 22:59 UTC, Visarion Alexandru
none Details | Review
vm-configurator: Ensure WebDAV channel existence (3.41 KB, patch)
2016-06-29 21:02 UTC, Visarion Alexandru
none Details | Review
spice-display: Always check for properties after 'USB Devices' (7.45 KB, patch)
2016-07-12 13:09 UTC, Visarion Alexandru
none Details | Review
spice-display: Add 'Folder Sharing' in 'Devices' page (4.49 KB, patch)
2016-07-13 11:12 UTC, Visarion Alexandru
none Details | Review
properties-page-widget: Change 'DEVICES' page name (965 bytes, patch)
2016-07-13 11:13 UTC, Visarion Alexandru
none Details | Review
spice-display: Add 'Folder Sharing' in 'Devices' page (4.28 KB, patch)
2016-07-16 08:48 UTC, Visarion Alexandru
none Details | Review
spice-display: Implement Folder Sharing (6.20 KB, patch)
2016-07-16 09:09 UTC, Visarion Alexandru
none Details | Review
vm-configurator: Ensure WebDAV channel existence (3.38 KB, patch)
2016-07-22 15:18 UTC, Visarion Alexandru
none Details | Review
spice-display: Try to add props following 'USB Devices' (7.32 KB, patch)
2016-07-22 15:37 UTC, Visarion Alexandru
none Details | Review
props-page-widget: 'Devices' -> 'Devices & Shares' (965 bytes, patch)
2016-07-22 15:47 UTC, Visarion Alexandru
none Details | Review
spice-display: Refactor 'USB Devices' property (7.23 KB, patch)
2016-08-16 15:02 UTC, Visarion Alexandru
none Details | Review
spice-display: Add 'Folder Sharing' on 'Devices' page (3.44 KB, patch)
2016-08-16 15:03 UTC, Visarion Alexandru
none Details | Review
props-page-widget: 'Devices' -> 'Devices & Shares' (965 bytes, patch)
2016-08-16 15:04 UTC, Visarion Alexandru
none Details | Review
vm-configurator: Ensure WebDAV channel existence (3.32 KB, patch)
2016-08-16 15:05 UTC, Visarion Alexandru
none Details | Review
spice-display: Implement folder sharing (6.38 KB, patch)
2016-08-16 15:06 UTC, Visarion Alexandru
none Details | Review
vm-configurator: Ensure WebDAV channel existence (3.21 KB, patch)
2016-12-01 08:08 UTC, Visarion Alexandru
none Details | Review
props-page-widget: 'Devices' -> 'Devices & Shares' (965 bytes, patch)
2016-12-01 08:11 UTC, Visarion Alexandru
none Details | Review
spice-display: Reorganize 'USB Devices' property (7.48 KB, patch)
2016-12-01 08:12 UTC, Visarion Alexandru
none Details | Review
Add SharedFolderPopover (9.02 KB, patch)
2016-12-01 08:13 UTC, Visarion Alexandru
none Details | Review
spice-display: Add UI for 'Folder Shares' section (4.95 KB, patch)
2016-12-01 08:13 UTC, Visarion Alexandru
none Details | Review
spice-display: Implement multiple shared folders (5.80 KB, patch)
2016-12-01 08:14 UTC, Visarion Alexandru
none Details | Review
Screenshot of popup appearing in the wrong place (91.04 KB, image/png)
2017-01-04 13:24 UTC, Zeeshan Ali
  Details
Spacing issue screenshot (68.55 KB, image/png)
2017-01-04 13:25 UTC, Zeeshan Ali
  Details
vm-configurator: Ensure WebDAV channel existence (3.21 KB, patch)
2017-01-23 16:15 UTC, Visarion Alexandru
none Details | Review
props-page-widget: 'Devices' -> 'Devices & Shares' (965 bytes, patch)
2017-01-23 16:17 UTC, Visarion Alexandru
none Details | Review
spice-display: Reorganize 'USB Devices' property (7.48 KB, patch)
2017-01-23 16:18 UTC, Visarion Alexandru
none Details | Review
Add SharedFolderPopover (9.25 KB, patch)
2017-01-23 16:18 UTC, Visarion Alexandru
none Details | Review
spice-display: Add UI for 'Folder Shares' section (4.92 KB, patch)
2017-01-23 16:18 UTC, Visarion Alexandru
none Details | Review
spice-display: Implement multiple shared folders (6.08 KB, patch)
2017-01-23 16:19 UTC, Visarion Alexandru
none Details | Review
vm-configurator: Ensure WebDAV channel existence (3.21 KB, patch)
2017-01-24 12:25 UTC, Visarion Alexandru
none Details | Review
props-page-widget: 'Devices' -> 'Devices & Shares' (965 bytes, patch)
2017-01-24 12:25 UTC, Visarion Alexandru
none Details | Review
spice-display: Reorganize 'USB Devices' property (7.48 KB, patch)
2017-01-24 12:25 UTC, Visarion Alexandru
none Details | Review
Add SharedFolderPopover (9.25 KB, patch)
2017-01-24 12:25 UTC, Visarion Alexandru
none Details | Review
spice-display: Add UI for 'Folder Shares' section (5.59 KB, patch)
2017-01-24 12:26 UTC, Visarion Alexandru
none Details | Review
spice-display: Implement multiple shared folders (6.08 KB, patch)
2017-01-24 12:26 UTC, Visarion Alexandru
none Details | Review
spice-display: Add UI for 'Folder Shares' section (10.37 KB, patch)
2017-05-04 11:41 UTC, Felipe Borges
none Details | Review
vm-configurator: Ensure WebDAV channel existence (3.63 KB, patch)
2017-05-15 23:03 UTC, Visarion Alexandru
none Details | Review
props-page-widget: 'Devices' -> 'Devices & Shares' (965 bytes, patch)
2017-05-15 23:04 UTC, Visarion Alexandru
none Details | Review
spice-display: Reorganize 'USB Devices' property (7.21 KB, patch)
2017-05-15 23:05 UTC, Visarion Alexandru
none Details | Review
GResource: Order files alphabetically (2.47 KB, patch)
2017-05-15 23:05 UTC, Visarion Alexandru
none Details | Review
Add SharedFolderPopover (9.01 KB, patch)
2017-05-15 23:05 UTC, Visarion Alexandru
none Details | Review
spice-display: Add UI for 'Folder Shares' section (6.94 KB, patch)
2017-05-15 23:07 UTC, Visarion Alexandru
none Details | Review
spice-display: Implement multiple shared folders (5.97 KB, patch)
2017-05-15 23:08 UTC, Visarion Alexandru
none Details | Review
vm-configurator: Ensure WebDAV channel existence (3.63 KB, patch)
2017-06-02 10:53 UTC, Visarion Alexandru
none Details | Review
props-page-widget: 'Devices' -> 'Devices & Shares' (965 bytes, patch)
2017-06-02 10:53 UTC, Visarion Alexandru
none Details | Review
spice-display: Reorganize 'USB Devices' property (7.21 KB, patch)
2017-06-02 10:53 UTC, Visarion Alexandru
none Details | Review
GResource: Order files alphabetically (2.47 KB, patch)
2017-06-02 10:53 UTC, Visarion Alexandru
none Details | Review
Add SharedFolderPopover (9.12 KB, patch)
2017-06-02 10:53 UTC, Visarion Alexandru
none Details | Review
spice-display: Add UI for 'Folder Shares' section (6.94 KB, patch)
2017-06-02 10:55 UTC, Visarion Alexandru
none Details | Review
spice-display: Implement multiple shared folders (6.91 KB, patch)
2017-06-02 10:55 UTC, Visarion Alexandru
none Details | Review
spice-display: Store shared folders using GSettings (7.53 KB, patch)
2017-06-02 10:55 UTC, Visarion Alexandru
none Details | Review
vm-configurator: Ensure WebDAV channel existence (3.63 KB, patch)
2017-06-05 16:30 UTC, Visarion Alexandru
committed Details | Review
props-page-widget: 'Devices' -> 'Devices & Shares' (965 bytes, patch)
2017-06-05 16:30 UTC, Visarion Alexandru
committed Details | Review
spice-display: Reorganize 'USB Devices' property (7.21 KB, patch)
2017-06-05 16:30 UTC, Visarion Alexandru
committed Details | Review
GResource: Order files alphabetically (2.47 KB, patch)
2017-06-05 16:31 UTC, Visarion Alexandru
committed Details | Review
Add SharedFolderPopover (9.12 KB, patch)
2017-06-05 16:31 UTC, Visarion Alexandru
committed Details | Review
spice-display: Add UI for 'Folder Shares' section (6.94 KB, patch)
2017-06-05 16:31 UTC, Visarion Alexandru
committed Details | Review
spice-display: Implement multiple shared folders (6.91 KB, patch)
2017-06-05 16:31 UTC, Visarion Alexandru
committed Details | Review
spice-display: Store shared folders using GSettings (7.53 KB, patch)
2017-06-05 16:31 UTC, Visarion Alexandru
committed Details | Review

Description Lasse Schuirmann 2014-05-16 15:38:57 UTC
We currently have no means (which the user knows of) to transfer files from and to a VM. (Other than making an ISO out of it manually - but this isn't a gnomish solution in my eyes.)

Quote from a discussion via email:
>> We currently can't really exchange files from host to client, can we?
>
> We can, using the drag and drop support of spice. Its not obvious or
> nice for large files (no progressbar) and its not obvious where the
> file went.
I just tried it. I don't have any idea if or where the file should be on the VM. IMHO if we want the users to use this we have to be a bit verbose about us having this feature and how it works.


> Would be great to mount not
> only an ISO into clients DVD drive or so but also to have a shared
> drive which is a USB memory stick on the client and somehow available
> on the host or so.
This way we'd have a transparent file exchange in both directions.
elmarco: zeenix said you did some similar things in spice. Do you have more information about this?
Comment 1 Marc-Andre Lureau 2014-05-16 16:41:44 UTC
(In reply to comment #0)
> > Would be great to mount not
> > only an ISO into clients DVD drive or so but also to have a shared
> > drive which is a USB memory stick on the client and somehow available
> > on the host or so.
> This way we'd have a transparent file exchange in both directions.
> elmarco: zeenix said you did some similar things in spice. Do you have more
> information about this?

Yes, there is a "webdav" channel feature that is not yet fully ready. Well, it is working, but all components have not been released, and testing has been very limited so far. Feel free to give it a try, there are some pretty complete instructions here:

http://lists.freedesktop.org/archives/spice-devel/2014-April/016582.html

Based on that folder sharing, I think we could implement later a better "native" file drag-and-drop..
Comment 2 Marc-Andre Lureau 2014-05-16 16:48:06 UTC
btw, I was planning to add Boxes support soonish, however it's a bit hard to test that all required packages version are being used. In particular a yet-to-be-released-version of spice server, and qemu "master" (1.7 stable branch still has a virtio/spice port bounding bug). Neverthess, the libvirt-glib bits are now upstream ready to be consummed by boxes, after a release happen ;)
Comment 3 Lasse Schuirmann 2014-05-16 16:57:16 UTC
Sounds great :) I see forward to this.
Comment 4 Zeeshan Ali 2014-10-18 12:41:25 UTC
(In reply to comment #2)
> btw, I was planning to add Boxes support soonish, however it's a bit hard to
> test that all required packages version are being used. In particular a
> yet-to-be-released-version of spice server, and qemu "master" (1.7 stable
> branch still has a virtio/spice port bounding bug). Neverthess, the
> libvirt-glib bits are now upstream ready to be consummed by boxes, after a
> release happen ;)

I'm hoping everything is merged and release by now? If so, if you could work on this before 3.16, that would be immensely appreciated.
Comment 5 Zeeshan Ali 2014-12-11 22:12:39 UTC
(In reply to comment #4)
> (In reply to comment #2)
> > btw, I was planning to add Boxes support soonish, however it's a bit hard to
> > test that all required packages version are being used. In particular a
> > yet-to-be-released-version of spice server, and qemu "master" (1.7 stable
> > branch still has a virtio/spice port bounding bug). Neverthess, the
> > libvirt-glib bits are now upstream ready to be consummed by boxes, after a
> > release happen ;)
> 
> I'm hoping everything is merged and release by now? If so, if you could work on
> this before 3.16, that would be immensely appreciated.

Hello? Marc-Andre thats for you. If you don't have time for this anytime soon, please say so I could allocate time to look into this.
Comment 6 Marc-Andre Lureau 2014-12-12 12:16:54 UTC
Please look into it, it should be fairly straightforward.
See also https://elmarco.fedorapeople.org/manual.html#_folder_sharing
Comment 7 Zeeshan Ali 2014-12-12 13:43:48 UTC
(In reply to comment #6)
> Please look into it, it should be fairly straightforward.
> See also https://elmarco.fedorapeople.org/manual.html#_folder_sharing

Cool! Will do. Thanks.
Comment 8 Zeeshan Ali 2014-12-12 19:13:45 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Please look into it, it should be fairly straightforward.
> > See also https://elmarco.fedorapeople.org/manual.html#_folder_sharing
> 
> Cool! Will do. Thanks.

Actually its not very straightforward at all since it requires configuration in the guest. :( I guess it'll be something that we can make it to work out of the box with express installations only. The linux part should be easy (depending on whether we want libosinfo's script templates to unconditionally install the package(s) or not) but windows one would need some digging and work.
Comment 9 Marc-Andre Lureau 2015-01-19 23:22:52 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > (In reply to comment #6)
> > > Please look into it, it should be fairly straightforward.
> > > See also https://elmarco.fedorapeople.org/manual.html#_folder_sharing
> > 
> > Cool! Will do. Thanks.
> 
> Actually its not very straightforward at all since it requires configuration in
> the guest. :( I guess it'll be something that we can make it to work out of the
> box with express installations only. The linux part should be easy (depending
> on whether we want libosinfo's script templates to unconditionally install the
> package(s) or not) but windows one would need some digging and work.

I can see several ways you could get spice-webdavd running the guest, for example, you could use virt-customize or use qemu-ga with nasty tricks... (assuming it is already installed - it should)
Comment 10 Zeeshan Ali 2015-05-21 22:28:44 UTC
Ok, first things first. Let's first try to get this working in new VMs through express installation.
Comment 12 Bastien Nocera 2016-02-19 13:58:51 UTC
Why not a GtkFileChooserButton for the source selection, instead of an entry/button combo?
Comment 13 Victor Toso 2016-02-19 14:10:26 UTC
(In reply to Zeeshan Ali (Khattak) from comment #10)
> Ok, first things first. Let's first try to get this working in new VMs
> through express installation.

With express installation I guess that you mean by having spice-webdavd into spice-guest-tools for windows or is there anything else?
Comment 14 Zeeshan Ali 2016-02-19 14:39:51 UTC
(In reply to Victor Toso from comment #13)
> (In reply to Zeeshan Ali (Khattak) from comment #10)
> > Ok, first things first. Let's first try to get this working in new VMs
> > through express installation.
> 
> With express installation I guess that you mean by having spice-webdavd into
> spice-guest-tools for windows or is there anything else?

Also on Linux guests, we need to ensure right packages are installed as part of express installation.
Comment 15 Zeeshan Ali 2016-02-19 14:42:09 UTC
(In reply to Bastien Nocera from comment #12)
> Why not a GtkFileChooserButton for the source selection, instead of an
> entry/button combo?

? The "Browse" button is supposed to be a GtkFileChooserButton AFAICT.
Comment 16 Bastien Nocera 2016-02-19 14:45:20 UTC
(In reply to Zeeshan Ali (Khattak) from comment #15)
> (In reply to Bastien Nocera from comment #12)
> > Why not a GtkFileChooserButton for the source selection, instead of an
> > entry/button combo?
> 
> ? The "Browse" button is supposed to be a GtkFileChooserButton AFAICT.

Look at what a GtkFileChooserButton looks like, and you can see that it will show the name of the selected directory, which is redundant with an entry (which the file chooser dialogue already has).
Comment 17 Visarion Alexandru 2016-06-08 12:48:27 UTC
Created attachment 329379 [details] [review]
spice-display: Add UI elements for shared folders

We need these new UI elements so that we can implement the
new shared folders feature.

Add a shared folders section to the properties of SPICE.

Add a dialog for user input of shared folders.
Comment 18 Visarion Alexandru 2016-06-22 16:01:25 UTC
Review of attachment 329379 [details] [review]:

Not good. I need to use a popover instead of a dialog and to consider the fact that we can currently have a single shared folder at a time.
Comment 19 Visarion Alexandru 2016-06-24 22:35:53 UTC
Created attachment 330342 [details] [review]
spice-display: Add folder share in 'Device' page

This new section in the SPICE-display properties' 'DEVICE'
page will be used by the new Folder Sharing feature.
Comment 20 Visarion Alexandru 2016-06-24 22:36:24 UTC
Created attachment 330343 [details] [review]
spice-display: Implement folder sharing
Comment 21 Visarion Alexandru 2016-06-24 22:59:42 UTC
Created attachment 330344 [details] [review]
spice-display: Add folder share in DEVICES page

This new section in the SPICE-display properties' DEVICES
page will be used by the new folder sharing feature.

Change the DEVICES page name from "Devices" to "Devices & Share",
in order to accomodate the new feature.
Comment 22 Zeeshan Ali 2016-06-28 13:47:38 UTC
Review of attachment 330343 [details] [review]:

No description of what is meant by folder sharing. :( From the title, it sounds like it implement the whole feature (especially due to lack of any description).

::: src/spice-display.vala
@@ +27,3 @@
     private bool closed;
 
+    private bool _share_folder;

* For simple properties, you don't need this, nor your own getter/setter implementation:

public bool share_folder { get; set; }

* Let's use the term "shared_folder" rather than "share_folder".

@@ +38,3 @@
+    }
+    private string _shared_folder;
+    private bool _share_folder_ro;

So you are going to have only 1 shared folder at time? That's not the design. We want user to be able to add/remove shared folders.

@@ +321,3 @@
     }
 
+    private void update_share_folder (Spice.Session session, bool share_folder) {

* No need to pass session to this instance method.
* share -> shared (in other places too).
* I think sharing of folders should always be enabled. Which folders to share, is what the UI should decide.

@@ +443,3 @@
+                    if(!can_share_folder (session)) {
+                        folder_share_toggle.active = false;
+                        got_error ("Please install spice-webdavd in guest.");

* Erroring out this late will make up for a horrible user experience. We should not be showing the folder sharing UI if guest can't handle it. Instead we should show a nice message telling user to install needed tools, preferably with a link to where to get them from.

* These messages go to UI and hence need to be nice and marked for translation.
Comment 23 Zeeshan Ali 2016-06-28 13:47:39 UTC
Review of attachment 330343 [details] [review]:

No description of what is meant by folder sharing. :( From the title, it sounds like it implement the whole feature (especially due to lack of any description).

::: src/spice-display.vala
@@ +27,3 @@
     private bool closed;
 
+    private bool _share_folder;

* For simple properties, you don't need this, nor your own getter/setter implementation:

public bool share_folder { get; set; }

* Let's use the term "shared_folder" rather than "share_folder".

@@ +38,3 @@
+    }
+    private string _shared_folder;
+    private bool _share_folder_ro;

So you are going to have only 1 shared folder at time? That's not the design. We want user to be able to add/remove shared folders.

@@ +321,3 @@
     }
 
+    private void update_share_folder (Spice.Session session, bool share_folder) {

* No need to pass session to this instance method.
* share -> shared (in other places too).
* I think sharing of folders should always be enabled. Which folders to share, is what the UI should decide.

@@ +443,3 @@
+                    if(!can_share_folder (session)) {
+                        folder_share_toggle.active = false;
+                        got_error ("Please install spice-webdavd in guest.");

* Erroring out this late will make up for a horrible user experience. We should not be showing the folder sharing UI if guest can't handle it. Instead we should show a nice message telling user to install needed tools, preferably with a link to where to get them from.

* These messages go to UI and hence need to be nice and marked for translation.
Comment 24 Visarion Alexandru 2016-06-28 13:54:32 UTC
Review of attachment 330343 [details] [review]:

::: src/spice-display.vala
@@ +38,3 @@
+    }
+    private string _shared_folder;
+    public string shared_folder {

Currently, SPICE doesn't have the ability to handle multiple shared folders at a time. I can make the design handle multiple shared folders, but the user would have to always select one of them.
Comment 25 Visarion Alexandru 2016-06-28 14:02:45 UTC
Review of attachment 330343 [details] [review]:

::: src/spice-display.vala
@@ +27,3 @@
     private bool closed;
 
+    private bool _share_folder;

i though of it this way:
share_folder is true if we do share a folder/false otherwise.
shared_folder is the actual shared_folder ( regardless of the the design, it will always be one shared_folder)

We need both info, so I think that using the term shared_folder rather than share_folder may be a little confusing.
Comment 26 Visarion Alexandru 2016-06-29 21:02:49 UTC
Created attachment 330625 [details] [review]
vm-configurator: Ensure WebDAV channel existence

Because folder sharing has been implemented in GNOME-Boxes, we now
have to make sure that the WebDAV channel always exists in the
machine's XML configuration file, for the feature to work correcty.
Comment 27 Zeeshan Ali 2016-06-30 15:58:41 UTC
Review of attachment 330343 [details] [review]:

::: src/spice-display.vala
@@ +27,3 @@
     private bool closed;
 
+    private bool _share_folder;

Yeah, makes sense then but I don't see why wee need a separate boolean property for enabling/sharing. A value of null for "shared_folder" property should flag disabling folder sharing I think.
Comment 28 Visarion Alexandru 2016-07-01 12:03:16 UTC
Review of attachment 330343 [details] [review]:

::: src/spice-display.vala
@@ +27,3 @@
     private bool closed;
 
+    private bool _share_folder;

I get what you mean, but there are certain implications to know before taking this decision:
1. We won't be able to save the value of shared_folder accross display disconnections (you can't save a null parameter apparently)
2. Session.shared_dir is not allowed to be null (we get a segmentation fault otherwise), so we would have to loose the binding to shared_folder and create a more elaborate setter method for the shared_folder property.


Also, referring to your comment on not needing my own getter/setter for simple properties, we need public getter/setter to save the properties in between display connection/disconnection.
When we will implement the multiple folder sharing, will we expect the user to input all the data again each time connecting to a machine ? It's a similar case here, on a minor scale.
Comment 29 Zeeshan Ali 2016-07-01 17:02:09 UTC
Review of attachment 330343 [details] [review]:

::: src/spice-display.vala
@@ +27,3 @@
     private bool closed;
 
+    private bool _share_folder;

1: Well why can't you modify BoxConfig.save_property to be able to handle null string property?

2. You can have custom property binding.

about getter/setter, you are not doing anything at all other than what the default getter/setter do for you. So I don't know what you mean.

@@ +38,3 @@
+    }
+    private string _shared_folder;
+    private bool _share_folder_ro;

And apparently we can't query the path in the guest either. :( Can we at least give users a URL to connect to in the guest, like new mockups show?
Comment 30 Visarion Alexandru 2016-07-12 13:09:36 UTC
Created attachment 331325 [details] [review]
spice-display: Always check for properties after 'USB Devices'

Currently, if USB devices are not enabled or are not found, we no
longer try to add any other property to the properties list.

The problem is that we will need to add another section,
'Folder Sharing' to the properties of spice-display, which
will follow 'USB Devices', so this behaviour isn't a valid
one anymore and thus needs to be changed.
Comment 31 Visarion Alexandru 2016-07-12 14:22:53 UTC
Review of attachment 330343 [details] [review]:

::: src/spice-display.vala
@@ +38,3 @@
+    }
+    private string _shared_folder;
+    public string shared_folder {

This URL, although not quite good looking, appears to be constant for any local folder name or any machine.
dav+sd://Spice%2520client%2520folder._webdav._tcp.local/

Should I put this URL in the message from the mockups ?
Also, we won't have much to do with the Name entry, so it shouldn't appear in the UI for the moment.
Comment 32 Visarion Alexandru 2016-07-13 11:12:28 UTC
Created attachment 331402 [details] [review]
spice-display: Add 'Folder Sharing' in 'Devices' page

Add a new section in the DEVICES property page of a SPICE display,
which will be used to further implement the Folder Sharing feature.
Comment 33 Visarion Alexandru 2016-07-13 11:13:12 UTC
Created attachment 331403 [details] [review]
properties-page-widget: Change 'DEVICES' page name

Change the 'DEVICES' page name to 'Devices & Shares', in order to
accomodate the new 'Folder Sharing' section.
Comment 34 Visarion Alexandru 2016-07-16 08:48:51 UTC
Created attachment 331617 [details] [review]
spice-display: Add 'Folder Sharing' in 'Devices' page

Add a new section in the DEVICES property page of a SPICE display,
which will be used to further implement the Folder Sharing feature.
Comment 35 Visarion Alexandru 2016-07-16 09:09:51 UTC
Created attachment 331619 [details] [review]
spice-display: Implement Folder Sharing

Let the user enable and choose a shared folder from the host
machine to a guest machine with SPICE display.

This feature requires the WebDAV Channel to be present in the
guest's configuration and spice-webdavd to be installed
in the guest, which will be ensured in following patches.
Comment 36 Zeeshan Ali 2016-07-22 12:53:26 UTC
Review of attachment 330343 [details] [review]:

::: src/spice-display.vala
@@ +38,3 @@
+    }
+    private string _shared_folder;
+    private bool _share_folder_ro;

That URL looks ugly cause of escape characters for spaces in URLs. who's genious idea was to provide a URL with spaces in it? :(

Anyway, we need to add API to query this URL and not just assume it. Given that URL is ugly and I do hope it changes at some point, it's further bad idea to assume it.
Comment 37 Zeeshan Ali 2016-07-22 13:03:05 UTC
Review of attachment 330625 [details] [review]:

"Because folder sharing has been implemented in GNOME-Boxes" is it? this is the first patch in the series so that is definitely not true.

::: src/vm-configurator.vala
@@ +92,3 @@
+        spice_port.set_channel ("org.spice-space.webdav.0");
+        channel_webdav.set_source (spice_port);
+        channel_webdav.set_target_name ("org.spice-space.webdav.0");

Surely you see that you have 7 lines here that are duplicated below? Guess what I want you to do here? :)
Comment 38 Zeeshan Ali 2016-07-22 13:29:19 UTC
Review of attachment 331325 [details] [review]:

I do apprecicate your effort to split the patch here but shortlog is pretty bad and sounds incorrect.

::: src/spice-display.vala
@@ +338,3 @@
                 var devs = get_usb_devices (manager);
 
+                if (devs.length > 0 && !(PropertyCreationFlag.NO_USB in flags) && Config.HAVE_USBREDIR && connected) {

PropertyCreationFlag.NO_USB has been dropped so you gotta rebase and see if this patch is really needed.
Comment 39 Zeeshan Ali 2016-07-22 13:47:54 UTC
Review of attachment 331403 [details] [review]:

Shortlog is missing the most important info: Changed to what? You could always shorten "properties" to "props" in shortlog prefix and use "X -> Y" to summarize a rename.
Comment 40 Visarion Alexandru 2016-07-22 15:18:19 UTC
Created attachment 332004 [details] [review]
vm-configurator: Ensure WebDAV channel existence

We have to make sure that the WebDAV channel always exists in the
machine's XML configuration file, for the planned shared folders
feature to work.
Comment 41 Zeeshan Ali 2016-07-22 15:23:01 UTC
Review of attachment 331617 [details] [review]:

shortlog: "in" -> "on".

"Implement.. feature" term is very generic and should be avoided whenever possible. You could simply go with "Add UI for folder sharing, which will be implemented in a following patch".

::: data/gtk-style.css
@@ +66,3 @@
+.boxes-folder-sharing-notice-label {
+    color: #808080;
+    font-style: italic;

I don't think they are in italic, nor a different color in the mockup. Check again.

::: src/spice-display.vala
@@ +403,3 @@
             }
+
+            var frame_folder_share = new Gtk.Frame (null);

your naming scheme seems to be reversed: folder_share_frame. For local variables, you don't have to give very unique names. This could be just "frame".

@@ +436,3 @@
+            hbox_local_folder.pack_start (entry_folder_share);
+
+            var message = _("The local folder above can be accessed in the box by browsing to:\ndav+sd://Spice%2520client%2520folder._webdav._tcp.local/");

so with this naming scheme, reader would think this variable holds some pointer to directory holding images, rather than an image of directory icon.
Comment 42 Visarion Alexandru 2016-07-22 15:37:49 UTC
Created attachment 332007 [details] [review]
spice-display: Try to add props following 'USB Devices'

Currently, if USB devices are not enabled or are not found, we no
longer try to add any other property to the properties list.

The problem is that we will need to add another section,
'Folder Sharing' to the properties of spice-display, which
will follow 'USB Devices', so this behaviour isn't a valid
one anymore and thus needs to be changed.
Comment 43 Zeeshan Ali 2016-07-22 15:41:15 UTC
Review of attachment 331619 [details] [review]:

Not sure why you capitalise "folder sharing". We only do that in label/titles in UI and we capitalise all words there.

Since you are implementing it entirely in spice-display module, I'm guessing this will also enable it for SPICE remote boxes and hence you desrciption needs to be changed to not give the wrong impression that this is only for VMs.

Not sure why you capitalized "Channel" either. You want to mention that you are talking of local VMs in the last para. Oh and I'm guessing you didn't fix the order of patches since you actually add guest config in a previous patch.

::: src/spice-display.vala
@@ +318,3 @@
+                    channel.connect ();
+                else
+        foreach (var channel in channel_list) {

* Do we really need to disconnect from the channel? Can't we always connect to it?

* Won't this break after these steps:
  * User unselects the toggle (and shared_folder is set to "").
  * User selects the toggle (shared_folder is still set to "" so we'll try to disconnect again here.

?

@@ +502,3 @@
+            if (shared_folder != "")
+                entry_folder_share.text = shared_folder;
+            entry_folder_share.bind_property ("text", this, "shared-folder", BindingFlags.DEFAULT);

Same thing about reversed naming scheme.
Comment 44 Visarion Alexandru 2016-07-22 15:47:52 UTC
Created attachment 332010 [details] [review]
props-page-widget: 'Devices' -> 'Devices & Shares'

Change the 'DEVICES' page name to 'Devices & Shares', in order to
accomodate the new 'Folder Sharing' section.
Comment 45 Visarion Alexandru 2016-08-13 14:26:20 UTC
Review of attachment 331619 [details] [review]:

::: src/spice-display.vala
@@ +318,3 @@
+                    channel.connect ();
+                else
+                    channel.disconnect (Spice.ChannelEvent.NONE);

We could always connect to it. We do want the user to be able to disconnect it, so the only option would be to just set the empty string as shared directory, which makes the guest's shared folder drive return an error. I am not sure if this is a desirable behaviour, though.

SPICE doesn't seem to mind disconnecting from an already disconnected channel.
Comment 46 Zeeshan Ali 2016-08-15 18:07:38 UTC
Review of attachment 331619 [details] [review]:

::: src/spice-display.vala
@@ +318,3 @@
+                    channel.connect ();
+                else
+        foreach (var channel in channel_list) {

No it's not a desired behaviour. I thought we want to set the shared foler on spice to null in that case and SPICE is able to handle that? If not, I guess we just go with this solution.
Comment 47 Visarion Alexandru 2016-08-16 15:00:43 UTC
Review of attachment 331619 [details] [review]:

::: src/spice-display.vala
@@ +318,3 @@
+                    channel.connect ();
+                else
+                    channel.disconnect (Spice.ChannelEvent.NONE);

SPICE can't handle a null shared directory (seg fault), but that wouldn't stop us from considering the null shared folder as no shared folder.
The arguments for using the empty string instead of the null value are the following:
1) When retrieving the saved value for shared folder, the null value can't be retrieved as null, but maybe as an empty string --> requires some workarounds
2) The user can actually set the shared folder to an empty string (leaving the entry empty) and this must be considered as 'no shared folder' --> more workarounds

Either we would have many workarounds and extra custom bindings (I actually tried it and the code can become very complicated to follow and ugly) or we would consider both "" and null as 'no shared folder', which is more or less the same as using only 
"", but with the need to always check both cases.

I can prepare the version with the workarounds and custom bindings if you want, for comparison.
Comment 48 Visarion Alexandru 2016-08-16 15:02:11 UTC
Created attachment 333423 [details] [review]
spice-display: Refactor 'USB Devices' property

The current way the code is organized doesn't allow for another
section to be further added after the 'USB Devices' section.

Based on the folder sharing UI mockups, we will add another
'Folder Sharing' section after 'USB Devices', so we need
some code refactoring.
Comment 49 Visarion Alexandru 2016-08-16 15:03:17 UTC
Created attachment 333424 [details] [review]
spice-display: Add 'Folder Sharing' on 'Devices' page

Add UI for folder sharing, which will be implemented in
following patches.
Comment 50 Visarion Alexandru 2016-08-16 15:04:05 UTC
Created attachment 333425 [details] [review]
props-page-widget: 'Devices' -> 'Devices & Shares'

Change the 'DEVICES' page name to 'Devices & Shares', in order to
accomodate the new 'Folder Sharing' section.
Comment 51 Visarion Alexandru 2016-08-16 15:05:06 UTC
Created attachment 333426 [details] [review]
vm-configurator: Ensure WebDAV channel existence

We have to make sure that the WebDAV channel always exists in the
machine's XML configuration file, for the planned shared folders
feature to work on local machines.
Comment 52 Visarion Alexandru 2016-08-16 15:06:35 UTC
Created attachment 333427 [details] [review]
spice-display: Implement folder sharing

Let the user enable and choose a shared folder between the host
machine and a local or remote machine with SPICE display.

This feature requires the WebDAV channel to be present in the
guest's configuration, which was ensured for local machines in
a previous patch. It also requires spice-webdavd to be installed
in the guest machine, which will be ensured for local machines
in following patches to libosinfo and spice-nsis.
Comment 53 Visarion Alexandru 2016-09-13 15:52:04 UTC
About the segmentation fault I receive when setting the session.shared_dir to null:
* This happens when trying to access the null shared folder from inside the guest machine.
* It's very ugly and renders my host machine useless (fedora 24)
* I can't get the backtrace because I am no longer able to type in the terminal, but I manually copied this message on my cellphone:

Thread 1 "gnome-boxes" received signal SIGSEGV, Segmentation fault.
soup_server_accept_socket (server=server@entry=0x0, sock=sock@entry=0x199f2c0)
at /home/alex/spice/libsoup/libsoup/soup-server.c
1461 priv->clients = g_slist_prepend (priv->clients, client);
Comment 54 Christophe Fergeau 2016-09-13 16:42:51 UTC
Pasting messages from IRC in case they are useful here:

18:06 < teuf> visarion: you can't type because keyboard input does not get through?
18:06 < teuf> if that's because of this that you can't type, you've got 2 ways of avoiding this
18:06 < teuf> 1st is to set SPICE_NOGRAB in your environment
18:07 < teuf> the other would be to run gdb in screen/tmux
18:07 < teuf> and switch to a VT (ctrl + alt + fN) when the crash happens
18:07 < teuf> and get back your gdb session from there
18:07 < teuf> as soon as you kill boxes, you'll get back the keyboard I think
Comment 55 Zeeshan Ali 2016-10-04 08:10:28 UTC
Review of attachment 331619 [details] [review]:

::: src/spice-display.vala
@@ +318,3 @@
+                    channel.connect ();
+                else
+        foreach (var channel in channel_list) {

Assuming for sake of arguments, these really are workarounds, the solution to avoid workarounds is not to treat them as solutions. The string should be null everywhere but if it can't be (in other components), it's not at all complicated to convert between "" and null. Using "" as unset string is weird.

The crash should have been fixed in SPICE.
Comment 56 Zeeshan Ali 2016-10-04 08:43:48 UTC
Review of attachment 333423 [details] [review]:

::: src/spice-display.vala
@@ +338,3 @@
                 var devs = get_usb_devices (manager);
 
+                if (devs.length > 0 && connected) {

Large blocks of code are ugly already and the more indented (nested) they are, the uglier they get. I'd rather you move the code to another function and only indent the call. Besides, "Refactor" in the commit message implies a clean-up and this is quite the opposite of clean-up.

Having said that, a lot of this code will be removed hopefully soon after I finish my work on big properties code clean-up and move all properties UI setup to .ui files. It's in branch wip/props-ui-files if you are interested to see.

Having said that (#2), if you finish act on the first para before I'm done with my branch, you'll be the winner and I'll have to rebase. :)
Comment 57 Zeeshan Ali 2016-10-04 08:48:11 UTC
Review of attachment 333424 [details] [review]:

::: src/spice-display.vala
@@ +402,3 @@
             } catch (GLib.Error error) {
             }
+

After the previous review, I see that you are making an already pretty huge function even bigger. Could you please put all this code in a separate function?
Comment 58 Zeeshan Ali 2016-10-04 08:48:24 UTC
Review of attachment 333425 [details] [review]:

ack
Comment 59 Zeeshan Ali 2016-10-04 08:53:07 UTC
Review of attachment 333426 [details] [review]:

ack
Comment 60 Zeeshan Ali 2016-10-04 09:02:58 UTC
Review of attachment 333427 [details] [review]:

::: src/spice-display.vala
@@ +265,3 @@
+        if (channel is Spice.WebdavChannel) {
+            shared_folder_id = notify["shared-folder"].connect ( () => {
+                if (shared_folder != "") {

still not sure about using "" as null.

@@ +637,3 @@
 
+            if (channel is Spice.WebdavChannel && display.shared_folder != "")
+                channel.open_fd (-1);

* why do we need to explicitly open this channel ourselves?

* IMO it will be more obvious what's going on if you just pass it our fd directly, or just call on_open_fd() yourself directly here.
Comment 61 Visarion Alexandru 2016-12-01 08:08:52 UTC
Created attachment 341117 [details] [review]
vm-configurator: Ensure WebDAV channel existence

We have to make sure that the WebDAV channel always exists in the
machine's XML configuration file, for the planned shared folders
feature to work on local machines.
Comment 62 Visarion Alexandru 2016-12-01 08:10:37 UTC
Review of attachment 341117 [details] [review]:

was accepted, but I altered it a little because of the "vm-configurator: Don't access invalid device objects" previous patch
Comment 63 Visarion Alexandru 2016-12-01 08:11:19 UTC
Created attachment 341118 [details] [review]
props-page-widget: 'Devices' -> 'Devices & Shares'

Change the 'DEVICES' page name to 'Devices & Shares', in order to
accomodate the new 'Folder Sharing' section.
Comment 64 Visarion Alexandru 2016-12-01 08:11:47 UTC
Review of attachment 341118 [details] [review]:

was accepted
Comment 65 Visarion Alexandru 2016-12-01 08:12:27 UTC
Created attachment 341119 [details] [review]
spice-display: Reorganize 'USB Devices' property

The current way the code is organized doesn't allow for another
section to be further added after the 'USB Devices' section.

Based on the folder sharing UI mockups, we will add another
'Folder Sharing' section after 'USB Devices', so we need
some code reorganizing.
Comment 66 Visarion Alexandru 2016-12-01 08:13:14 UTC
Created attachment 341120 [details] [review]
Add SharedFolderPopover

Let's add a custom popover to aid us when adding/editing
shared folders.
Comment 67 Visarion Alexandru 2016-12-01 08:13:51 UTC
Created attachment 341121 [details] [review]
spice-display: Add UI for 'Folder Shares' section

Let's add the main UI elements, to support the upcoming patches
which will implement multiple shared folders.
Comment 68 Visarion Alexandru 2016-12-01 08:14:29 UTC
Created attachment 341122 [details] [review]
spice-display: Implement multiple shared folders

Create a symlink on the host for every folder the user wants to
share, inside a temporary directory.
Share the temporary directory with the guest.

Automatically share by default the "Public" directory.
Comment 69 Felipe Borges 2016-12-18 10:56:52 UTC
*** Bug 776230 has been marked as a duplicate of this bug. ***
Comment 70 Zeeshan Ali 2017-01-04 13:24:09 UTC
Created attachment 342835 [details]
Screenshot of popup appearing in the wrong place

Looks good but two issues I noticed, this one being the major one: popup appears in a wrong place.
Comment 71 Zeeshan Ali 2017-01-04 13:25:22 UTC
Created attachment 342836 [details]
Spacing issue screenshot

This is a minor issue to me but might be very major to designers. :) At least to me it seems there is way too much space between the rows. Did you show the screenshot to designers?
Comment 72 Visarion Alexandru 2017-01-05 08:31:13 UTC
(In reply to Zeeshan Ali (Khattak) from comment #70)
> Created attachment 342835 [details]
> Screenshot of popup appearing in the wrong place
> 
> Looks good but two issues I noticed, this one being the major one: popup
> appears in a wrong place.

This is the first time I see this issue. Which Gtk version do you have and does this happen every time you use the popover ?
Comment 73 Visarion Alexandru 2017-01-05 08:36:25 UTC
(In reply to Zeeshan Ali (Khattak) from comment #71)
> Created attachment 342836 [details]
> Spacing issue screenshot
> 
> This is a minor issue to me but might be very major to designers. :) At
> least to me it seems there is way too much space between the rows. Did you
> show the screenshot to designers?

I remember I did, but I'll do it again.
Comment 74 Zeeshan Ali 2017-01-05 10:48:25 UTC
(In reply to Visarion Alexandru from comment #72)
> (In reply to Zeeshan Ali (Khattak) from comment #70)
> > Created attachment 342835 [details]
> > Screenshot of popup appearing in the wrong place
> > 
> > Looks good but two issues I noticed, this one being the major one: popup
> > appears in a wrong place.
> 
> This is the first time I see this issue. Which Gtk version do you have and
> does this happen every time you use the popover ?

$ pkg-config --modversion gtk+-3.0 
3.22.6

It should git master actually. I'll update my jhbuild to ensure but please you also do the same.
Comment 75 Zeeshan Ali 2017-01-05 10:49:35 UTC
(In reply to Visarion Alexandru from comment #72)
> (In reply to Zeeshan Ali (Khattak) from comment #70)
> > Created attachment 342835 [details]
> > Screenshot of popup appearing in the wrong place
> > 
> > Looks good but two issues I noticed, this one being the major one: popup
> > appears in a wrong place.
> 
> This is the first time I see this issue. Which Gtk version do you have and
> does this happen every time you use the popover ?

And yes, it happens everytime.
Comment 76 Visarion Alexandru 2017-01-06 14:49:03 UTC
(In reply to Zeeshan Ali (Khattak) from comment #75)
> (In reply to Visarion Alexandru from comment #72)
> > (In reply to Zeeshan Ali (Khattak) from comment #70)
> > > Created attachment 342835 [details]
> > > Screenshot of popup appearing in the wrong place
> > > 
> > > Looks good but two issues I noticed, this one being the major one: popup
> > > appears in a wrong place.
> > 
> > This is the first time I see this issue. Which Gtk version do you have and
> > does this happen every time you use the popover ?
> 
> And yes, it happens everytime.

This is most likely a gtk bug. The popup is an internal mechanism of the Gtk.FileChooserButton.

I talked with the guys from gtk and they told me that "there are quite a few bugs open about popup placement"

Also, I updated my gtk. Now,
<jhbuild -f ~/spice/spice-jhbuild/jhbuildrc run pkg-config --modversion gtk+-3.0>
returns 3.22.6, but I still can't reproduce the issue.
Comment 77 Visarion Alexandru 2017-01-06 14:52:13 UTC
(In reply to Zeeshan Ali (Khattak) from comment #71)
> Created attachment 342836 [details]
> Spacing issue screenshot
> 
> This is a minor issue to me but might be very major to designers. :) At
> least to me it seems there is way too much space between the rows. Did you
> show the screenshot to designers?

I talked to jimmac, concerned about the spacing between the rows.
He told me that the '+' button will need a separator above and that the whole list would be nice to have top and bottom borders, so I will try doing that.
Comment 78 Visarion Alexandru 2017-01-07 00:09:10 UTC
(In reply to Visarion Alexandru from comment #76)
> (In reply to Zeeshan Ali (Khattak) from comment #75)
> > (In reply to Visarion Alexandru from comment #72)
> > > (In reply to Zeeshan Ali (Khattak) from comment #70)
> > > > Created attachment 342835 [details]
> > > > Screenshot of popup appearing in the wrong place
> > > > 
> > > > Looks good but two issues I noticed, this one being the major one: popup
> > > > appears in a wrong place.
> > > 
> > > This is the first time I see this issue. Which Gtk version do you have and
> > > does this happen every time you use the popover ?
> > 
> > And yes, it happens everytime.
> 
> This is most likely a gtk bug. The popup is an internal mechanism of the
> Gtk.FileChooserButton.
> 
> I talked with the guys from gtk and they told me that "there are quite a few
> bugs open about popup placement"
> 
> Also, I updated my gtk. Now,
> <jhbuild -f ~/spice/spice-jhbuild/jhbuildrc run pkg-config --modversion
> gtk+-3.0>
> returns 3.22.6, but I still can't reproduce the issue.


I just updated from fedora 24 to fedora 25 and now it also happens to me.
Comment 79 Visarion Alexandru 2017-01-19 18:32:26 UTC
There were two major issues. The one you noticed and another one I noticed (Gtk.FileChooserButton would seg fault when shown without an initial directory).
Both were major internal bugs from Gtk+ and now seem to have been solved by them.

Could you confirm that these are gone, please ?
Comment 80 Visarion Alexandru 2017-01-19 18:36:22 UTC
Also, now I notice a new, different issue, probably from Gtk+ master. If I show the shared-folder popover and I close the properties and re-open them, the system logs out with no information (not even gdb helps me here) at the point where the shared-folder frame is added to the list.

I'll try to figure out what's happening and discuss with the Gtk+ folks.
Comment 81 Visarion Alexandru 2017-01-23 16:15:37 UTC
Created attachment 344046 [details] [review]
vm-configurator: Ensure WebDAV channel existence

We have to make sure that the WebDAV channel always exists in the
machine's XML configuration file, for the planned shared folders
feature to work on local machines.
Comment 82 Visarion Alexandru 2017-01-23 16:17:52 UTC
Created attachment 344047 [details] [review]
props-page-widget: 'Devices' -> 'Devices & Shares'

Change the 'DEVICES' page name to 'Devices & Shares', in order to
accomodate the new 'Folder Sharing' section.
Comment 83 Visarion Alexandru 2017-01-23 16:18:09 UTC
Created attachment 344048 [details] [review]
spice-display: Reorganize 'USB Devices' property

The current way the code is organized doesn't allow for another
section to be further added after the 'USB Devices' section.

Based on the folder sharing UI mockups, we will add another
'Folder Sharing' section after 'USB Devices', so we need
some code reorganizing.
Comment 84 Visarion Alexandru 2017-01-23 16:18:24 UTC
Created attachment 344049 [details] [review]
Add SharedFolderPopover

Let's add a custom popover to aid us when adding/editing
shared folders.
Comment 85 Visarion Alexandru 2017-01-23 16:18:40 UTC
Created attachment 344050 [details] [review]
spice-display: Add UI for 'Folder Shares' section

Let's add the main UI elements, to support the upcoming patches
which will implement multiple shared folders.
Comment 86 Visarion Alexandru 2017-01-23 16:19:03 UTC
Created attachment 344051 [details] [review]
spice-display: Implement multiple shared folders

Create a symlink on the host for every folder the user wants to
share, inside a temporary directory.
Share the temporary directory with the guest.

Automatically share by default the "Public" directory.
Comment 87 Visarion Alexandru 2017-01-24 12:25:03 UTC
Created attachment 344140 [details] [review]
vm-configurator: Ensure WebDAV channel existence

We have to make sure that the WebDAV channel always exists in the
machine's XML configuration file, for the planned shared folders
feature to work on local machines.
Comment 88 Visarion Alexandru 2017-01-24 12:25:17 UTC
Created attachment 344141 [details] [review]
props-page-widget: 'Devices' -> 'Devices & Shares'

Change the 'DEVICES' page name to 'Devices & Shares', in order to
accomodate the new 'Folder Sharing' section.
Comment 89 Visarion Alexandru 2017-01-24 12:25:33 UTC
Created attachment 344142 [details] [review]
spice-display: Reorganize 'USB Devices' property

The current way the code is organized doesn't allow for another
section to be further added after the 'USB Devices' section.

Based on the folder sharing UI mockups, we will add another
'Folder Sharing' section after 'USB Devices', so we need
some code reorganizing.
Comment 90 Visarion Alexandru 2017-01-24 12:25:51 UTC
Created attachment 344143 [details] [review]
Add SharedFolderPopover

Let's add a custom popover to aid us when adding/editing
shared folders.
Comment 91 Visarion Alexandru 2017-01-24 12:26:04 UTC
Created attachment 344144 [details] [review]
spice-display: Add UI for 'Folder Shares' section

Let's add the main UI elements, to support the upcoming patches
which will implement multiple shared folders.
Comment 92 Visarion Alexandru 2017-01-24 12:26:23 UTC
Created attachment 344145 [details] [review]
spice-display: Implement multiple shared folders

Create a symlink on the host for every folder the user wants to
share, inside a temporary directory.
Share the temporary directory with the guest.

Automatically share by default the "Public" directory.
Comment 93 Felipe Borges 2017-05-04 11:24:22 UTC
Review of attachment 344140 [details] [review]:

It seems pretty straightforward. Thanks!

Marking as reviewed because I would like to get them all in together. ;-)

::: src/vm-configurator.vala
@@ +269,3 @@
+            else if (device is DomainChannel) {
+                var device_channel = device as DomainChannel;
+                if (device_channel.get_target_name () == "org.spice-space.webdav.0")

nitpick: this constant could be defined just once in the code, to make it simpler in case it changes. I'd call it WEBDAV_CHANNEL_URI or something in these lines.
Comment 94 Felipe Borges 2017-05-04 11:24:50 UTC
Review of attachment 344141 [details] [review]:

sure.
Comment 95 Felipe Borges 2017-05-04 11:28:41 UTC
Review of attachment 344142 [details] [review]:

Not a big fan of the whole UI bits to be mixed with the logic instead of widget templates, but since that's the way it was, lets keep it this way for now.

::: src/spice-display.vala
@@ +338,2 @@
             try {
+                    var manager = UsbDeviceManager.get (session);

The indentation here.

@@ +342,1 @@
+                    if (connected && devs.length > 0) {

I wouldn't change the connected guard conditional without a good reason. Besides, it should _break_ before you get the UsdDeviceManager and run get_usb_devices.

@@ +449,3 @@
+                    manager.connect_device_async.begin (dev, null, (obj, res) => {
+                        try {
+            hbox.margin_bottom = 6;

indentation.
Comment 96 Felipe Borges 2017-05-04 11:35:32 UTC
Review of attachment 344143 [details] [review]:

::: data/gnome-boxes.gresource.xml
@@ +35,3 @@
     <file preprocess="xml-stripblanks">ui/snapshot-list-row.ui</file>
     <file preprocess="xml-stripblanks">ui/troubleshoot-log.ui</file>
+    <file preprocess="xml-stripblanks">ui/shared-folder-popover.ui</file>

I know some of them are not on alphabetical order, but it would be nice. :)

::: data/ui/shared-folder-popover.ui
@@ +6,3 @@
+    <property name="can_focus">False</property>
+    <property name="modal">True</property>
+    <property name="position">0</property>

<property name="position">bottom</property>

@@ +95,3 @@
+                <property name="homogeneous">True</property>
+                <child>
+                  <object class="GtkButton" id="button_cancel">

Connect it to a [GtkCallback] handler and you don't need to instantiate it on the vala code neither an id.

<signal name="clicked" handler="on_cancel_button_clicked"/>

@@ +109,3 @@
+                <child>
+                  <object class="GtkButton" id="button_save">
+                    <property name="label" translatable="yes">Save</property>

ditto.

::: src/shared-folder-popover.vala
@@ +14,3 @@
+    private Gtk.Button button_cancel;
+    [GtkChild]
+    private Gtk.Button button_save;

No need for these two if you connect the signals in the .ui file.

@@ +16,3 @@
+    private Gtk.Button button_save;
+
+    public int target_position;

Is there an interest of having an specific sorting in the list? If not, we could just "append". In doing so, there's no need to keep track of target_position.

@@ +18,3 @@
+    public int target_position;
+    public string uri { set { file_chooser_button.set_uri ("file://" + value); } }
+    public string folder_name { set { name_entry.set_text (value); } }

You could "bind_property" between the uri and folder_name properties or drop them entirely and make the getters and setters of the GtkWidgets handle the mapping.

@@ +42,3 @@
+
+    public void clean_up () {
+        this.relative_to = null;

The name_entry and the file_chooser_button would still keep their previous values.
Comment 97 Felipe Borges 2017-05-04 11:40:52 UTC
Review of attachment 344144 [details] [review]:

For this one I would propose a significantly different patch. (See below).

::: data/gtk-style.css
@@ +123,3 @@
 /* Adds a border to the ISOs lists top undershoot */
 .boxes-menu-scrolled.undershoot.top { border-top: 1px solid @borders; }
+

not really necessary (all these css).

::: src/spice-display.vala
@@ +480,3 @@
+        frame.add (listbox);
+
+        var row_plus = new Gtk.ListBoxRow ();

still not a big fan of gtk/ui specific code mixed with code logic.

@@ +496,3 @@
+        button_plus.set_image (image_plus);
+        hbox_plus.pack_start (button_plus, true, true, 0);
+        row_plus.add (hbox_plus);

Wouldn't it be easier if row_plus wouldn't be part of the list box?

@@ +671,3 @@
 }
+
+private class Boxes.SharedFolderRow : Gtk.ListBoxRow {

If this object would have its UI specifics defined in a template file, you could directly bind the properties to their respective UI widgets.
Comment 98 Felipe Borges 2017-05-04 11:41:50 UTC
Created attachment 351042 [details] [review]
spice-display: Add UI for 'Folder Shares' section

Let's add the main UI elements, to support the upcoming patches
which will implement multiple shared folders.
Comment 99 Felipe Borges 2017-05-04 11:47:42 UTC
Review of attachment 344145 [details] [review]:

::: src/spice-display.vala
@@ +70,3 @@
         }
+        var folder_name = "boxes_shared_" + "%u".printf (GLib.Random.next_int ());
+        shared_folder = GLib.Path.build_filename (GLib.Environment.get_tmp_dir (), folder_name);

Do we want it to be volatile by living in the /tmp dir?

Also, storing the "Names" in the directory name might cause restrictions according to folder-name-sizes, valid chars, spaces...

@@ +586,3 @@
         });
 
+        var hash = get_shared_folders ();

By calling this here wouldn't it load the folders just once?
Comment 100 Felipe Borges 2017-05-04 11:49:16 UTC
Thanks for the patches, and I'm sorry for taking so long to review them.

Please, let me know if you don't have time to follow up in these reviews. In this case I would take it from where you stopped.
Comment 101 Visarion Alexandru 2017-05-04 22:41:10 UTC
(In reply to Felipe Borges from comment #100)
> Thanks for the patches, and I'm sorry for taking so long to review them.
> 
> Please, let me know if you don't have time to follow up in these reviews. In
> this case I would take it from where you stopped.

Thanks for the reviews, I will follow up as soon as possible.
Comment 102 Visarion Alexandru 2017-05-14 20:53:32 UTC
Review of attachment 344142 [details] [review]:

::: src/spice-display.vala
@@ +342,1 @@
+                    if (connected && devs.length > 0) {

I removed the lines

>if (!connected)
>    break;

because otherwise we don't have the chance the get to the "Shared Folders" frame, which will be located after "USB devices". It would skip it, just because the spice-agent isn't connected, but the shared folders work even without the spice-agent. We want to only skip the "USB devices" in case the spice-agent is not connected.
Basically, the reason is to make room for the "Shared Folders" Frame.
Comment 103 Visarion Alexandru 2017-05-14 22:02:44 UTC
Review of attachment 344143 [details] [review]:

::: src/shared-folder-popover.vala
@@ +16,3 @@
+    private Gtk.Button button_save;
+
+    public int target_position;

Actually, yes. When we edit already existing entries, we want to know the position of the entry being updated.
Comment 104 Visarion Alexandru 2017-05-15 07:47:10 UTC
Review of attachment 344145 [details] [review]:

::: src/spice-display.vala
@@ +70,3 @@
         }
+        var folder_name = "boxes_shared_" + "%u".printf (GLib.Random.next_int ());
+        shared_folder = GLib.Path.build_filename (GLib.Environment.get_tmp_dir (), folder_name);

I think it's a good idea to be volatile, because it will end up containing a lot of useless directories filled with symlinks. We can not clean up these directories because we don't know how the SPICE session ends, so we should at least let the system clean them for us.

I am not sure what "Names" you are referring to. The names of the volatile directories containing the symlinks will have the pattern "boxes_shared_*random int*".

@@ +586,3 @@
         });
 
+        var hash = get_shared_folders ();

The folders are loaded into the UI each time the user opens the "Properties" Page.
Comment 105 Felipe Borges 2017-05-15 12:16:29 UTC
(In reply to Visarion Alexandru from comment #102)
> Review of attachment 344142 [details] [review] [review]:
> 
> ::: src/spice-display.vala
> @@ +342,1 @@
> +                    if (connected && devs.length > 0) {
> 
> I removed the lines
> 
> >if (!connected)
> >    break;
> 
> because otherwise we don't have the chance the get to the "Shared Folders"
> frame, which will be located after "USB devices". It would skip it, just
> because the spice-agent isn't connected, but the shared folders work even
> without the spice-agent. We want to only skip the "USB devices" in case the
> spice-agent is not connected.
> Basically, the reason is to make room for the "Shared Folders" Frame.

sure.

(In reply to Visarion Alexandru from comment #103)
> Review of attachment 344143 [details] [review] [review]:
> 
> ::: src/shared-folder-popover.vala
> @@ +16,3 @@
> +    private Gtk.Button button_save;
> +
> +    public int target_position;
> 
> Actually, yes. When we edit already existing entries, we want to know the
> position of the entry being updated.

Ok. I'd rather bind the view to a model, but I would accept this as it is and patch it later. No worries.

(In reply to Visarion Alexandru from comment #104)
> Review of attachment 344145 [details] [review] [review]:
> 
> ::: src/spice-display.vala
> @@ +70,3 @@
>          }
> +        var folder_name = "boxes_shared_" + "%u".printf
> (GLib.Random.next_int ());
> +        shared_folder = GLib.Path.build_filename
> (GLib.Environment.get_tmp_dir (), folder_name);
> 
> I think it's a good idea to be volatile, because it will end up containing a
> lot of useless directories filled with symlinks. We can not clean up these
> directories because we don't know how the SPICE session ends, so we should
> at least let the system clean them for us.

Hmm, I am not sure about it. I will think and discuss the topic and get back here.

Thanks for your work. I am looking forward for your patches!
Comment 106 Visarion Alexandru 2017-05-15 23:03:02 UTC
Created attachment 351923 [details] [review]
vm-configurator: Ensure WebDAV channel existence

We have to make sure that the WebDAV channel always exists in the
machine's XML configuration file, for the planned shared folders
feature to work on local machines.
Comment 107 Visarion Alexandru 2017-05-15 23:04:33 UTC
Created attachment 351924 [details] [review]
props-page-widget: 'Devices' -> 'Devices & Shares'

Change the 'DEVICES' page name to 'Devices & Shares', in order to
accomodate the new 'Folder Sharing' section.
Comment 108 Visarion Alexandru 2017-05-15 23:05:04 UTC
Created attachment 351925 [details] [review]
spice-display: Reorganize 'USB Devices' property

The current way the code is organized doesn't allow for another
section to be further added after the 'USB Devices' section.

Based on the folder sharing UI mockups, we will add another
'Folder Sharing' section after 'USB Devices', so we need
some code reorganizing.
Comment 109 Visarion Alexandru 2017-05-15 23:05:40 UTC
Created attachment 351926 [details] [review]
GResource: Order files alphabetically
Comment 110 Visarion Alexandru 2017-05-15 23:05:59 UTC
Created attachment 351927 [details] [review]
Add SharedFolderPopover

Let's add a custom popover to aid us when adding/editing
shared folders.
Comment 111 Visarion Alexandru 2017-05-15 23:07:42 UTC
Created attachment 351928 [details] [review]
spice-display: Add UI for 'Folder Shares' section

Let's add the main UI elements, to support the upcoming patches
which will implement multiple shared folders.
Comment 112 Visarion Alexandru 2017-05-15 23:08:09 UTC
Created attachment 351929 [details] [review]
spice-display: Implement multiple shared folders

Create a symlink on the host for every folder the user wants to
share, inside a temporary directory.
Share the temporary directory with the guest.

Automatically share by default the "Public" directory.
Comment 113 Felipe Borges 2017-05-23 11:05:22 UTC
Just to summarize what we have discussed on IRC:

1. We want the folders to be permanent (not on /tmp)
2. Their names and path mapping could be stored as a GSetting
3. If there's no "name" set, use the basename of the folder

Thanks for your work!
Comment 114 Visarion Alexandru 2017-06-02 10:53:05 UTC
Created attachment 353067 [details] [review]
vm-configurator: Ensure WebDAV channel existence

We have to make sure that the WebDAV channel always exists in the
machine's XML configuration file, for the planned shared folders
feature to work on local machines.
Comment 115 Visarion Alexandru 2017-06-02 10:53:17 UTC
Created attachment 353068 [details] [review]
props-page-widget: 'Devices' -> 'Devices & Shares'

Change the 'DEVICES' page name to 'Devices & Shares', in order to
accomodate the new 'Folder Sharing' section.
Comment 116 Visarion Alexandru 2017-06-02 10:53:26 UTC
Created attachment 353069 [details] [review]
spice-display: Reorganize 'USB Devices' property

The current way the code is organized doesn't allow for another
section to be further added after the 'USB Devices' section.

Based on the folder sharing UI mockups, we will add another
'Folder Sharing' section after 'USB Devices', so we need
some code reorganizing.
Comment 117 Visarion Alexandru 2017-06-02 10:53:35 UTC
Created attachment 353070 [details] [review]
GResource: Order files alphabetically
Comment 118 Visarion Alexandru 2017-06-02 10:53:45 UTC
Created attachment 353071 [details] [review]
Add SharedFolderPopover

Let's add a custom popover to aid us when adding/editing
shared folders.
Comment 119 Visarion Alexandru 2017-06-02 10:55:33 UTC
Created attachment 353072 [details] [review]
spice-display: Add UI for 'Folder Shares' section

Let's add the main UI elements, to support the upcoming patches
which will implement multiple shared folders.
Comment 120 Visarion Alexandru 2017-06-02 10:55:41 UTC
Created attachment 353073 [details] [review]
spice-display: Implement multiple shared folders

Create a symlink on the host for every folder the user wants to
share, inside a config directory.
Share the config directory with the guest.

Automatically share by default the "Public" directory.
Comment 121 Visarion Alexandru 2017-06-02 10:55:52 UTC
Created attachment 353074 [details] [review]
spice-display: Store shared folders using GSettings

Let's assure the persistance of shared folders, by storing
their names and path mapping for each SPICE display.
Comment 122 Visarion Alexandru 2017-06-02 11:00:31 UTC
(In reply to Felipe Borges from comment #113)
> Just to summarize what we have discussed on IRC:
> 
> 1. We want the folders to be permanent (not on /tmp)
> 2. Their names and path mapping could be stored as a GSetting
> 3. If there's no "name" set, use the basename of the folder

1 -> In "Implement multiple shared folders" patch, I changed to directory to the user default config directory.
2 -> The last patch.
3 -> Solved in "Add SharedFolderPopover",

No changes elsewhere.
Comment 123 Felipe Borges 2017-06-05 08:04:40 UTC
Could you please rebase your changes?
Comment 124 Visarion Alexandru 2017-06-05 16:30:29 UTC
Created attachment 353199 [details] [review]
vm-configurator: Ensure WebDAV channel existence

We have to make sure that the WebDAV channel always exists in the
machine's XML configuration file, for the planned shared folders
feature to work on local machines.
Comment 125 Visarion Alexandru 2017-06-05 16:30:49 UTC
Created attachment 353200 [details] [review]
props-page-widget: 'Devices' -> 'Devices & Shares'

Change the 'DEVICES' page name to 'Devices & Shares', in order to
accomodate the new 'Folder Sharing' section.
Comment 126 Visarion Alexandru 2017-06-05 16:30:57 UTC
Created attachment 353201 [details] [review]
spice-display: Reorganize 'USB Devices' property

The current way the code is organized doesn't allow for another
section to be further added after the 'USB Devices' section.

Based on the folder sharing UI mockups, we will add another
'Folder Sharing' section after 'USB Devices', so we need
some code reorganizing.
Comment 127 Visarion Alexandru 2017-06-05 16:31:07 UTC
Created attachment 353202 [details] [review]
GResource: Order files alphabetically
Comment 128 Visarion Alexandru 2017-06-05 16:31:17 UTC
Created attachment 353203 [details] [review]
Add SharedFolderPopover

Let's add a custom popover to aid us when adding/editing
shared folders.
Comment 129 Visarion Alexandru 2017-06-05 16:31:32 UTC
Created attachment 353204 [details] [review]
spice-display: Add UI for 'Folder Shares' section

Let's add the main UI elements, to support the upcoming patches
which will implement multiple shared folders.
Comment 130 Visarion Alexandru 2017-06-05 16:31:45 UTC
Created attachment 353205 [details] [review]
spice-display: Implement multiple shared folders

Create a symlink on the host for every folder the user wants to
share, inside a config directory.
Share the config directory with the guest.

Automatically share by default the "Public" directory.
Comment 131 Visarion Alexandru 2017-06-05 16:31:57 UTC
Created attachment 353206 [details] [review]
spice-display: Store shared folders using GSettings

Let's assure the persistance of shared folders, by storing
their names and path mapping for each SPICE display.
Comment 132 Victor Toso 2017-06-09 20:32:48 UTC
*** Bug 783605 has been marked as a duplicate of this bug. ***
Comment 133 Felipe Borges 2017-06-14 10:50:13 UTC
Review of attachment 353199 [details] [review]:

sure!
Comment 134 Felipe Borges 2017-06-14 10:51:01 UTC
Review of attachment 353200 [details] [review]:

lgtm
Comment 135 Felipe Borges 2017-06-14 10:51:47 UTC
Review of attachment 353201 [details] [review]:

sure
Comment 136 Felipe Borges 2017-06-14 10:52:07 UTC
Review of attachment 353202 [details] [review]:

thx
Comment 137 Felipe Borges 2017-06-14 10:53:34 UTC
Review of attachment 353203 [details] [review]:

::: src/shared-folder-popover.vala
@@ +24,3 @@
+
+        if (path != null) {
+            path.scanf ("file://%s", path);

maybe later we will want to support other prefixes. But that's good for now.
Comment 138 Felipe Borges 2017-06-14 10:54:20 UTC
Review of attachment 353204 [details] [review]:

nice!
Comment 139 Felipe Borges 2017-06-14 10:55:24 UTC
Review of attachment 353205 [details] [review]:

sure.
Comment 140 Felipe Borges 2017-06-14 10:56:50 UTC
Review of attachment 353206 [details] [review]:

Good. I am happy that we can finally land this feature.

I would like people to test it so we can address any issues that might eventually pop up.

Thanks a lot for your contribution!
Comment 141 Felipe Borges 2017-06-15 14:57:04 UTC
I am happy to finally land this!

Attachment 353199 [details] pushed as 164dd20 - vm-configurator: Ensure WebDAV channel existence
Attachment 353200 [details] pushed as 40dda4e - props-page-widget: 'Devices' -> 'Devices & Shares'
Attachment 353201 [details] pushed as 21b4ca6 - spice-display: Reorganize 'USB Devices' property
Attachment 353202 [details] pushed as 8d1495c - GResource: Order files alphabetically
Attachment 353203 [details] pushed as 20dfa5d - Add SharedFolderPopover
Attachment 353204 [details] pushed as c89f76f - spice-display: Add UI for 'Folder Shares' section
Attachment 353205 [details] pushed as 4f08ea1 - spice-display: Implement multiple shared folders
Attachment 353206 [details] pushed as 08f55da - spice-display: Store shared folders using GSettings