SpiceClientGLib.MainChannel.file_copy_async

### Method

# SpiceClientGLib MainChannelfile_copy_async

since: 0.35

#### Declaration [src]

    void
    spice_main_channel_file_copy_async (
      SpiceMainChannel* channel,
      GFile** sources,
      GFileCopyFlags flags,
      GCancellable* cancellable,
      GFileProgressCallback progress_callback,
      gpointer progress_callback_data,
      GAsyncReadyCallback callback,
      gpointer user_data
    )

#### Description [src]

Copies the file `sources` to guest

If `cancellable` is not `NULL`, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error `G_IO_ERROR_CANCELLED` will be returned.

If `progress_callback` is not `NULL`, then the operation can be monitored by setting this to a `GFileProgressCallback` function. `progress_callback_data` will be passed to this function. It is guaranteed that this callback will be called after all data has been transferred with the total number of bytes copied during the operation. Note that before release 0.31, progress_callback was broken since it only provided status for a single file transfer, but did not provide a way to determine which file it referred to. In release 0.31, this behavior was changed so that progress_callback provides the status of all ongoing file transfers. If you need to monitor the status of individual files, please connect to the `SpiceMainChannel::new-file-transfer` signal.

When the operation is finished, callback will be called. You can then call `spice_main_file_copy_finish()` to get the result of the operation. Note that before release 0.33 the callback was called for each file in multiple file transfer. This behavior was changed for the same reason as the progress_callback (above). If you need to monitor the ending of individual files, you can connect to “finished” signal from each SpiceFileTransferTask.

Available since: 0.35

This method completes asynchronously. Use `spice_main_channel_file_copy_finish()` inside the `GAsyncReadyCallback` to obtain the result of the operation.

#### Parameters

`sources`

  Type: An array of `GFile*`

  A `NULL`-terminated array of `GFile` objects to be transferred.

  The array must be `NULL`-terminated.
  The data is owned by the caller of the method.

`flags`

  Type: `GFileCopyFlags`

  Set of `GFileCopyFlags`.

`cancellable`

  Type: `GCancellable`

  Optional `GCancellable` object, `NULL` to ignore.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`progress_callback`

  Type: `GFileProgressCallback`

  Function to callback with progress information, or `NULL` if progress information is not needed.

  The argument can be `NULL`.

`progress_callback_data`

  Type: `gpointer`

  User data to pass to `progress_callback`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`callback`

  Type: `GAsyncReadyCallback`

  A `GAsyncReadyCallback` to call when the request is satisfied.

  The argument can be `NULL`.

`user_data`

  Type: `gpointer`

  The data to pass to callback function.

  The argument can be `NULL`.
  The data is owned by the caller of the method.