## PkTask

PkTask — An abstract package task GObject, dealing with unsigned transactions, GPG keys and EULA requests.

## Synopsis

    #define             PK_TASK_ERROR
    #define             PK_TASK_TYPE_ERROR
                        PkTaskPrivate;
                        PkTask;
    GQuark              pk_task_error_quark                 (void);
    PkTask *            pk_task_new                         (void);
    void                pk_task_test                        (gpointer user_data);
    PkResults *         pk_task_generic_finish              (PkTask *task,
                                                             GAsyncResult *res,
                                                             GError **error);
    void                pk_task_install_packages_async      (PkTask *task,
                                                             gchar **package_ids,
                                                             GCancellable *cancellable,
                                                             PkProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    void                pk_task_update_packages_async       (PkTask *task,
                                                             gchar **package_ids,
                                                             GCancellable *cancellable,
                                                             PkProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GAsyncReadyCallback callback_ready,
                                                             gpointer user_data);
    void                pk_task_remove_packages_async       (PkTask *task,
                                                             gchar **package_ids,
                                                             gboolean allow_deps,
                                                             gboolean autoremove,
                                                             GCancellable *cancellable,
                                                             PkProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GAsyncReadyCallback callback_ready,
                                                             gpointer user_data);
    void                pk_task_install_files_async         (PkTask *task,
                                                             gchar **files,
                                                             GCancellable *cancellable,
                                                             PkProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GAsyncReadyCallback callback_ready,
                                                             gpointer user_data);
    void                pk_task_update_system_async         (PkTask *task,
                                                             GCancellable *cancellable,
                                                             PkProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GAsyncReadyCallback callback_ready,
                                                             gpointer user_data);
    gboolean            pk_task_user_accepted               (PkTask *task,
                                                             guint request);
    gboolean            pk_task_user_declined               (PkTask *task,
                                                             guint request);

## Object Hierarchy

      GObject
       +----PkClient
             +----PkTask
                   +----PkTaskText
                   +----PkTaskWrapper

## Properties

      "simulate"                 gboolean              : Read / Write

## Description

## Details

### PK_TASK_ERROR

    #define PK_TASK_ERROR		(pk_task_error_quark ())

### PK_TASK_TYPE_ERROR

    #define PK_TASK_TYPE_ERROR (pk_task_error_get_type ())

### PkTaskPrivate

    typedef struct _PkTaskPrivate PkTaskPrivate;

Private PkTask data

### PkTask

    typedef struct _PkTask PkTask;

### pk_task_error_quark ()

    GQuark              pk_task_error_quark                 (void);

Returns : |

### pk_task_new ()

    PkTask *            pk_task_new                         (void);

Returns : | a new PkTask object.

Since 0.5.2

### pk_task_test ()

    void                pk_task_test                        (gpointer user_data);

`user_data` : |

### pk_task_generic_finish ()

    PkResults *         pk_task_generic_finish              (PkTask *task,
                                                             GAsyncResult *res,
                                                             GError **error);

Gets the result from the asynchronous function.

`task` : | a valid PkTask instance
`res` : | the GAsyncResult
`error` : | A GError or `NULL`
Returns : | `TRUE` for success

Since 0.5.2

### pk_task_install_packages_async ()

    void                pk_task_install_packages_async      (PkTask *task,
                                                             gchar **package_ids,
                                                             GCancellable *cancellable,
                                                             PkProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Merges in details about packages using resolve.

`task` : | a valid PkTask instance
`package_ids` : | a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"
`cancellable` : | a GCancellable or `NULL`
`progress_callback` : | the function to run when the progress changes
`progress_user_data` : | data to pass to `progress_callback`
`callback` : | the function to run on completion
`user_data` : | the data to pass to `callback`

Since 0.5.2

### pk_task_update_packages_async ()

    void                pk_task_update_packages_async       (PkTask *task,
                                                             gchar **package_ids,
                                                             GCancellable *cancellable,
                                                             PkProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GAsyncReadyCallback callback_ready,
                                                             gpointer user_data);

Update specific packages to the newest available versions.

`task` : | a valid PkTask instance
`package_ids` : | a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"
`cancellable` : | a GCancellable or `NULL`
`progress_callback` : | the function to run when the progress changes
`progress_user_data` : | data to pass to `progress_callback`
`callback_ready` : | the function to run on completion
`user_data` : | the data to pass to `callback_ready`

Since 0.5.2

### pk_task_remove_packages_async ()

    void                pk_task_remove_packages_async       (PkTask *task,
                                                             gchar **package_ids,
                                                             gboolean allow_deps,
                                                             gboolean autoremove,
                                                             GCancellable *cancellable,
                                                             PkProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GAsyncReadyCallback callback_ready,
                                                             gpointer user_data);

Remove a package (optionally with dependancies) from the system. If `allow_deps` is set to `FALSE`, and other packages would have to be removed, then the transaction would fail.

`task` : | a valid PkTask instance
`package_ids` : | a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"
`allow_deps` : | if other dependant packages are allowed to be removed from the computer
`autoremove` : | if other packages installed at the same time should be tried to remove
`cancellable` : | a GCancellable or `NULL`
`progress_callback` : | the function to run when the progress changes
`progress_user_data` : | data to pass to `progress_callback`
`callback_ready` : | the function to run on completion
`user_data` : | the data to pass to `callback_ready`

Since 0.5.2

### pk_task_install_files_async ()

    void                pk_task_install_files_async         (PkTask *task,
                                                             gchar **files,
                                                             GCancellable *cancellable,
                                                             PkProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GAsyncReadyCallback callback_ready,
                                                             gpointer user_data);

Install a file locally, and get the deps from the repositories. This is useful for double clicking on a .rpm or .deb file.

`task` : | a valid PkTask instance
`files` : | a file such as "/home/hughsie/Desktop/hal-devel-0.10.0.rpm"
`cancellable` : | a GCancellable or `NULL`
`progress_callback` : | the function to run when the progress changes
`progress_user_data` : | data to pass to `progress_callback`
`callback_ready` : | the function to run on completion
`user_data` : | the data to pass to `callback_ready`

Since 0.5.2

### pk_task_update_system_async ()

    void                pk_task_update_system_async         (PkTask *task,
                                                             GCancellable *cancellable,
                                                             PkProgressCallback progress_callback,
                                                             gpointer progress_user_data,
                                                             GAsyncReadyCallback callback_ready,
                                                             gpointer user_data);

Update all the packages on the system with the highest versions found in all repositories. NOTE: you can't choose what repositories to update from, but you can do: - `pk_task_repo_disable()` - `pk_task_update_system()` - `pk_task_repo_enable()`

`task` : | a valid PkTask instance
`cancellable` : | a GCancellable or `NULL`
`progress_callback` : | the function to run when the progress changes
`progress_user_data` : | data to pass to `progress_callback`
`callback_ready` : | the function to run on completion
`user_data` : | the data to pass to `callback_ready`

Since 0.5.2

### pk_task_user_accepted ()

    gboolean            pk_task_user_accepted               (PkTask *task,
                                                             guint request);

`task` : |
`request` : |
Returns : |

Since 0.5.2

### pk_task_user_declined ()

    gboolean            pk_task_user_declined               (PkTask *task,
                                                             guint request);

`task` : |
`request` : |
Returns : |

Since 0.5.2

## Property Details

### The `"simulate"` property

      "simulate"                 gboolean              : Read / Write

Default value: TRUE

Since 0.5.2