Skip to content

file copy&paste using webdav

Jakub Janků requested to merge jjanku/vd_agent-linux:webdav-cb into master

This is the most "tricky" part, I'd say. The problem is, that e.g. Nautilus in GNOME doesn't accept the generic text/uri-list mime type, while Dolphin in KDE does. That means it'll be necessary to test the most common file managers to see how they handle it (I've tried only the aforementioned GNOME and KDE). I'm hoping that Nautilus is rather an exception. However, if we wanted to implement cutting files (Ctrl+X), we'd have to advertise application specific mime types (e.g. application/x-kde4-urilist), because text/uri-list does not specify, what's supposed to happen with these uris, afaik.

Vdagent searches for the webdav mount and if it fails, it tries to mount it.

The other thing is, that gvfs-dav keeps crashing with avahi when I reconnect with spice-gtk. As a workaround, the webdav server is mounted using the port 9844 9843 atm, instead of the service name. This needs some investigation.

I've modified only the GTK+ clipboard backend.

TODO: modify x11 backend as well, since it's likely that GTK+ will be disabled because of the monitor functions

See MRs for the other components for more details:


v2

  • re-use existing webdav channel
  • items in file list from spice-gtk are separated by \0 now
  • use UTF8_STRING instead of STRING for nautilus, because spice-gtk sends utf8 text
    • this fixes previous issues when the file named contained emoji, for example
  • escape uri before setting it to the clipboard
    • this partially fixes the problems with file that have \n in their name
      • still not working, probably issues in other components (gvfs?)

v3

  • both x11 and GTK+ backends are now support, common code resides in webdav-cb.c

v4

  • support cutting (nautilus and dolphin; dolphin works, but it is inefficient)

v5

  • rewrite code that does the mounting - listen to the "unmounted" signal
  • if spice-gtk can provide the data as file and as image, you can now use both (with x11, clipboard.c needs a fix as well)
  • various readability and style improvements
  • switch to text/plain;charset=utf-8 target from UTF8_STRING as this is preferred by gtk and thus by nautilus too

v6

  • copying image files fixed for clipboard.c (see v5)
  • rebased (pipeline succeeds now)
  • other minor improvements

v7

  • mounting is completely done async now

v8

  • rewritten webdav-cb.c one more time, clipboard data is now always translated to the given target asynchronously and the clipboard backends don't have to call the mount function anymore - this simplifies the handling in x11.c and clipboard.c
  • file list data is now saved and requested only once during a single grab

v9

  • dropped changes in clipboard.c
  • added more details about the issues with avahi and gvfs
  • rebased

v10

  • use GString in webdav-cb.c
  • add "x-special/gnome-copied-files" which is used by many file managers, as I found out when I tested a couple of them
Edited by Jakub Janků

Merge request reports