PkControl

PkControl — An abstract control access GObject

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);
gboolean            pk_control_allocate_transaction_id  (PkControl *control,
                                                         gchar **tid,
                                                         GError **error);
gboolean            pk_control_set_proxy                (PkControl *control,
                                                         const gchar *proxy_http,
                                                         const gchar *proxy_ftp,
                                                         GError **error);
PkBitfield          pk_control_get_actions              (PkControl *control,
                                                         GError **error);
PkBitfield          pk_control_get_filters              (PkControl *control,
                                                         GError **error);
PkBitfield          pk_control_get_groups               (PkControl *control,
                                                         GError **error);
gchar**             pk_control_get_mime_types           (PkControl *control,
                                                         GError **error);
PkNetworkEnum       pk_control_get_network_state        (PkControl *control,
                                                         GError **error);
gboolean            pk_control_get_backend_detail       (PkControl *control,
                                                         gchar **name,
                                                         gchar **author,
                                                         GError **error);
gboolean            pk_control_get_time_since_action    (PkControl *control,
                                                         PkRoleEnum role,
                                                         guint *seconds,
                                                         GError **error);
gboolean            pk_control_transaction_list_print   (PkControl *control);
const gchar**       pk_control_transaction_list_get     (PkControl *control);

Object Hierarchy

  GObject
   +----PkControl

Signals

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

Description

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 clever GObject that sets errors

Returns :

Our personal error quark.

pk_control_new ()

PkControl*          pk_control_new                      (void);

Returns :

a new PkControl object.

pk_control_allocate_transaction_id ()

gboolean            pk_control_allocate_transaction_id  (PkControl *control,
                                                         gchar **tid,
                                                         GError **error);

We have to create a transaction ID then use it, as a one-step constructor is inherently racey.

control :

a valid PkControl instance

tid :

error :

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

Returns :

TRUE if we allocated a TID.

pk_control_set_proxy ()

gboolean            pk_control_set_proxy                (PkControl *control,
                                                         const gchar *proxy_http,
                                                         const gchar *proxy_ftp,
                                                         GError **error);

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"

error :

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

Returns :

if we set the proxy successfully

pk_control_get_actions ()

PkBitfield          pk_control_get_actions              (PkControl *control,
                                                         GError **error);

Actions are roles that the daemon can do with the current backend

control :

a valid PkControl instance

error :

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

Returns :

an enumerated list of the actions the backend supports

pk_control_get_filters ()

PkBitfield          pk_control_get_filters              (PkControl *control,
                                                         GError **error);

Filters are how the backend can specify what type of package is returned.

control :

a valid PkControl instance

error :

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

Returns :

an enumerated list of the filters the backend supports

pk_control_get_groups ()

PkBitfield          pk_control_get_groups               (PkControl *control,
                                                         GError **error);

The group list is enumerated so it can be localised and have deep integration with desktops. This method allows a frontend to only display the groups that are supported.

control :

a valid PkControl instance

error :

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

Returns :

an enumerated list of the groups the backend supports

pk_control_get_mime_types ()

gchar**             pk_control_get_mime_types           (PkControl *control,
                                                         GError **error);

The MIME list is the supported package formats.

control :

a valid PkControl instance

error :

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

Returns :

an strv list of the formats the backend supports, or NULL if unknown

pk_control_get_network_state ()

PkNetworkEnum       pk_control_get_network_state        (PkControl *control,
                                                         GError **error);

control :

a valid PkControl instance

error :

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

Returns :

an enumerated network state

pk_control_get_backend_detail ()

gboolean            pk_control_get_backend_detail       (PkControl *control,
                                                         gchar **name,
                                                         gchar **author,
                                                         GError **error);

The backend detail is useful for the pk-backend-status program, or for automatic bugreports.

control :

a valid PkControl instance

name :

the name of the backend

author :

the author of the backend

error :

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

Returns :

TRUE if the daemon serviced the request

pk_control_get_time_since_action ()

gboolean            pk_control_get_time_since_action    (PkControl *control,
                                                         PkRoleEnum role,
                                                         guint *seconds,
                                                         GError **error);

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 we are querying

seconds :

the number of seconds since the request was completed

error :

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

Returns :

TRUE if the daemon serviced the request

pk_control_transaction_list_print ()

gboolean            pk_control_transaction_list_print   (PkControl *control);

control :

Returns :


pk_control_transaction_list_get ()

const gchar**       pk_control_transaction_list_get     (PkControl *control);

control :

Returns :

Signal Details

The "locked" signal

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

The ::locked signal is emitted when the backend instance has been locked by PackageKit. This may mean that other native package tools will not work.

control :

the PkControl instance that emitted the signal

user_data :

user data set when the signal handler was connected.

The "network-state-changed" signal

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

The ::network-state-changed signal is emitted when the network has changed speed or connections state.

control :

the PkControl instance that emitted the signal

user_data :

user data set when the signal handler was connected.

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 *pkcontrol,
                                                        gpointer   user_data)      : Run Last

pkcontrol :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

The "transaction-list-changed" signal

void                user_function                      (PkControl *control,
                                                        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.