Re: VFS: Asynchronous file transfers



В Чтв, 07/07/2005 в 09:27 +0200, Matthias Kaeppler пишет:
> Hi,
> 
> I was wondering is there are VFS functions to transfer files 
> concurrently? I need that for my application, but I don't want the GUI 
> to be blocked when e.g. copying files.
> 
> Any help appreciated.
> 

Hi. You can use


gnome_vfs_async_xfer ()
GnomeVFSResult gnome_vfs_async_xfer         (GnomeVFSAsyncHandle **handle_return,
                                             GList *source_uri_list,
                                             GList *target_uri_list,
                                             GnomeVFSXferOptions xfer_options,
                                             GnomeVFSXferErrorMode error_mode,
                                             GnomeVFSXferOverwriteMode overwrite_mode,
                                             int priority,
                                             GnomeVFSAsyncXferProgressCallback progress_update_callback,
                                             gpointer update_callback_data,
                                             GnomeVFSXferProgressCallback progress_sync_callback,
                                             gpointer sync_callback_data);

Perform a copy operation in a seperate thread. progress_update_callback
will be periodically polled with status of the operation (percent done,
the current phase of operation, the current file being operated upon).
If the xfer engine needs to query the caller to make a decision or
report on important error it will do so on progress_sync_callback.

handle_return :
when the function returns will point
to a handle for
source_uri_list :
GList of GnomeVFSURI representing
the files to be transferred
target_uri_list :
GList of GnomeVFSURI, the target
locations for the elements in
source_uri_list
xfer_options :
various options controlling the
details of the transfer. Use
GNOME_VFS_XFER_REMOUVESOURCE to make
the operation a move rather than a
copy.
error_mode :
report errors to the
progress_sync_callback, or simply
abort
overwrite_mode :
controls whether the xfer engine
will overwrite automatically, skip
the file, abort the operation, or
query progress_sync_callback
priority :
a value from GNOME_VFS_PRIORITY_MIN
to GNOME_VFS_PRIORITY_MAX (normally
should be
GNOME_VFS_PRIORITY_DEFAULT)
indicating the priority to assign
this job in allocating threads from
the thread pool.
progress_update_callback :
called periodically to keep the
client appraised of progress in
completing the XFer operation, and
the current phase of operation.
update_callback_data :
user data passed to
progress_update_callback
progress_sync_callback :
called when the program requires
responses to interactive queries
(e.g. overwriting files, handling
errors, etc)
sync_callback_data :
user data passed to
progress_sync_callback
Returns :
GNOME_VFS_OK if the paramaters were
in order, or
GNOME_VFS_ERROR_BAD_PARAMETERS if
something was wrong in the passed in
arguments.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]