File Transfer Task: Spice-GTK Reference Manual

## File Transfer Task File Transfer Task — Monitoring file transfers |

## Stability Level

Stable, unless otherwise indicated

## Functions

double | spice_file_transfer_task_get_progress ()
char * | spice_file_transfer_task_get_filename ()
guint64 | spice_file_transfer_task_get_total_bytes ()
guint64 | spice_file_transfer_task_get_transferred_bytes ()
void | spice_file_transfer_task_cancel ()

## Properties

GCancellable * | cancellable | Read / Write / Construct Only
SpiceMainChannel * | channel | Read / Write / Construct Only
GFile * | file | Read / Write / Construct Only
guint | id | Read / Write / Construct Only
gdouble | progress | Read
guint64 | total-bytes | Read
guint64 | transferred-bytes | Read

## Signals

void | finished | Run First

## Object Hierarchy

        GObject
        ╰── SpiceFileTransferTask

## Includes

    #include <spice-client.h>

## Description

SpiceFileTransferTask is an object that represents a particular file transfer between the client and the guest. The properties and signals of the object can be used to monitor the status and result of the transfer. The Main Channel's “new-file-transfer” signal will be emitted whenever a new file transfer task is initiated.

## Functions

### spice_file_transfer_task_get_progress ()

    double
    spice_file_transfer_task_get_progress (SpiceFileTransferTask *self);

Convenience function for retrieving the current progress of this file transfer task.

#### Parameters

self | a file transfer task |

#### Returns

A fractional value between 0 and 1.0

Since: 0.31

### spice_file_transfer_task_get_filename ()

    char *
    spice_file_transfer_task_get_filename (SpiceFileTransferTask *self);

Gets the name of the file being transferred in this task

#### Parameters

self | a file transfer task |

#### Returns

The basename of the file.

[transfer full]

Since: 0.31

### spice_file_transfer_task_get_total_bytes ()

    guint64
    spice_file_transfer_task_get_total_bytes
                                   (SpiceFileTransferTask *self);

Gets the total size in bytes of the file transfer.

#### Parameters

self | a file transfer task |

#### Returns

The total size of the file transfer

Since: 0.33

### spice_file_transfer_task_get_transferred_bytes ()

    guint64
    spice_file_transfer_task_get_transferred_bytes
                                   (SpiceFileTransferTask *self);

Gets the number of bytes that have been transferred so far.

#### Parameters

self | a file transfer task |

#### Returns

The number of transferred bytes

Since: 0.33

### spice_file_transfer_task_cancel ()

    void
    spice_file_transfer_task_cancel (SpiceFileTransferTask *self);

Cancels the file transfer task. Note that depending on how the file transfer was initiated, multiple file transfer tasks may share a single “cancellable” object, so canceling one task may result in the cancellation of other tasks.

#### Parameters

self | a file transfer task |

Since: 0.31

## Types and Values

## Property Details

### The `“cancellable”` property

      “cancellable”              GCancellable *

A cancellable object used to cancel the file transfer

Flags: Read / Write / Construct Only

Since: 0.31

### The `“channel”` property

      “channel”                  SpiceMainChannel *

The main channel that owns the file transfer task

Flags: Read / Write / Construct Only

Since: 0.31

### The `“file”` property

      “file”                     GFile *

The file that is being transferred in this file transfer task

Flags: Read / Write / Construct Only

Since: 0.31

### The `“id”` property

      “id”                       guint

The ID of the file transfer task

Flags: Read / Write / Construct Only

Default value: 0

Since: 0.31

### The `“progress”` property

      “progress”                 gdouble

The current state of the file transfer. This value indicates a fraction, and ranges from 0 to 1.0. Listen for change notifications on this property to be updated whenever the file transfer progress changes.

Flags: Read

Allowed values: [0,1]

Default value: 0

Since: 0.31

### The `“total-bytes”` property

      “total-bytes”              guint64

The total size in bytes of this file transfer.

Flags: Read

Default value: 0

Since: 0.33

### The `“transferred-bytes”` property

      “transferred-bytes”        guint64

The number of bytes that have been transferred so far.

Flags: Read

Default value: 0

Since: 0.33

## Signal Details

### The `“finished”` signal

    void
    user_function (SpiceFileTransferTask *task,
                   GError                *error,
                   gpointer               user_data)

The “finished” signal is emitted when the file transfer has completed transferring to the guest.

#### Parameters

task | the file transfer task that emitted the signal |
error | the error state of the transfer. Will be `NULL` if the file transfer was successful. | [transfer none]
user_data | user data set when the signal handler was connected. |

Flags: Run First

Since: 0.31

## See Also

SpiceMainChannel