PkClient

PkClient — GObject class for PackageKit client access

Synopsis

#define             PK_CLIENT_ERROR
#define             PK_CLIENT_TYPE_ERROR
#define             PK_CLIENT_PERCENTAGE_INVALID
enum                PkClientError;
                    PkClientPrivate;
                    PkClient;
GQuark              pk_client_error_quark               (void);
GType               pk_client_get_type                  (void);
PkClient *          pk_client_new                       (void);
gboolean            pk_client_set_tid                   (PkClient *client,
                                                         const gchar *tid,
                                                         GError **error);
gchar *             pk_client_get_tid                   (PkClient *client);
gboolean            pk_client_set_use_buffer            (PkClient *client,
                                                         gboolean use_buffer,
                                                         GError **error);
gboolean            pk_client_set_synchronous           (PkClient *client,
                                                         gboolean synchronous,
                                                         GError **error);
gboolean            pk_client_set_timeout               (PkClient *client,
                                                         gint timeout,
                                                         GError **error);
gboolean            pk_client_get_use_buffer            (PkClient *client);
gboolean            pk_client_get_allow_cancel          (PkClient *client,
                                                         gboolean *allow_cancel,
                                                         GError **error);
gboolean            pk_client_get_status                (PkClient *client,
                                                         PkStatusEnum *status,
                                                         GError **error);
gboolean            pk_client_get_role                  (PkClient *client,
                                                         PkRoleEnum *role,
                                                         gchar **text,
                                                         GError **error);
gboolean            pk_client_get_progress              (PkClient *client,
                                                         guint *percentage,
                                                         guint *subpercentage,
                                                         guint *elapsed,
                                                         guint *remaining,
                                                         GError **error);
gboolean            pk_client_get_package               (PkClient *client,
                                                         gchar **package,
                                                         GError **error);
gboolean            pk_client_set_locale                (PkClient *client,
                                                         const gchar *code,
                                                         GError **error);
gboolean            pk_client_cancel                    (PkClient *client,
                                                         GError **error);
gboolean            pk_client_download_packages         (PkClient *client,
                                                         gchar **package_ids,
                                                         const gchar *directory,
                                                         GError **error);
gboolean            pk_client_get_updates               (PkClient *client,
                                                         PkBitfield filters,
                                                         GError **error);
gboolean            pk_client_update_system             (PkClient *client,
                                                         GError **error);
gboolean            pk_client_search_name               (PkClient *client,
                                                         PkBitfield filters,
                                                         const gchar *search,
                                                         GError **error);
gboolean            pk_client_search_details            (PkClient *client,
                                                         PkBitfield filters,
                                                         const gchar *search,
                                                         GError **error);
gboolean            pk_client_search_group              (PkClient *client,
                                                         PkBitfield filters,
                                                         const gchar *search,
                                                         GError **error);
gboolean            pk_client_search_file               (PkClient *client,
                                                         PkBitfield filters,
                                                         const gchar *search,
                                                         GError **error);
gboolean            pk_client_get_depends               (PkClient *client,
                                                         PkBitfield filters,
                                                         gchar **package_ids,
                                                         gboolean recursive,
                                                         GError **error);
gboolean            pk_client_get_packages              (PkClient *client,
                                                         PkBitfield filters,
                                                         GError **error);
gboolean            pk_client_get_update_detail         (PkClient *client,
                                                         gchar **package_ids,
                                                         GError **error);
gboolean            pk_client_get_requires              (PkClient *client,
                                                         PkBitfield filters,
                                                         gchar **package_ids,
                                                         gboolean recursive,
                                                         GError **error);
gboolean            pk_client_what_provides             (PkClient *client,
                                                         PkBitfield filters,
                                                         PkProvidesEnum provides,
                                                         const gchar *search,
                                                         GError **error);
gboolean            pk_client_get_details               (PkClient *client,
                                                         gchar **package_ids,
                                                         GError **error);
gboolean            pk_client_get_distro_upgrades       (PkClient *client,
                                                         GError **error);
gboolean            pk_client_get_files                 (PkClient *client,
                                                         gchar **package_ids,
                                                         GError **error);
gboolean            pk_client_get_categories            (PkClient *client,
                                                         GError **error);
gboolean            pk_client_remove_packages           (PkClient *client,
                                                         gchar **package_ids,
                                                         gboolean allow_deps,
                                                         gboolean autoremove,
                                                         GError **error);
gboolean            pk_client_refresh_cache             (PkClient *client,
                                                         gboolean force,
                                                         GError **error);
gboolean            pk_client_install_packages          (PkClient *client,
                                                         gchar **package_ids,
                                                         GError **error);
gboolean            pk_client_install_signature         (PkClient *client,
                                                         PkSigTypeEnum type,
                                                         const gchar *key_id,
                                                         const gchar *package_id,
                                                         GError **error);
gboolean            pk_client_update_packages           (PkClient *client,
                                                         gchar **package_ids,
                                                         GError **error);
gboolean            pk_client_install_files             (PkClient *client,
                                                         gboolean trusted,
                                                         gchar **files_rel,
                                                         GError **error);
gboolean            pk_client_install_file              (PkClient *client,
                                                         gboolean trusted,
                                                         const gchar *file_rel,
                                                         GError **error);
gboolean            pk_client_resolve                   (PkClient *client,
                                                         PkBitfield filters,
                                                         gchar **packages,
                                                         GError **error);
gboolean            pk_client_rollback                  (PkClient *client,
                                                         const gchar *transaction_id,
                                                         GError **error);
gboolean            pk_client_requeue                   (PkClient *client,
                                                         GError **error);
gboolean            pk_client_accept_eula               (PkClient *client,
                                                         const gchar *eula_id,
                                                         GError **error);
gboolean            pk_client_get_repo_list             (PkClient *client,
                                                         PkBitfield filters,
                                                         GError **error);
gboolean            pk_client_repo_enable               (PkClient *client,
                                                         const gchar *repo_id,
                                                         gboolean enabled,
                                                         GError **error);
gboolean            pk_client_repo_set_data             (PkClient *client,
                                                         const gchar *repo_id,
                                                         const gchar *parameter,
                                                         const gchar *value,
                                                         GError **error);
PkPackageList *     pk_client_get_package_list          (PkClient *client);
PkRestartEnum       pk_client_get_require_restart       (PkClient *client);
const GPtrArray *   pk_client_get_require_restart_list  (PkClient *client);
PkObjList *         pk_client_get_cached_objects        (PkClient *client);
gboolean            pk_client_reset                     (PkClient *client,
                                                         GError **error);
gboolean            pk_client_get_old_transactions      (PkClient *client,
                                                         guint number,
                                                         GError **error);
gboolean            pk_client_is_caller_active          (PkClient *client,
                                                         gboolean *is_active,
                                                         GError **error);

Object Hierarchy

  GObject
   +----PkClient

Signals

  "allow-cancel"                                   : Run Last
  "caller-active-changed"                          : Run Last
  "category"                                       : Run Last
  "destroy"                                        : Run Last
  "details"                                        : Run Last
  "distro-upgrade"                                 : Run Last
  "error-code"                                     : Run Last
  "eula-required"                                  : Run Last
  "files"                                          : Run Last
  "finished"                                       : Run Last
  "media-change-required"                          : Run Last
  "message"                                        : Run Last
  "package"                                        : Run Last
  "progress-changed"                               : Run Last
  "repo-detail"                                    : Run Last
  "repo-signature-required"                        : Run Last
  "require-restart"                                : Run Last
  "status-changed"                                 : Run Last
  "transaction"                                    : Run Last
  "update-detail"                                  : Run Last

Description

A nice GObject to use for accessing PackageKit asynchronously

Details

PK_CLIENT_ERROR

#define PK_CLIENT_ERROR	 	(pk_client_error_quark ())


PK_CLIENT_TYPE_ERROR

#define PK_CLIENT_TYPE_ERROR	(pk_client_error_get_type ())


PK_CLIENT_PERCENTAGE_INVALID

#define PK_CLIENT_PERCENTAGE_INVALID	101

The unknown percentage value


enum PkClientError

typedef enum
{
	PK_CLIENT_ERROR_FAILED,
	PK_CLIENT_ERROR_FAILED_AUTH,
	PK_CLIENT_ERROR_NO_TID,
	PK_CLIENT_ERROR_ALREADY_TID,
	PK_CLIENT_ERROR_ROLE_UNKNOWN,
	PK_CLIENT_ERROR_CANNOT_START_DAEMON,
	PK_CLIENT_ERROR_INVALID_INPUT,
	PK_CLIENT_ERROR_INVALID_FILE,
	PK_CLIENT_ERROR_NOT_SUPPORTED
} PkClientError;

Errors that can be thrown

PK_CLIENT_ERROR_FAILED

the transaction failed for an unknown reason

PK_CLIENT_ERROR_FAILED_AUTH

PK_CLIENT_ERROR_NO_TID

the transaction id was not pre-allocated (internal error)

PK_CLIENT_ERROR_ALREADY_TID

the transaction id has already been used (internal error)

PK_CLIENT_ERROR_ROLE_UNKNOWN

the role was not set (internal error)

PK_CLIENT_ERROR_CANNOT_START_DAEMON

PK_CLIENT_ERROR_INVALID_INPUT

the package_id is invalid

PK_CLIENT_ERROR_INVALID_FILE

PK_CLIENT_ERROR_NOT_SUPPORTED


PkClientPrivate

typedef struct _PkClientPrivate PkClientPrivate;

Private PkClient data


PkClient

typedef struct _PkClient PkClient;


pk_client_error_quark ()

GQuark              pk_client_error_quark               (void);

Returns :

Our personal error quark.

pk_client_get_type ()

GType               pk_client_get_type                  (void);

Returns :


pk_client_new ()

PkClient *          pk_client_new                       (void);

PkClient is a nice GObject wrapper for PackageKit and makes writing frontends easy.

Returns :

A new PkClient instance

pk_client_set_tid ()

gboolean            pk_client_set_tid                   (PkClient *client,
                                                         const gchar *tid,
                                                         GError **error);

This method sets the transaction ID that should be used for the DBUS method and then watched for any callback signals. You cannot call pk_client_set_tid multiple times for one instance.

client :

a valid PkClient instance

tid :

a transaction id

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if set correctly

pk_client_get_tid ()

gchar *             pk_client_get_tid                   (PkClient *client);

The tid is unique for this transaction.

client :

a valid PkClient instance

Returns :

The transaction_id we are using for this client, or NULL

pk_client_set_use_buffer ()

gboolean            pk_client_set_use_buffer            (PkClient *client,
                                                         gboolean use_buffer,
                                                         GError **error);

If the package buffer is enabled then after the transaction has completed then the package list can be retrieved in one go, rather than processing each package request async. If this is not set true explicitly, then pk_client_get_package_list will always return zero items.

This is not forced on as there may be significant overhead if the list contains many hundreds of items.

client :

a valid PkClient instance

use_buffer :

if we should use the package buffer

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the package buffer was enabled

pk_client_set_synchronous ()

gboolean            pk_client_set_synchronous           (PkClient *client,
                                                         gboolean synchronous,
                                                         GError **error);

A synchronous mode allows us to listen in all transactions.

client :

a valid PkClient instance

synchronous :

if we should do the method synchronous

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the synchronous mode was enabled

pk_client_set_timeout ()

gboolean            pk_client_set_timeout               (PkClient *client,
                                                         gint timeout,
                                                         GError **error);

A synchronous mode allows us to listen in all transactions.

client :

a valid PkClient instance

timeout :

the timeout in milliseconds, or -1 for disabled

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the timeout mode was set

pk_client_get_use_buffer ()

gboolean            pk_client_get_use_buffer            (PkClient *client);

Are we using a client side package buffer?

client :

a valid PkClient instance

Returns :

TRUE if the package buffer is enabled

pk_client_get_allow_cancel ()

gboolean            pk_client_get_allow_cancel          (PkClient *client,
                                                         gboolean *allow_cancel,
                                                         GError **error);

Should we be allowed to cancel this transaction? The tid should have been set with pk_client_set_tid() if this is being done on a foreign object.

client :

a valid PkClient instance

allow_cancel :

TRUE if we are able to cancel the transaction

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon serviced the request

pk_client_get_status ()

gboolean            pk_client_get_status                (PkClient *client,
                                                         PkStatusEnum *status,
                                                         GError **error);

Gets the status of a transaction. A transaction has one roles in it's lifetime, but many values of status.

client :

a valid PkClient instance

status :

a PkStatusEnum value such as PK_STATUS_ENUM_WAITING

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if we found the status successfully

pk_client_get_role ()

gboolean            pk_client_get_role                  (PkClient *client,
                                                         PkRoleEnum *role,
                                                         gchar **text,
                                                         GError **error);

The role is the action of the transaction as does not change for the entire lifetime of the transaction.

client :

a valid PkClient instance

role :

a PkRoleEnum value such as PK_ROLE_ENUM_UPDATE_SYSTEM

text :

the primary search term or package name associated with the role

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if we found the status successfully

pk_client_get_progress ()

gboolean            pk_client_get_progress              (PkClient *client,
                                                         guint *percentage,
                                                         guint *subpercentage,
                                                         guint *elapsed,
                                                         guint *remaining,
                                                         GError **error);

To show the user a progress bar or dialog is much more friendly than just a pulsing bar, so we can return this information here. NOTE: the time_remaining value is guessed and may not be accurate if the backend does not do frequent calls to pk_backend_set_percentage().

client :

a valid PkClient instance

percentage :

the percentage complete of the transaction

subpercentage :

the percentage complete of the sub-transaction

elapsed :

the duration so far of the transaction

remaining :

the estimated time to completion of the transaction

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if we found the progress successfully

pk_client_get_package ()

gboolean            pk_client_get_package               (PkClient *client,
                                                         gchar **package,
                                                         GError **error);

Gets the aim of the transaction, e.g. what was asked to be installed or searched for.

client :

a valid PkClient instance

package :

a package_id or free text string

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if we found the status successfully

pk_client_set_locale ()

gboolean            pk_client_set_locale                (PkClient *client,
                                                         const gchar *code,
                                                         GError **error);

Set the locale for this transaction. You normally don't need to call this function as the locale is set automatically when the tid is requested.

client :

a valid PkClient instance

code :

a valid locale code, e.g. en_GB

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_cancel ()

gboolean            pk_client_cancel                    (PkClient *client,
                                                         GError **error);

Cancel the transaction if possible. This is good idea when downloading or depsolving, but not when writing to the disk. The daemon shouldn't let you do anything stupid, so it's quite safe to call this method.

client :

a valid PkClient instance

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if we cancelled successfully

pk_client_download_packages ()

gboolean            pk_client_download_packages         (PkClient *client,
                                                         gchar **package_ids,
                                                         const gchar *directory,
                                                         GError **error);

client :

a valid PkClient instance

package_ids :

a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"

directory :

the location where packages are to be downloaded

error :

a GError to put the error code and message in, or NULL Get the packages that depend this one, i.e. child->parent. Return value: TRUE if the daemon queued the transaction

Returns :


pk_client_get_updates ()

gboolean            pk_client_get_updates               (PkClient *client,
                                                         PkBitfield filters,
                                                         GError **error);

Get a list of all the packages that can be updated for all repositories.

client :

a valid PkClient instance

filters :

a PkBitfield such as PK_FILTER_ENUM_GUI | PK_FILTER_ENUM_FREE or PK_FILTER_ENUM_NONE

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if we got told the daemon to get the update list

pk_client_update_system ()

gboolean            pk_client_update_system             (PkClient *client,
                                                         GError **error);

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_client_repo_disable() - pk_client_update_system() - pk_client_repo_enable()

client :

a valid PkClient instance

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if we told the daemon to update the system

pk_client_search_name ()

gboolean            pk_client_search_name               (PkClient *client,
                                                         PkBitfield filters,
                                                         const gchar *search,
                                                         GError **error);

Search all the locally installed files and remote repositories for a package that matches a specific name.

client :

a valid PkClient instance

filters :

a PkBitfield such as PK_FILTER_ENUM_GUI | PK_FILTER_ENUM_FREE or PK_FILTER_ENUM_NONE

search :

free text to search for, for instance, "power"

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_search_details ()

gboolean            pk_client_search_details            (PkClient *client,
                                                         PkBitfield filters,
                                                         const gchar *search,
                                                         GError **error);

Search all detailed summary information to try and find a keyword. Think of this as pk_client_search_name(), but trying much harder and taking longer.

client :

a valid PkClient instance

filters :

a PkBitfield such as PK_FILTER_ENUM_GUI | PK_FILTER_ENUM_FREE or PK_FILTER_ENUM_NONE

search :

free text to search for, for instance, "power"

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_search_group ()

gboolean            pk_client_search_group              (PkClient *client,
                                                         PkBitfield filters,
                                                         const gchar *search,
                                                         GError **error);

Return all packages in a specific group.

client :

a valid PkClient instance

filters :

a PkBitfield such as PK_FILTER_ENUM_GUI | PK_FILTER_ENUM_FREE or PK_FILTER_ENUM_NONE

search :

a group enum to search for, for instance, "system-tools"

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_search_file ()

gboolean            pk_client_search_file               (PkClient *client,
                                                         PkBitfield filters,
                                                         const gchar *search,
                                                         GError **error);

Search for packages that provide a specific file.

client :

a valid PkClient instance

filters :

a PkBitfield such as PK_FILTER_ENUM_GUI | PK_FILTER_ENUM_FREE or PK_FILTER_ENUM_NONE

search :

file to search for, for instance, "/sbin/service"

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_get_depends ()

gboolean            pk_client_get_depends               (PkClient *client,
                                                         PkBitfield filters,
                                                         gchar **package_ids,
                                                         gboolean recursive,
                                                         GError **error);

Get the packages that depend this one, i.e. child->parent.

client :

a valid PkClient instance

filters :

a PkBitfield such as PK_FILTER_ENUM_GUI | PK_FILTER_ENUM_FREE or PK_FILTER_ENUM_NONE

package_ids :

a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"

recursive :

If we should search recursively for depends

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_get_packages ()

gboolean            pk_client_get_packages              (PkClient *client,
                                                         PkBitfield filters,
                                                         GError **error);

Get the list of packages from the backend

client :

a valid PkClient instance

filters :

a PkBitfield such as PK_FILTER_ENUM_GUI | PK_FILTER_ENUM_FREE or PK_FILTER_ENUM_NONE

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_get_update_detail ()

gboolean            pk_client_get_update_detail         (PkClient *client,
                                                         gchar **package_ids,
                                                         GError **error);

Get details about the specific update, for instance any CVE urls and severity information.

client :

a valid PkClient instance

package_ids :

a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_get_requires ()

gboolean            pk_client_get_requires              (PkClient *client,
                                                         PkBitfield filters,
                                                         gchar **package_ids,
                                                         gboolean recursive,
                                                         GError **error);

Get the packages that require this one, i.e. parent->child.

client :

a valid PkClient instance

filters :

a PkBitfield such as PK_FILTER_ENUM_GUI | PK_FILTER_ENUM_FREE or PK_FILTER_ENUM_NONE

package_ids :

a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"

recursive :

If we should search recursively for requires

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_what_provides ()

gboolean            pk_client_what_provides             (PkClient *client,
                                                         PkBitfield filters,
                                                         PkProvidesEnum provides,
                                                         const gchar *search,
                                                         GError **error);

This should return packages that provide the supplied attributes. This method is useful for finding out what package(s) provide a modalias or GStreamer codec string.

client :

a valid PkClient instance

filters :

a PkBitfield such as PK_FILTER_ENUM_GUI | PK_FILTER_ENUM_FREE or PK_FILTER_ENUM_NONE

provides :

a PkProvidesEnum value such as PK_PROVIDES_ENUM_CODEC

search :

a search term such as "sound/mp3"

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_get_details ()

gboolean            pk_client_get_details               (PkClient *client,
                                                         gchar **package_ids,
                                                         GError **error);

Get details of a package, so more information can be obtained for GUI or command line tools.

client :

a valid PkClient instance

package_ids :

a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_get_distro_upgrades ()

gboolean            pk_client_get_distro_upgrades       (PkClient *client,
                                                         GError **error);

This method should return a list of distribution upgrades that are available. It should not return updates, only major upgrades.

client :

a valid PkClient instance

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_get_files ()

gboolean            pk_client_get_files                 (PkClient *client,
                                                         gchar **package_ids,
                                                         GError **error);

Get the file list (i.e. a list of files installed) for the specified package.

client :

a valid PkClient instance

package_ids :

a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_get_categories ()

gboolean            pk_client_get_categories            (PkClient *client,
                                                         GError **error);

Get a list of all categories supported

client :

a valid PkClient instance

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if we got told the daemon to get the category list

pk_client_remove_packages ()

gboolean            pk_client_remove_packages           (PkClient *client,
                                                         gchar **package_ids,
                                                         gboolean allow_deps,
                                                         gboolean autoremove,
                                                         GError **error);

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.

client :

a valid PkClient 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

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_refresh_cache ()

gboolean            pk_client_refresh_cache             (PkClient *client,
                                                         gboolean force,
                                                         GError **error);

Refresh the cache, i.e. download new metadata from a remote URL so that package lists are up to date. This action may take a few minutes and should be done when the session and system are idle.

client :

a valid PkClient instance

force :

if we shoudl aggressively drop caches

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_install_packages ()

gboolean            pk_client_install_packages          (PkClient *client,
                                                         gchar **package_ids,
                                                         GError **error);

Install a package of the newest and most correct version.

client :

a valid PkClient instance

package_ids :

a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_install_signature ()

gboolean            pk_client_install_signature         (PkClient *client,
                                                         PkSigTypeEnum type,
                                                         const gchar *key_id,
                                                         const gchar *package_id,
                                                         GError **error);

Install a signature of the newest and most correct version.

client :

a valid PkClient instance

type :

key_id :

package_id :

a signature_id structure such as "hal;0.0.1;i386;fedora"

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_update_packages ()

gboolean            pk_client_update_packages           (PkClient *client,
                                                         gchar **package_ids,
                                                         GError **error);

Update specific packages to the newest available versions.

client :

a valid PkClient instance

package_ids :

a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_install_files ()

gboolean            pk_client_install_files             (PkClient *client,
                                                         gboolean trusted,
                                                         gchar **files_rel,
                                                         GError **error);

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

client :

a valid PkClient instance

trusted :

if untrused actions should be allowed

files_rel :

a file such as "/home/hughsie/Desktop/hal-devel-0.10.0.rpm"

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_install_file ()

gboolean            pk_client_install_file              (PkClient *client,
                                                         gboolean trusted,
                                                         const gchar *file_rel,
                                                         GError **error);

client :

trusted :

file_rel :

error :

Returns :


pk_client_resolve ()

gboolean            pk_client_resolve                   (PkClient *client,
                                                         PkBitfield filters,
                                                         gchar **packages,
                                                         GError **error);

Resolve a package name into a package_id. This can return installed and available packages and allows you find out if a package is installed locally or is available in a repository.

client :

a valid PkClient instance

filters :

a PkBitfield such as PK_FILTER_ENUM_GUI | PK_FILTER_ENUM_FREE or PK_FILTER_ENUM_NONE

packages :

an array of package names to resolve, e.g. "gnome-system-tools"

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_rollback ()

gboolean            pk_client_rollback                  (PkClient *client,
                                                         const gchar *transaction_id,
                                                         GError **error);

Roll back to a previous transaction. I think only conary supports this right now, but it's useful to add an abstract way of doing it.

client :

a valid PkClient instance

transaction_id :

a transaction_id structure

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_requeue ()

gboolean            pk_client_requeue                   (PkClient *client,
                                                         GError **error);

We might need to requeue if we want to take an existing PkClient instance and re-run it after completion. Doing this allows us to do things like re-searching when the output list may have changed state.

client :

a valid PkClient instance

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if we could requeue the client

pk_client_accept_eula ()

gboolean            pk_client_accept_eula               (PkClient *client,
                                                         const gchar *eula_id,
                                                         GError **error);

We may want to agree to a EULA dialog if one is presented.

client :

a valid PkClient instance

eula_id :

the eula_id we are agreeing to

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_get_repo_list ()

gboolean            pk_client_get_repo_list             (PkClient *client,
                                                         PkBitfield filters,
                                                         GError **error);

Get the list of repositories installed on the system.

client :

a valid PkClient instance

filters :

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_repo_enable ()

gboolean            pk_client_repo_enable               (PkClient *client,
                                                         const gchar *repo_id,
                                                         gboolean enabled,
                                                         GError **error);

Enable or disable the repository.

client :

a valid PkClient instance

repo_id :

a repo_id structure such as "livna-devel"

enabled :

if we should enable the repository

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_repo_set_data ()

gboolean            pk_client_repo_set_data             (PkClient *client,
                                                         const gchar *repo_id,
                                                         const gchar *parameter,
                                                         const gchar *value,
                                                         GError **error);

We may want to set a repository parameter. NOTE: this is free text, and is left to the backend to define a format.

client :

a valid PkClient instance

repo_id :

a repo_id structure such as "livna-devel"

parameter :

the parameter to change

value :

what we should change it to

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon queued the transaction

pk_client_get_package_list ()

PkPackageList *     pk_client_get_package_list          (PkClient *client);

We do not provide access to the internal package list (as it could be being updated) so provide a way to get access to objects here.

client :

a valid PkClient instance

Returns :

The PkPackageList or NULL if not found or invalid

pk_client_get_require_restart ()

PkRestartEnum       pk_client_get_require_restart       (PkClient *client);

This method returns the 'worst' restart of all the transactions. It is needed as multiple sub-transactions may emit require-restart with different values, and we always want to get the most invasive of all.

For instance, if a transaction emits RequireRestart(system) and then RequireRestart(session) then pk_client_get_require_restart will return system as a session restart is implied with a system restart.

client :

a valid PkClient instance

Returns :

a PkRestartEnum value, e.g. PK_RESTART_ENUM_SYSTEM

pk_client_get_require_restart_list ()

const GPtrArray *   pk_client_get_require_restart_list  (PkClient *client);

This method allows a client program to discover what packages caused different require restarts.

client :

a valid PkClient instance

Returns :

a PkRestartEnum value, e.g. PK_RESTART_ENUM_SYSTEM

pk_client_get_cached_objects ()

PkObjList *         pk_client_get_cached_objects        (PkClient *client);

Return the cached object list

client :

a valid PkClient instance

Returns :

The GPtrArray of cached objects or NULL if invalid

pk_client_reset ()

gboolean            pk_client_reset                     (PkClient *client,
                                                         GError **error);

Resetting the client way be needed if we canceled the request without waiting for ::finished, or if we want to reuse the PkClient without unreffing and creating it again.

If you call pk_client_reset() on a running transaction, then it will be automatically cancelled. If the cancel fails, the reset will fail.

client :

a valid PkClient instance

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if we reset the client

pk_client_get_old_transactions ()

gboolean            pk_client_get_old_transactions      (PkClient *client,
                                                         guint number,
                                                         GError **error);

Get the old transaction list, mainly used for the rollback viewer.

client :

a valid PkClient instance

number :

the number of past transactions to return, or 0 for all

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon serviced the request

pk_client_is_caller_active ()

gboolean            pk_client_is_caller_active          (PkClient *client,
                                                         gboolean *is_active,
                                                         GError **error);

If the caller is no longer active, we may want to show a warning or message as a libnotify box as the application can't handle it internally any more.

client :

a valid PkClient instance

is_active :

if the caller of the method is still alive

error :

a GError to put the error code and message in, or NULL

Returns :

TRUE if the daemon serviced the request

Signal Details

The "allow-cancel" signal

void                user_function                      (PkClient *client,
                                                        gboolean  allow_cancel,
                                                        gpointer  user_data)         : Run Last

The ::allow-cancel signal is emitted when the transaction cancellable value changes.

You probably want to enable and disable cancel buttons according to this value.

client :

the PkClient instance that emitted the signal

allow_cancel :

If cancel would succeed

user_data :

user data set when the signal handler was connected.

The "caller-active-changed" signal

void                user_function                      (PkClient *client,
                                                        gboolean  is_active,
                                                        gpointer  user_data)      : Run Last

The ::caller-active-changed signal is emitted when the client that issued the dbus method is exited.

client :

the PkClient instance that emitted the signal

is_active :

if the caller is still active

user_data :

user data set when the signal handler was connected.

The "category" signal

void                user_function                      (PkClient *client,
                                                        gpointer  obj,
                                                        gpointer  user_data)      : Run Last

The ::category signal is emitted when GetCategories() is called.

client :

the PkClient instance that emitted the signal

obj :

a pointer to a PkCategoryObj structure describing the category

user_data :

user data set when the signal handler was connected.

The "destroy" signal

void                user_function                      (PkClient *client,
                                                        gpointer  user_data)      : Run Last

The ::destroy signal is emitted when the transaction has been destroyed and is no longer available for use.

client :

the PkClient instance that emitted the signal

user_data :

user data set when the signal handler was connected.

The "details" signal

void                user_function                      (PkClient *client,
                                                        gpointer  obj,
                                                        gpointer  user_data)      : Run Last

The ::details signal is emitted when GetDetails() is called.

client :

the PkClient instance that emitted the signal

obj :

a pointer to a PkDetailObj structure describing the package in detail

user_data :

user data set when the signal handler was connected.

The "distro-upgrade" signal

void                user_function                      (PkClient *pkclient,
                                                        gpointer  arg1,
                                                        gpointer  user_data)      : Run Last

pkclient :

the object which received the signal.

arg1 :

user_data :

user data set when the signal handler was connected.

The "error-code" signal

void                user_function                      (PkClient *tlist,
                                                        guint     client,
                                                        gchar    *code,
                                                        gpointer  user_data)      : Run Last

The ::error-code signal is emitted when the transaction wants to convey an error in the transaction.

This can only happen once in a transaction.

tlist :

the PkTaskList instance that emitted the signal

client :

the PkClient instance that caused the signal

code :

the PkErrorCodeEnum of the error, e.g. PK_ERROR_ENUM_DEP_RESOLUTION_FAILED

details :

the non-locaised details about the error

user_data :

user data set when the signal handler was connected.

The "eula-required" signal

void                user_function                      (PkClient *client,
                                                        gchar    *eula_id,
                                                        gchar    *package_id,
                                                        gchar    *vendor_name,
                                                        gchar    *license_agreement,
                                                        gpointer  user_data)              : Run Last

The ::eula signal is emitted when the transaction needs to fail for a EULA prompt.

client :

the PkClient instance that emitted the signal

eula_id :

the EULA id, e.g. vmware5_single_user

package_id :

the package_id of the package

vendor_name :

the Vendor name, e.g. Acme Corp.

license_agreement :

the text of the license agreement

user_data :

user data set when the signal handler was connected.

The "files" signal

void                user_function                      (PkClient *package_id,
                                                        gchar    *files,
                                                        gchar    *arg2,
                                                        gpointer  user_data)       : Run Last

The ::files signal is emitted when the method GetFiles() is used.

package_id :

the package_id of the package

files :

the list of files owned by the package, delimited by ';'

user_data :

user data set when the signal handler was connected.

The "finished" signal

void                user_function                      (PkClient *client,
                                                        guint     exit,
                                                        guint     runtime,
                                                        gpointer  user_data)      : Run Last

The ::finished signal is emitted when the transaction is complete.

client :

the PkClient instance that emitted the signal

exit :

the PkExitEnum status value, e.g. PK_EXIT_ENUM_SUCCESS

runtime :

the time in seconds the transaction has been running

user_data :

user data set when the signal handler was connected.

The "media-change-required" signal

void                user_function                      (PkClient *client,
                                                        guint     media_type,
                                                        gchar    *media_id,
                                                        gchar    *media_text,
                                                        gpointer  user_data)       : Run Last

The ::media-change-required signal is emitted when the transaction needs a different media to grab the packages.

This can only happen once in a transaction.

client :

the PkClient instance that emitted the signal

media_type :

the PkMediaTypeEnum of the error, e.g. PK_MEDIA_TYPE_ENUM_DVD

media_id :

the non-localised label of the media

media_text :

the non-localised text describing the media

user_data :

user data set when the signal handler was connected.

The "message" signal

void                user_function                      (PkClient *client,
                                                        guint     message,
                                                        gchar    *details,
                                                        gpointer  user_data)      : Run Last

The ::message signal is emitted when the transaction wants to tell the user something.

client :

the PkClient instance that emitted the signal

message :

the PkMessageEnum type of the message, e.g. PK_MESSAGE_ENUM_BROKEN_MIRROR

details :

the non-localised message details

user_data :

user data set when the signal handler was connected.

The "package" signal

void                user_function                      (PkClient *client,
                                                        gpointer  obj,
                                                        gpointer  user_data)      : Run Last

The ::package signal is emitted when the update list may have changed and the client program may have to update some UI.

client :

the PkClient instance that emitted the signal

obj :

a pointer to a PkPackageObj structure describing the package

user_data :

user data set when the signal handler was connected.

The "progress-changed" signal

void                user_function                      (PkClient *client,
                                                        guint     percentage,
                                                        guint     subpercentage,
                                                        guint     elapsed,
                                                        guint     client,
                                                        gpointer  user_data)          : Run Last

The ::progress-changed signal is emitted when the update list may have changed and the client program may have to update some UI.

client :

the PkClient instance that emitted the signal

percentage :

the percentage of the transaction

subpercentage :

the percentage of the sub-transaction

elapsed :

the elapsed time in seconds of the transaction

client :

the remaining time in seconds of the transaction

user_data :

user data set when the signal handler was connected.

The "repo-detail" signal

void                user_function                      (PkClient *client,
                                                        gchar    *repo_id,
                                                        gchar    *description,
                                                        gboolean  enabled,
                                                        gpointer  user_data)        : Run Last

The ::repo-detail signal is emitted when the method GetRepos() is called.

client :

the PkClient instance that emitted the signal

repo_id :

the ID of the repository

description :

the description of the repository

enabled :

if the repository is enabled

user_data :

user data set when the signal handler was connected.

The "repo-signature-required" signal

void                user_function                      (PkClient *client,
                                                        gchar    *package_id,
                                                        gchar    *repository_name,
                                                        gchar    *key_url,
                                                        gchar    *key_userid,
                                                        gchar    *key_id,
                                                        gchar    *key_fingerprint,
                                                        gchar    *key_timestamp,
                                                        guint     type,
                                                        gpointer  user_data)            : Run Last

The ::repo-signature-required signal is emitted when the transaction needs to fail for a signature prompt.

client :

the PkClient instance that emitted the signal

package_id :

the package_id of the package

repository_name :

the name of the repository

key_url :

the URL of the repository

key_userid :

the user signing the repository

key_id :

the id of the repository

key_fingerprint :

the fingerprint of the repository

key_timestamp :

the timestamp of the repository

type :

the PkSigTypeEnum of the repository, e.g. PK_SIGTYPE_ENUM_GPG

user_data :

user data set when the signal handler was connected.

The "require-restart" signal

void                user_function                      (PkClient *client,
                                                        guint     restart,
                                                        gpointer  details,
                                                        gpointer  user_data)      : Run Last

The ::require-restart signal is emitted when the transaction requires a application or session restart.

client :

the PkClient instance that emitted the signal

restart :

the PkRestartEnum type of restart, e.g. PK_RESTART_ENUM_SYSTEM

details :

the optional details about the restart, why this is needed

user_data :

user data set when the signal handler was connected.

The "status-changed" signal

void                user_function                      (PkClient *client,
                                                        guint     status,
                                                        gpointer  user_data)      : Run Last

The ::status-changed signal is emitted when the transaction status has changed.

client :

the PkClient instance that emitted the signal

status :

the PkStatusEnum type, e.g. PK_STATUS_ENUM_REMOVE

user_data :

user data set when the signal handler was connected.

The "transaction" signal

void                user_function                      (PkClient *client,
                                                        gpointer  obj,
                                                        gpointer  user_data)      : Run Last

The ::transaction is emitted when the method GetOldTransactions() is called, and the values are being replayed from a database.

client :

the PkClient instance that emitted the signal

obj :

a pointer to a PkTransactionObj structure describing the transaction

user_data :

user data set when the signal handler was connected.

The "update-detail" signal

void                user_function                      (PkClient *client,
                                                        gpointer  obj,
                                                        gpointer  user_data)      : Run Last

The ::update-detail signal is emitted when GetUpdateDetail() is called on a set of package_id's.

client :

the PkClient instance that emitted the signal

obj :

a pointer to a PkUpdateDetailsObj structure describing the update

user_data :

user data set when the signal handler was connected.