问题描述
我正在尝试编写一个GTK/C应用程序,该应用程序会将一些文件放在Gtk剪贴板上,因此Nautilus的用户将能够粘贴它们.有一个很好的示例Gtk剪贴板本地文件复制并粘贴到stackoverflow 上.不幸的是,我需要粘贴的文件不在本地磁盘上,并且无法通过标准的GVFS URI方案(如file://)进行访问建立TCP连接,验证身份并打开额外的通道后,只有我的应用程序才能访问这些源文件.
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.
我如何在Gtk剪贴板上将这些应用程序管理的远程文件粘贴到Nautilus上?将来,对于Dolphin/KDE也是如此?
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 ?
谷歌搜索后,我得出以下想法:我需要开发一个新的gvfs URI方案处理程序(即:my-app://).但是很难找到示例或文档.这是唯一的方法吗?而且,我的应用程序可以将自己注册为临时GVFS URI方案处理程序,而无需更改任何外部系统配置文件吗?怎么样?
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 ?
推荐答案
这是一个老问题,但是我必须解决一个类似的问题.通过创建自定义的保险丝文件系统,可以利用普通的剪贴板行为(通过kde和gnome方式宣布要在剪贴板中复制文件的方式),只有在实际访问数据时才使用网络资源.
This is an old question, but I had to solve a similar issue.By creating a custom fuse filesystem it was possible to utilize the normal clipboard behavior (kde and gnome way of announcing files to copy in the clipboard) and have network resources only utilized if the data is actually accessed.
这篇关于Gtk Ckipboard:使用自定义URI方案粘贴源中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!