Gtk Ckipboard: pasting files from a source with cu

2019-05-19 07:49发布

问题:

I'm trying to write a a GTK/C application that puts some files on the Gtk clipboard, so a user with Nautilus will be able to paste them. There is a good example of Gtk Clipboard local file copy and paste on stackoverflow. Unofrtunately the files I need to paste are not on the local disk, and cannot be accessed via a standard GVFS URI scheme like file:// Only my application can access these source file after setting up a TCP connection, authenticating and opening an extra channel.

How can I have these application managed remote files on the Gtk clipboard for pasting with Nautilus ? And in the future, for Dolphin/KDE too ?

After googling around I came to the following idea: I need to develop a new gvfs URI scheme handler (ie: my-app://). But it's hard to find examples or documentation. Is it the only way ? And, can my application register itself as a temporary GVFS URI scheme handler without changing any external system configuration file ? How ?