PkControl: PackageKit Reference Manual

## PkControl PkControl — For querying data about PackageKit |

## Functions

GQuark | pk_control_error_quark ()
PkControl * | pk_control_new ()
void | pk_control_get_tid_async ()
gchar * | pk_control_get_tid_finish ()
gboolean | pk_control_suggest_daemon_quit ()
void | pk_control_suggest_daemon_quit_async ()
gboolean | pk_control_suggest_daemon_quit_finish ()
void | pk_control_get_daemon_state_async ()
gchar * | pk_control_get_daemon_state_finish ()
gboolean | pk_control_set_proxy ()
void | pk_control_set_proxy_async ()
gboolean | pk_control_set_proxy_finish ()
gboolean | pk_control_set_proxy2 ()
void | pk_control_set_proxy2_async ()
void | pk_control_get_time_since_action_async ()
guint | pk_control_get_time_since_action_finish ()
gchar ** | pk_control_get_transaction_list ()
void | pk_control_get_transaction_list_async ()
gchar ** | pk_control_get_transaction_list_finish ()
void | pk_control_can_authorize_async ()
PkAuthorizeEnum | pk_control_can_authorize_finish ()
gboolean | pk_control_get_properties ()
void | pk_control_get_properties_async ()
gboolean | pk_control_get_properties_finish ()

## Types and Values

#define | PK_CONTROL_ERROR
#define | PK_CONTROL_TYPE_ERROR
enum | PkControlError

## Description

A GObject to use for accessing PackageKit asynchronously.

## Functions

### pk_control_error_quark ()

    GQuark
    pk_control_error_quark (void);

We are a GObject that sets errors

#### Returns

Our personal error quark.

Since: 0.5.2

### pk_control_new ()

    PkControl *
    pk_control_new (void);

#### Returns

a new PkControl object.

Since: 0.5.2

### 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.

#### Parameters

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` |

Since: 0.5.2

### pk_control_get_tid_finish ()

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

Gets the result from the asynchronous function.

#### Parameters

control | a valid PkControl instance |
res | the GAsyncResult |
error | A GError or `NULL` |

#### Returns

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

Since: 0.5.2

### pk_control_suggest_daemon_quit ()

    gboolean
    pk_control_suggest_daemon_quit (PkControl *control,
                                    GCancellable *cancellable,
                                    GError **error);

Suggests to the daemon that it should quit as soon as possible. Warning: this function is synchronous, and may block. Do not use it in GUI applications.

#### Parameters

control | a valid PkControl instance |
cancellable | a GCancellable or `NULL` |
error | A GError or `NULL` |

#### Returns

`TRUE` if the suggestion was sent

Since: 0.6.2

### pk_control_suggest_daemon_quit_async ()

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

Suggests to the daemon that it should quit as soon as possible.

#### Parameters

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` |

Since: 0.6.2

### pk_control_suggest_daemon_quit_finish ()

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

Gets the result from the asynchronous function.

#### Parameters

control | a valid PkControl instance |
res | the GAsyncResult |
error | A GError or `NULL` |

#### Returns

`TRUE` if the suggestion was sent

Since: 0.6.2

### 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.

#### Parameters

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` |

Since: 0.5.2

### 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.

#### Parameters

control | a valid PkControl instance |
res | the GAsyncResult |
error | A GError or `NULL` |

#### Returns

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

Since: 0.5.2

### pk_control_set_proxy ()

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

Sets the network proxy to use in the daemon. Warning: this function is synchronous, and may block. Do not use it in GUI applications.

#### Parameters

control | a valid PkControl instance |
proxy_http | the HTTP proxy server |
proxy_ftp | the FTP proxy server |
cancellable | a GCancellable or `NULL` |
error | A GError or `NULL` |

#### Returns

`TRUE` if the proxy was set correctly

NOTE: This is just provided for backwards compatibility. Clients should really be using `pk_control_set_proxy2()`.

Since: 0.6.3

### 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

NOTE: This is just provided for backwards compatibility. Clients should really be using `pk_control_set_proxy2_async()`.

#### Parameters

control | a valid PkControl instance |
proxy_http | a HTTP proxy string such as "username:password`server.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` |

Since: 0.5.2

### pk_control_set_proxy_finish ()

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

Gets the result from the asynchronous function.

#### Parameters

control | a valid PkControl instance |
res | the GAsyncResult |
error | A GError or `NULL` |

#### Returns

`TRUE` if we set the proxy successfully

Since: 0.5.2

### pk_control_set_proxy2 ()

    gboolean
    pk_control_set_proxy2 (PkControl *control,
                           const gchar *proxy_http,
                           const gchar *proxy_https,
                           const gchar *proxy_ftp,
                           const gchar *proxy_socks,
                           const gchar *no_proxy,
                           const gchar *pac,
                           GCancellable *cancellable,
                           GError **error);

Sets the network proxy to use in the daemon. Warning: this function is synchronous, and may block. Do not use it in GUI applications.

#### Parameters

control | a valid PkControl instance |
proxy_http | the HTTP proxy server |
proxy_https | the HTTPS proxy server |
proxy_ftp | the FTP proxy server |
proxy_socks | the SOCKS proxy server |
no_proxy | the list of download IPs that shouldn't go through the proxy |
pac | the PAC string |
cancellable | a GCancellable or `NULL` |
error | A GError or `NULL` |

#### Returns

`TRUE` if the proxy was set correctly

Since: 0.6.13

### pk_control_set_proxy2_async ()

    void
    pk_control_set_proxy2_async (PkControl *control,
                                 const gchar *proxy_http,
                                 const gchar *proxy_https,
                                 const gchar *proxy_ftp,
                                 const gchar *proxy_socks,
                                 const gchar *no_proxy,
                                 const gchar *pac,
                                 GCancellable *cancellable,
                                 GAsyncReadyCallback callback,
                                 gpointer user_data);

Set a proxy on the PK daemon

#### Parameters

control | a valid PkControl instance |
proxy_http | a HTTP proxy string such as "username:password`server.lan` :8080", or `NULL` |
proxy_https | a HTTPS proxy string such as "username:password`server.lan` :8080", or `NULL` |
proxy_ftp | a FTP proxy string such as "server.lan:8080", or `NULL` |
proxy_socks | a SOCKS proxy string such as "server.lan:8080", or `NULL` |
no_proxy | a list of download IPs that shouldn't go through the proxy, or `NULL` |
pac | a PAC string, or `NULL` |
cancellable | a GCancellable or `NULL` |
callback | the function to run on completion |
user_data | the data to pass to `callback` |

Since: 0.6.13

### 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.

#### Parameters

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` |

Since: 0.5.2

### 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.

#### Parameters

control | a valid PkControl instance |
res | the GAsyncResult |
error | A GError or `NULL` |

#### Returns

`TRUE` if the daemon serviced the request

Since: 0.5.2

### pk_control_get_transaction_list ()

    gchar **
    pk_control_get_transaction_list (PkControl *control,
                                     GCancellable *cancellable,
                                     GError **error);

Gets the transaction list in progress. Warning: this function is synchronous, and may block. Do not use it in GUI applications.

#### Parameters

control | a valid PkControl instance |
cancellable | a GCancellable or `NULL` |
error | A GError or `NULL` |

#### Returns

The list of transaction id's, or `NULL`, free with `g_strfreev()`.

[transfer full]

Since: 0.5.3

### 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.

#### Parameters

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` |

Since: 0.5.2

### 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.

#### Parameters

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()`.

[transfer full]

Since: 0.5.2

### 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.

#### Parameters

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` |

Since: 0.5.2

### pk_control_can_authorize_finish ()

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

Gets the result from the asynchronous function.

#### Parameters

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

Since: 0.5.2

### pk_control_get_properties ()

    gboolean
    pk_control_get_properties (PkControl *control,
                               GCancellable *cancellable,
                               GError **error);

Gets the properties the daemon supports. Warning: this function is synchronous, and may block. Do not use it in GUI applications.

#### Parameters

control | a valid PkControl instance |
cancellable | a GCancellable or `NULL` |
error | A GError or `NULL` |

#### Returns

`TRUE` if the properties were set correctly

Since: 0.5.3

### 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.

#### Parameters

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` |

Since: 0.5.2

### pk_control_get_properties_finish ()

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

Gets the result from the asynchronous function.

#### Parameters

control | a valid PkControl instance |
res | the GAsyncResult |
error | A GError or `NULL` |

#### Returns

`TRUE` if we set the proxy successfully

Since: 0.5.2

## Types and Values

### 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 ())

### enum PkControlError

Errors that can be thrown

#### Members

PK_CONTROL_ERROR_FAILED | the transaction failed for an unknown reason |
PK_CONTROL_ERROR_CANNOT_START_DAEMON | the PackageKit daemon failed to start |