PkControl

PkControl — For querying data about PackageKit

Synopsis

#define             PK_CONTROL_ERROR
#define             PK_CONTROL_TYPE_ERROR
                    PkControlPrivate;
enum                PkControlError;
                    PkControl;
GQuark              pk_control_error_quark              (void);
PkControl *         pk_control_new                      (void);
void                pk_control_test                     (gpointer user_data);
void                pk_control_get_tid_async            (PkControl *control,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
gchar *             pk_control_get_tid_finish           (PkControl *control,
                                                         GAsyncResult *res,
                                                         GError **error);
void                pk_control_get_daemon_state_async   (PkControl *control,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
gchar *             pk_control_get_daemon_state_finish  (PkControl *control,
                                                         GAsyncResult *res,
                                                         GError **error);
void                pk_control_set_proxy_async          (PkControl *control,
                                                         const gchar *proxy_http,
                                                         const gchar *proxy_ftp,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
gboolean            pk_control_set_proxy_finish         (PkControl *control,
                                                         GAsyncResult *res,
                                                         GError **error);
void                pk_control_get_network_state_async  (PkControl *control,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
PkNetworkEnum       pk_control_get_network_state_finish (PkControl *control,
                                                         GAsyncResult *res,
                                                         GError **error);
void                pk_control_get_time_since_action_async
                                                        (PkControl *control,
                                                         PkRoleEnum role,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
guint               pk_control_get_time_since_action_finish
                                                        (PkControl *control,
                                                         GAsyncResult *res,
                                                         GError **error);
void                pk_control_get_transaction_list_async
                                                        (PkControl *control,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
gchar **            pk_control_get_transaction_list_finish
                                                        (PkControl *control,
                                                         GAsyncResult *res,
                                                         GError **error);
void                pk_control_can_authorize_async      (PkControl *control,
                                                         const gchar *action_id,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
PkAuthorizeEnum     pk_control_can_authorize_finish     (PkControl *control,
                                                         GAsyncResult *res,
                                                         GError **error);
void                pk_control_get_properties_async     (PkControl *control,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
gboolean            pk_control_get_properties_finish    (PkControl *control,
                                                         GAsyncResult *res,
                                                         GError **error);

Object Hierarchy

  GObject
   +----PkControl

Properties

  "backend-author"           gchar*                : Read / Write
  "backend-description"      gchar*                : Read / Write
  "backend-name"             gchar*                : Read / Write
  "connected"                gboolean              : Read / Write
  "distro-id"                gchar*                : Read / Write
  "filters"                  guint64               : Read / Write
  "groups"                   guint64               : Read / Write
  "locked"                   gboolean              : Read / Write
  "mime-types"               gchar*                : Read / Write
  "network-state"            guint                 : Read / Write
  "roles"                    guint64               : Read / Write
  "version-major"            guint                 : Read
  "version-micro"            guint                 : Read
  "version-minor"            guint                 : Read

Signals

  "repo-list-changed"                              : Run Last
  "restart-schedule"                               : Run Last
  "transaction-list-changed"                       : Run Last
  "updates-changed"                                : Run Last

Description

A GObject to use for accessing PackageKit asynchronously.

Details

PK_CONTROL_ERROR

#define PK_CONTROL_ERROR (pk_control_error_quark ())


PK_CONTROL_TYPE_ERROR

#define PK_CONTROL_TYPE_ERROR (pk_control_error_get_type ())


PkControlPrivate

typedef struct _PkControlPrivate PkControlPrivate;

Private PkControl data


enum PkControlError

typedef enum
{
	PK_CONTROL_ERROR_FAILED,
	PK_CONTROL_ERROR_CANNOT_START_DAEMON
} PkControlError;

Errors that can be thrown

PK_CONTROL_ERROR_FAILED

the transaction failed for an unknown reason

PK_CONTROL_ERROR_CANNOT_START_DAEMON


PkControl

typedef struct _PkControl PkControl;


pk_control_error_quark ()

GQuark              pk_control_error_quark              (void);

We are a GObject that sets errors

Returns :

Our personal error quark.

pk_control_new ()

PkControl *         pk_control_new                      (void);

Returns :

a new PkControl object.

pk_control_test ()

void                pk_control_test                     (gpointer user_data);

user_data :


pk_control_get_tid_async ()

void                pk_control_get_tid_async            (PkControl *control,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

Gets a transacton ID from the daemon.

control :

a valid PkControl instance

cancellable :

a GCancellable or NULL

callback :

the function to run on completion

user_data :

the data to pass to callback

pk_control_get_tid_finish ()

gchar *             pk_control_get_tid_finish           (PkControl *control,
                                                         GAsyncResult *res,
                                                         GError **error);

Gets the result from the asynchronous function.

control :

a valid PkControl instance

res :

the GAsyncResult

error :

A GError or NULL

Returns :

the ID, or NULL if unset, free with g_free()

pk_control_get_daemon_state_async ()

void                pk_control_get_daemon_state_async   (PkControl *control,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

Gets the debugging state from the daemon.

control :

a valid PkControl instance

cancellable :

a GCancellable or NULL

callback :

the function to run on completion

user_data :

the data to pass to callback

pk_control_get_daemon_state_finish ()

gchar *             pk_control_get_daemon_state_finish  (PkControl *control,
                                                         GAsyncResult *res,
                                                         GError **error);

Gets the result from the asynchronous function.

control :

a valid PkControl instance

res :

the GAsyncResult

error :

A GError or NULL

Returns :

the ID, or NULL if unset, free with g_free()

pk_control_set_proxy_async ()

void                pk_control_set_proxy_async          (PkControl *control,
                                                         const gchar *proxy_http,
                                                         const gchar *proxy_ftp,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

Set a proxy on the PK daemon

control :

a valid PkControl instance

proxy_http :

a HTTP proxy string such as "username:passwordserver.lan:8080"

proxy_ftp :

a FTP proxy string such as "server.lan:8080"

cancellable :

a GCancellable or NULL

callback :

the function to run on completion

user_data :

the data to pass to callback

pk_control_set_proxy_finish ()

gboolean            pk_control_set_proxy_finish         (PkControl *control,
                                                         GAsyncResult *res,
                                                         GError **error);

Gets the result from the asynchronous function.

control :

a valid PkControl instance

res :

the GAsyncResult

error :

A GError or NULL

Returns :

TRUE if we set the proxy successfully

pk_control_get_network_state_async ()

void                pk_control_get_network_state_async  (PkControl *control,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

Gets the network state.

control :

a valid PkControl instance

cancellable :

a GCancellable or NULL

callback :

the function to run on completion

user_data :

the data to pass to callback

pk_control_get_network_state_finish ()

PkNetworkEnum       pk_control_get_network_state_finish (PkControl *control,
                                                         GAsyncResult *res,
                                                         GError **error);

Gets the result from the asynchronous function.

control :

a valid PkControl instance

res :

the GAsyncResult

error :

A GError or NULL

Returns :

an enumerated network state

pk_control_get_time_since_action_async ()

void                pk_control_get_time_since_action_async
                                                        (PkControl *control,
                                                         PkRoleEnum role,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

We may want to know how long it has been since we refreshed the cache or retrieved the update list.

control :

a valid PkControl instance

role :

the role enum, e.g. PK_ROLE_ENUM_GET_UPDATES

cancellable :

a GCancellable or NULL

callback :

the function to run on completion

user_data :

the data to pass to callback

pk_control_get_time_since_action_finish ()

guint               pk_control_get_time_since_action_finish
                                                        (PkControl *control,
                                                         GAsyncResult *res,
                                                         GError **error);

Gets the result from the asynchronous function.

control :

a valid PkControl instance

res :

the GAsyncResult

error :

A GError or NULL

Returns :

TRUE if the daemon serviced the request

pk_control_get_transaction_list_async ()

void                pk_control_get_transaction_list_async
                                                        (PkControl *control,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

Gets the transactions currently running in the daemon.

control :

a valid PkControl instance

cancellable :

a GCancellable or NULL

callback :

the function to run on completion

user_data :

the data to pass to callback

pk_control_get_transaction_list_finish ()

gchar **            pk_control_get_transaction_list_finish
                                                        (PkControl *control,
                                                         GAsyncResult *res,
                                                         GError **error);

Gets the result from the asynchronous function.

control :

a valid PkControl instance

res :

the GAsyncResult

error :

A GError or NULL

Returns :

A GStrv list of transaction ID's, free with g_strfreev()

pk_control_can_authorize_async ()

void                pk_control_can_authorize_async      (PkControl *control,
                                                         const gchar *action_id,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

We may want to know before we run a method if we are going to be denied, accepted or challenged for authentication.

control :

a valid PkControl instance

action_id :

The action ID, for instance "org.freedesktop.PackageKit.install-untrusted"

cancellable :

a GCancellable or NULL

callback :

the function to run on completion

user_data :

the data to pass to callback

pk_control_can_authorize_finish ()

PkAuthorizeEnum     pk_control_can_authorize_finish     (PkControl *control,
                                                         GAsyncResult *res,
                                                         GError **error);

Gets the result from the asynchronous function.

control :

a valid PkControl instance

res :

the GAsyncResult

error :

A GError or NULL

Returns :

the PkAuthorizeEnum or PK_AUTHORIZE_ENUM_UNKNOWN if the method failed

pk_control_get_properties_async ()

void                pk_control_get_properties_async     (PkControl *control,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

Gets global properties from the daemon.

control :

a valid PkControl instance

cancellable :

a GCancellable or NULL

callback :

the function to run on completion

user_data :

the data to pass to callback

pk_control_get_properties_finish ()

gboolean            pk_control_get_properties_finish    (PkControl *control,
                                                         GAsyncResult *res,
                                                         GError **error);

Gets the result from the asynchronous function.

control :

a valid PkControl instance

res :

the GAsyncResult

error :

A GError or NULL

Returns :

TRUE if we set the proxy successfully

Property Details

The "backend-author" property

  "backend-author"           gchar*                : Read / Write

Default value: NULL


The "backend-description" property

  "backend-description"      gchar*                : Read / Write

Default value: NULL


The "backend-name" property

  "backend-name"             gchar*                : Read / Write

Default value: NULL


The "connected" property

  "connected"                gboolean              : Read / Write

Default value: FALSE


The "distro-id" property

  "distro-id"                gchar*                : Read / Write

Default value: NULL


The "filters" property

  "filters"                  guint64               : Read / Write

Default value: 0


The "groups" property

  "groups"                   guint64               : Read / Write

Default value: 0


The "locked" property

  "locked"                   gboolean              : Read / Write

Default value: FALSE


The "mime-types" property

  "mime-types"               gchar*                : Read / Write

Default value: NULL


The "network-state" property

  "network-state"            guint                 : Read / Write

Default value: 6


The "roles" property

  "roles"                    guint64               : Read / Write

Default value: 0


The "version-major" property

  "version-major"            guint                 : Read

Default value: 0


The "version-micro" property

  "version-micro"            guint                 : Read

Default value: 0


The "version-minor" property

  "version-minor"            guint                 : Read

Default value: 0

Signal Details

The "repo-list-changed" signal

void                user_function                      (PkControl *control,
                                                        gpointer   user_data)      : Run Last

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

control :

the PkControl instance that emitted the signal

user_data :

user data set when the signal handler was connected.

The "restart-schedule" signal

void                user_function                      (PkControl *control,
                                                        gpointer   user_data)      : Run Last

The ::restart_schedule signal is emitted when the packagekitd service has been restarted because it has been upgraded. Client programs should reload themselves when it is convenient to do so, as old client tools may not be compatable with the new daemon.

control :

the PkControl instance that emitted the signal

user_data :

user data set when the signal handler was connected.

The "transaction-list-changed" signal

void                user_function                      (PkControl *control,
                                                        GStrv     *arg1,
                                                        gpointer   user_data)      : Run Last

The ::transaction-list-changed signal is emitted when the list of transactions handled by the daemon is changed.

control :

the PkControl instance that emitted the signal

user_data :

user data set when the signal handler was connected.

The "updates-changed" signal

void                user_function                      (PkControl *control,
                                                        gpointer   user_data)      : Run Last

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

control :

the PkControl instance that emitted the signal

user_data :

user data set when the signal handler was connected.