Struct ashpd::documents::FileTransferProxy
source · [−]pub struct FileTransferProxy<'a>(_);
Expand description
The interface operates as a middle-man between apps when transferring files via drag-and-drop or copy-paste, taking care of the necessary exporting of files in the document portal.
Toolkits are expected to use the application/vnd.portal.filetransfer mimetype when using this mechanism for file exchange via copy-paste or drag-and-drop.
The data that is transmitted with this mimetype should be the key returned by the StartTransfer method. Upon receiving this mimetype, the target should call RetrieveFiles with the key, to obtain the list of files. The portal will take care of exporting files in the document store as necessary to make them accessible to the target.
Wrapper of the DBus interface: org.freedesktop.portal.FileTransfer
.
Implementations
Create a new instance of FileTransferProxy
.
Adds files to a session. This method can be called multiple times on a given session. Note only regular files (not directories) can be added.
Arguments
key
- A key returned bystart_transfer()
.fds
- A list of file descriptors of the files to register.
Specifications
See also AddFiles
.
Retrieves files that were previously added to the session with
add_files()
. The files will be
exported in the document portal as-needed for the caller, and they
will be writable if the owner of the session allowed it.
Arguments
key
- A key returned bystart_transfer()
.
Returns
The list of file paths.
Specifications
See also RetrieveFiles
.
Starts a session for a file transfer.
The caller should call add_files()
at least once, to add files to this session.
Arguments
writeable
- Sets whether the chosen application can write to the files or not.auto_stop
- Whether to stop the transfer automatically after the firstretrieve_files()
call.
Returns
Key that can be passed to
retrieve_files()
to obtain the
files.
Specifications
See also StartTransfer
.
Ends the transfer.
Further calls to add_files()
or
retrieve_files()
for this key
will return an error.
Arguments
key
- A key returned bystart_transfer()
.
Specifications
See also StopTransfer
.
Emitted when the transfer is closed.
Returns
- The key returned by
start_transfer()
.
Specifications
See also TransferClosed
.