## Jobs Jobs |

## Synopsis

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

    ThunarVfsJob*       thunar_vfs_listdir                  (ThunarVfsPath *path,
                                                             GError **error);
    ThunarVfsJob*       thunar_vfs_create_file              (ThunarVfsPath *path,
                                                             GError **error);
    ThunarVfsJob*       thunar_vfs_create_files             (GList *path_list,
                                                             GError **error);
    ThunarVfsJob*       thunar_vfs_copy_file                (ThunarVfsPath *source_path,
                                                             ThunarVfsPath *target_path,
                                                             GError **error);
    ThunarVfsJob*       thunar_vfs_copy_files               (GList *source_path_list,
                                                             GList *target_path_list,
                                                             GError **error);
    ThunarVfsJob*       thunar_vfs_link_file                (ThunarVfsPath *source_path,
                                                             ThunarVfsPath *target_path,
                                                             GError **error);
    ThunarVfsJob*       thunar_vfs_link_files               (GList *source_path_list,
                                                             GList *target_path_list,
                                                             GError **error);
    ThunarVfsJob*       thunar_vfs_move_file                (ThunarVfsPath *source_path,
                                                             ThunarVfsPath *target_path,
                                                             GError **error);
    ThunarVfsJob*       thunar_vfs_move_files               (GList *source_path_list,
                                                             GList *target_path_list,
                                                             GError **error);
    ThunarVfsJob*       thunar_vfs_unlink_file              (ThunarVfsPath *path,
                                                             GError **error);
    ThunarVfsJob*       thunar_vfs_unlink_files             (GList *path_list,
                                                             GError **error);
    ThunarVfsJob*       thunar_vfs_make_directory           (ThunarVfsPath *path,
                                                             GError **error);
    ThunarVfsJob*       thunar_vfs_make_directories         (GList *path_list,
                                                             GError **error);
    ThunarVfsJob*       thunar_vfs_change_mode              (ThunarVfsPath *path,
                                                             ThunarVfsFileMode dir_mask,
                                                             ThunarVfsFileMode dir_mode,
                                                             ThunarVfsFileMode file_mask,
                                                             ThunarVfsFileMode file_mode,
                                                             gboolean recursive,
                                                             GError **error);
    ThunarVfsJob*       thunar_vfs_change_group             (ThunarVfsPath *path,
                                                             ThunarVfsGroupId gid,
                                                             gboolean recursive,
                                                             GError **error);
    ThunarVfsJob*       thunar_vfs_change_owner             (ThunarVfsPath *path,
                                                             ThunarVfsUserId uid,
                                                             gboolean recursive,
                                                             GError **error);
    ThunarVfsJob*       thunar_vfs_deep_count               (ThunarVfsPath *path,
                                                             ThunarVfsDeepCountFlags flags,
                                                             GError **error);

## Description

## Details

### thunar_vfs_listdir ()

    ThunarVfsJob*       thunar_vfs_listdir                  (ThunarVfsPath *path,
                                                             GError **error);

Generates a ThunarVfsJob, which lists the contents of the folder at the specified `path`. If the job could not be launched for some reason, `NULL` will be returned and `error` will be set to point to a GError describing the cause. Otherwise the newly allocated ThunarVfsJob will be returned and the caller is responsible to call `g_object_unref()`.

Note, that the returned job is launched right away, so you don't need to call `thunar_vfs_job_launch()` on it.

`path` : | the ThunarVfsPath for the folder that should be listed.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsJob or `NULL` if an error occurs while creating the job.

### thunar_vfs_create_file ()

    ThunarVfsJob*       thunar_vfs_create_file              (ThunarVfsPath *path,
                                                             GError **error);

Allocates a new ThunarVfsJob, which creates a new empty file at `path`.

The caller is responsible to free the returned job using `g_object_unref()` when no longer needed.

Note that the returned job is launched right away, so you don't need to call `thunar_vfs_job_launch()` on it.

`path` : | the ThunarVfsPath of the file to create.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsJob or `NULL` if an error occurs while creating the job.

### thunar_vfs_create_files ()

    ThunarVfsJob*       thunar_vfs_create_files             (GList *path_list,
                                                             GError **error);

Allocates a new ThunarVfsJob which creates new empty files for all ThunarVfsPaths in `path_list`.

The caller is responsible to free the returned job using `g_object_unref()` when no longer needed.

Note that the returned job is launched right away, so you don't need to call `thunar_vfs_job_launch()` on it.

`path_list` : | a list of ThunarVfsPaths for files to create.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsJob or `NULL` if an error occurs while creating the job.

### thunar_vfs_copy_file ()

    ThunarVfsJob*       thunar_vfs_copy_file                (ThunarVfsPath *source_path,
                                                             ThunarVfsPath *target_path,
                                                             GError **error);

Allocates a new ThunarVfsTransferJob, which copies the file from `source_path` to `target_path`. That said, the file or directory located at `source_path` will be placed at `target_path`, NOT INTO `target_path`.

The caller is responsible to free the returned job using `g_object_unref()` when no longer needed.

Note, that the returned job is launched right away, so you don't need to call `thunar_vfs_job_launch()` on it.

`source_path` : | the source ThunarVfsPath.
`target_path` : | the target ThunarVfsPath.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsTransferJob or `NULL` if an error occurs while creating the job.

### thunar_vfs_copy_files ()

    ThunarVfsJob*       thunar_vfs_copy_files               (GList *source_path_list,
                                                             GList *target_path_list,
                                                             GError **error);

Similar to `thunar_vfs_copy_file()`, but takes a bunch of files. The `source_path_list` and `target_path_list` must be of the same size.

Note, that the returned job is launched right away, so you don't need to call `thunar_vfs_job_launch()` on it. The caller is responsible to free the returned object using `g_object_unref()` when no longer needed.

`source_path_list` : | the list of ThunarVfsPaths that should be copied.
`target_path_list` : | the list of ThunarVfsPaths for the targets.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsTransferJob or `NULL` if an error occurs while creating the job.

### thunar_vfs_link_file ()

    ThunarVfsJob*       thunar_vfs_link_file                (ThunarVfsPath *source_path,
                                                             ThunarVfsPath *target_path,
                                                             GError **error);

Allocates a new ThunarVfsJob, which creates a symbolic link from `source_path` to `target_path`.

If `source_path` and `target_path` refer to the same file, a new unique target filename will be choosen automatically.

The caller is responsible to free the returned job using `g_object_unref()` when no longer needed.

Note, that the returned job is launched right away, so you don't need to call `thunar_vfs_job_launch()` on it.

`source_path` : | the source ThunarVfsPath.
`target_path` : | the target ThunarVfsPath.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsJob or `NULL` if an error occurs while creating the job.

### thunar_vfs_link_files ()

    ThunarVfsJob*       thunar_vfs_link_files               (GList *source_path_list,
                                                             GList *target_path_list,
                                                             GError **error);

Like `thunar_vfs_link_file()`, but works on path lists, rather than a single path. The length of the `source_path_list` and `target_path_list` must match, otherwise the behaviour is undefined, but its likely to crash the application.

Right now links can only be created from local files to local files (with path scheme `THUNAR_VFS_PATH_SCHEME_FILE`).

The caller is responsible to free the returned job using `g_object_unref()` when no longer needed.

Note, that the returned job is launched right away, so you don't need to call `thunar_vfs_job_launch()` on it.

`source_path_list` : | list of ThunarVfsPaths to the source files.
`target_path_list` : | list of ThunarVfsPaths to the target files.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsJob or `NULL` if an error occurs while creating the job.

### thunar_vfs_move_file ()

    ThunarVfsJob*       thunar_vfs_move_file                (ThunarVfsPath *source_path,
                                                             ThunarVfsPath *target_path,
                                                             GError **error);

Allocates a new ThunarVfsTransferJob, which moves the file from `source_path` to `target_path`. That said, the file or directory located at `source_path` will be placed at `target_path`, NOT INTO `target_path`.

The caller is responsible to free the returned job using `g_object_unref()` when no longer needed.

Note, that the returned job is launched right away, so you don't need to call `thunar_vfs_job_launch()` on it.

`source_path` : | the source ThunarVfsPath.
`target_path` : | the target ThunarVfsPath.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsTransferJob or `NULL` if an error occurs while creating the job.

### thunar_vfs_move_files ()

    ThunarVfsJob*       thunar_vfs_move_files               (GList *source_path_list,
                                                             GList *target_path_list,
                                                             GError **error);

Similar to `thunar_vfs_move_file()`, but takes a bunch of files. The `source_path_list` and `target_path_list` must be of the same size.

Note, that the returned job is launched right away, so you don't need to call `thunar_vfs_job_launch()` on it. The caller is responsible to free the returned object using `g_object_unref()` when no longer needed.

`source_path_list` : | the list of ThunarVfsPaths that should be moved.
`target_path_list` : | the list of ThunarVfsPaths to the targets.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsTransferJob or `NULL` if an error occurs while creating the job.

### thunar_vfs_unlink_file ()

    ThunarVfsJob*       thunar_vfs_unlink_file              (ThunarVfsPath *path,
                                                             GError **error);

Simple wrapper to `thunar_vfs_unlink_files()`, which takes only a single path.

Note, that the returned job is launched right away, so you don't need to call `thunar_vfs_job_launch()` on it. The caller is responsible to free the returned object using `g_object_unref()` when no longer needed.

`path` : | a ThunarVfsPath, that should be unlinked.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsJob or `NULL` if an error occurs while creating the job.

### thunar_vfs_unlink_files ()

    ThunarVfsJob*       thunar_vfs_unlink_files             (GList *path_list,
                                                             GError **error);

Allocates a new ThunarVfsJob which recursively unlinks all files referenced by the `path_list`. If the job cannot be launched for some reason, `NULL` will be returned and `error` will be set to point to a GError describing the cause. Else, the newly allocated ThunarVfsJob will be returned, and the caller is responsible to free it using `g_object_unref()` when no longer needed.

Note, that the returned job is launched right away, so you don't need to call `thunar_vfs_job_launch()` on it.

`path_list` : | a list of ThunarVfsPaths, that should be unlinked.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsJob or `NULL` if an error occurs while creating the job.

### thunar_vfs_make_directory ()

    ThunarVfsJob*       thunar_vfs_make_directory           (ThunarVfsPath *path,
                                                             GError **error);

Simple wrapper for `thunar_vfs_make_directories()`.

`path` : | the ThunarVfsPath to the directory to create.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsJob or `NULL` if an error occurs while creating the job.

### thunar_vfs_make_directories ()

    ThunarVfsJob*       thunar_vfs_make_directories         (GList *path_list,
                                                             GError **error);

Allocates a new ThunarVfsJob to create new directories at all ThunarVfsPaths specified in `path_list`. Returns `NULL` if the job could not be launched for some reason, and `error` will be set to point to a GError describing the cause. Otherwise the job will be returned and the caller is responsible to free the returned object using `g_object_unref()` when no longer needed.

Note, that the returned job is launched right away, so you don't need to call `thunar_vfs_job_launch()` on it.

`path_list` : | a list of ThunarVfsPaths that contain the paths to the directories which should be created.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsJob or `NULL` if an error occurs while creating the job.

### thunar_vfs_change_mode ()

    ThunarVfsJob*       thunar_vfs_change_mode              (ThunarVfsPath *path,
                                                             ThunarVfsFileMode dir_mask,
                                                             ThunarVfsFileMode dir_mode,
                                                             ThunarVfsFileMode file_mask,
                                                             ThunarVfsFileMode file_mode,
                                                             gboolean recursive,
                                                             GError **error);

The caller is responsible to free the returned job using `g_object_unref()` when no longer needed.

Note, that the returned job is launched right away, so you don't need to call `thunar_vfs_job_launch()` on it.

`path` : | the base ThunarVfsPath.
`dir_mask` : | the mask for the `dir_mode`.
`dir_mode` : | the new mode for directories.
`file_mask` : | the mask for the `file_mode`.
`file_mode` : | the new mode for files.
`recursive` : | whether to change permissions recursively.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsJob or `NULL` if an error occurs while creating the job.

### thunar_vfs_change_group ()

    ThunarVfsJob*       thunar_vfs_change_group             (ThunarVfsPath *path,
                                                             ThunarVfsGroupId gid,
                                                             gboolean recursive,
                                                             GError **error);

The caller is responsible to free the returned job using `g_object_unref()` when no longer needed.

Note, that the returned job is launched right away, so you don't need to call `thunar_vfs_job_launch()` on it.

`path` : | the base ThunarVfsPath.
`gid` : | the new group id.
`recursive` : | whether to change groups recursively.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsJob or `NULL` if an error occurs while creating the job.

### thunar_vfs_change_owner ()

    ThunarVfsJob*       thunar_vfs_change_owner             (ThunarVfsPath *path,
                                                             ThunarVfsUserId uid,
                                                             gboolean recursive,
                                                             GError **error);

The caller is responsible to free the returned job using `g_object_unref()` when no longer needed.

Note, that the returned job is launched right away, so you don't need to call `thunar_vfs_job_launch()` on it.

`path` : | the base ThunarVfsPath.
`uid` : | the new user id.
`recursive` : | whether to change groups recursively.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsChownJob or `NULL` if an error occurs while creating the job.

### thunar_vfs_deep_count ()

    ThunarVfsJob*       thunar_vfs_deep_count               (ThunarVfsPath *path,
                                                             ThunarVfsDeepCountFlags flags,
                                                             GError **error);

Starts a ThunarVfsJob, which will count the number of items in the directory specified by `path` and also determine the total size. If `path` is not a directory, then the size of the item at `path` will be determined.

The caller is responsible to free the returned job using `g_object_unref()` when no longer needed.

Note, that the returned job is launched right away, so you don't need to call `thunar_vfs_job_launch()` on it.

`path` : | the base ThunarVfsPath.
`flags` : | the ThunarVfsDeepCountFlags which control the behaviour of the returned job.
`error` : | return location for errors or `NULL`.
Returns : | the newly allocated ThunarVfsDeepCountJob or `NULL` if an error occurs while creating the job.