ThunarVfsJob

## ThunarVfsJob ThunarVfsJob — |

## Synopsis

    #include <thunar-vfs/thunar-vfs.h>

    enum                ThunarVfsJobResponse;
                        ThunarVfsJob;
    ThunarVfsJob*       thunar_vfs_job_launch               (ThunarVfsJob *job);
    void                thunar_vfs_job_cancel               (ThunarVfsJob *job);
    gboolean            thunar_vfs_job_cancelled            (const ThunarVfsJob *job);

## Object Hierarchy

      GObject
       +----ThunarVfsJob

## Signals

      "ask"                                            : Run Last / No Hooks
      "ask-replace"                                    : Run Last / No Hooks
      "error"                                          : No Hooks
      "finished"                                       : No Hooks
      "info-message"                                   : No Hooks
      "infos-ready"                                    : No Hooks
      "new-files"                                      : No Hooks
      "percent"                                        : No Hooks

## Description

## Details

### enum ThunarVfsJobResponse

    typedef enum /*< flags >*/
    {
      THUNAR_VFS_JOB_RESPONSE_YES     = 1 << 0,
      THUNAR_VFS_JOB_RESPONSE_YES_ALL = 1 << 1,
      THUNAR_VFS_JOB_RESPONSE_NO      = 1 << 2,
      THUNAR_VFS_JOB_RESPONSE_CANCEL  = 1 << 3,
      THUNAR_VFS_JOB_RESPONSE_NO_ALL  = 1 << 4,
      THUNAR_VFS_JOB_RESPONSE_RETRY   = 1 << 5,
    } ThunarVfsJobResponse;

Possible responses for the ThunarVfsJob::ask signal.

### ThunarVfsJob

    typedef struct _ThunarVfsJob ThunarVfsJob;

### thunar_vfs_job_launch ()

    ThunarVfsJob*       thunar_vfs_job_launch               (ThunarVfsJob *job);

This functions schedules `job` to be run as soon as possible, in a separate thread.

`job` : | a ThunarVfsJob.
Returns : | a pointer to `job`.

### thunar_vfs_job_cancel ()

    void                thunar_vfs_job_cancel               (ThunarVfsJob *job);

Attempts to cancel the operation currently performed by `job`. Even after the cancellation of `job`, it may still emit signals, so you must take care of disconnecting all handlers appropriately if you cannot handle signals after cancellation.

`job` : | a ThunarVfsJob.

### thunar_vfs_job_cancelled ()

    gboolean            thunar_vfs_job_cancelled            (const ThunarVfsJob *job);

Checks whether `job` was previously cancelled by a call to `thunar_vfs_job_cancel()`.

`job` : | a ThunarVfsJob.
Returns : | `TRUE` if `job` is cancelled.

## Signal Details

### The "ask" signal

    ThunarVfsJobResponseuser_function                      (ThunarVfsJob        *job,
                                                            gchar               *message,
                                                            ThunarVfsJobResponse choices,
                                                            gpointer             user_data)      : Run Last / No Hooks

The `message` is garantied to contain valid UTF-8.

`job` : | a ThunarVfsJob.
`message` : | question to display to the user.
`choices` : | a combination of ThunarVfsInteractiveJobResponses.
`user_data` : | user data set when the signal handler was connected.
Returns : | the selected choice.

### The "ask-replace" signal

    ThunarVfsJobResponseuser_function                      (ThunarVfsJob  *job,
                                                            ThunarVfsInfo *src_info,
                                                            ThunarVfsInfo *dst_info,
                                                            gpointer       user_data)      : Run Last / No Hooks

Emitted to ask the user whether the destination file should be replaced by the source file.

`job` : | a ThunarVfsJob.
`src_info` : | the ThunarVfsInfo of the source file.
`dst_info` : | the ThunarVfsInfo of the destination file, that may be replaced with the source file.
`user_data` : | user data set when the signal handler was connected.
Returns : | the selected choice.

Since 0.8.1

### The "error" signal

    void                user_function                      (ThunarVfsJob *job,
                                                            gpointer      error,
                                                            gpointer      user_data)      : No Hooks

Emitted whenever an error occurs while executing the `job`.

`job` : | a ThunarVfsJob.
`error` : | a GError describing the cause.
`user_data` : | user data set when the signal handler was connected.

### The "finished" signal

    void                user_function                      (ThunarVfsJob *job,
                                                            gpointer      user_data)      : No Hooks

This signal will be automatically emitted once the `job` finishes its execution, no matter whether `job` completed successfully or was cancelled by the user.

`job` : | a ThunarVfsJob.
`user_data` : | user data set when the signal handler was connected.

### The "info-message" signal

    void                user_function                      (ThunarVfsJob *job,
                                                            gchar        *message,
                                                            gpointer      user_data)      : No Hooks

This signal is emitted to display information about the `job`. Examples of messages are "Preparing..." or "Cleaning up...".

The `message` is garantied to contain valid UTF-8, so it can be displayed by GtkWidgets out of the box.

`job` : | a ThunarVfsJob.
`message` : | information to be displayed about `job`.
`user_data` : | user data set when the signal handler was connected.

### The "infos-ready" signal

    gboolean            user_function                      (ThunarVfsJob *job,
                                                            gpointer      info_list,
                                                            gpointer      user_data)      : No Hooks

This signal is used by ThunarVfsJobs returned by the `thunar_vfs_listdir()` function whenever there's a bunch of ThunarVfsInfos ready. This signal is garantied to be never emitted with an `info_list` parameter of `NULL`.

To allow some further optimizations on the handler-side, the handler is allowed to take over ownership of the `info_list`, i.e. it can reuse the `infos` list and just replace the data elements with it's own objects based on the ThunarVfsInfos contained within the `info_list` (and of course properly unreffing the previously contained infos). If a handler takes over ownership of `info_list` it must return `TRUE` here, and no further handlers will be run. Else, if the handler doesn't want to take over ownership of `infos`, it must return `FALSE`, and other handlers will be run. Use this feature with care, and only if you can be sure that you are the only handler connected to this signal for a given job!

`job` : | a ThunarVfsJob.
`info_list` : | a list of ThunarVfsInfos.
`user_data` : | user data set when the signal handler was connected.
Returns : | `TRUE` if the handler took over ownership of `info_list`, else `FALSE`.

### The "new-files" signal

    void                user_function                      (ThunarVfsJob *job,
                                                            gpointer      path_list,
                                                            gpointer      user_data)      : No Hooks

This signal is emitted by the `job` right before the `job` is terminated and informs the application about the list of created files in `path_list`. `path_list` contains only the toplevel path items, that were specified by the application on creation of the `job`.

`job` : | a ThunarVfsJob.
`path_list` : | a list of ThunarVfsPaths that were created by `job`.
`user_data` : | user data set when the signal handler was connected.

### The "percent" signal

    void                user_function                      (ThunarVfsJob *job,
                                                            gdouble       percent,
                                                            gpointer      user_data)      : No Hooks

This signal is emitted to present the state of the overall progress.

The `percent` value is garantied to be in the range 0.0 to 100.0.

`job` : | a ThunarVfsJob.
`percent` : | the percentage of completeness.
`user_data` : | user data set when the signal handler was connected.