## Offline Updates

Offline Updates — Function to perform offline updates

## Functions

GQuark | pk_offline_error_quark ()
const gchar * | pk_offline_action_to_string ()
PkOfflineAction | pk_offline_action_from_string ()
PkOfflineAction | pk_offline_get_action ()
gchar ** | pk_offline_get_prepared_ids ()
gchar * | pk_offline_get_prepared_upgrade_name ()
gchar * | pk_offline_get_prepared_upgrade_version ()
PkPackageSack * | pk_offline_get_prepared_sack ()
GFileMonitor * | pk_offline_get_prepared_monitor ()
GFileMonitor * | pk_offline_get_prepared_upgrade_monitor ()
GFileMonitor * | pk_offline_get_action_monitor ()
PkResults * | pk_offline_get_results ()
guint64 | pk_offline_get_results_mtime ()
gboolean | pk_offline_cancel ()
gboolean | pk_offline_cancel_with_flags ()
gboolean | pk_offline_clear_results ()
gboolean | pk_offline_clear_results_with_flags ()
gboolean | pk_offline_trigger ()
gboolean | pk_offline_trigger_with_flags ()
gboolean | pk_offline_trigger_upgrade ()
gboolean | pk_offline_trigger_upgrade_with_flags ()

## Types and Values

#define | PK_OFFLINE_ERROR
enum | PkOfflineAction
enum | PkOfflineError

## Description

Functions for perform offline updates.

## Functions

### pk_offline_error_quark ()

    GQuark
    pk_offline_error_quark (void);

An error quark for PkOfflineError.

#### Returns

an error quark.

Since: 0.9.6

### pk_offline_action_to_string ()

    const gchar *
    pk_offline_action_to_string (PkOfflineAction action);

Converts the enumerated value to a string.

#### Parameters

action | a PkOfflineAction, e.g. `PK_OFFLINE_ACTION_REBOOT` |

#### Returns

string value, or `NULL` for invalid

Since: 0.9.6

### pk_offline_action_from_string ()

    PkOfflineAction
    pk_offline_action_from_string (const gchar *action);

Converts the string to the enumerated value.

#### Parameters

action | a string representation of a PkOfflineAction, e.g. "reboot" |

#### Returns

A PkOfflineAction, or `PK_OFFLINE_ACTION_UNKNOWN` for invalid

Since: 0.9.6

### pk_offline_get_action ()

    PkOfflineAction
    pk_offline_get_action (GError **error);

Gets the action that will be taken after the offline action has completed.

An error is set if the the value `PK_OFFLINE_ACTION_UNKNOWN` is returned.

#### Parameters

error | A GError or `NULL` |

#### Returns

a PkOfflineAction, e.g. `PK_OFFLINE_ACTION_REBOOT`

Since: 0.9.6

### pk_offline_get_prepared_ids ()

    gchar **
    pk_offline_get_prepared_ids (GError **error);

Gets the package-ids in the prepared transaction.

#### Parameters

error | A GError or `NULL` |

#### Returns

array of package-ids, or `NULL`.

[transfer full]

Since: 0.9.6

### pk_offline_get_prepared_upgrade_name ()

    gchar *
    pk_offline_get_prepared_upgrade_name (GError **error);

Gets the name of the prepared system upgrade in the prepared transaction.

#### Parameters

error | A GError or `NULL` |

#### Returns

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

Since: 1.1.2

### pk_offline_get_prepared_upgrade_version ()

    gchar *
    pk_offline_get_prepared_upgrade_version
                                   (GError **error);

Gets the version of the prepared system upgrade in the prepared transaction.

#### Parameters

error | A GError or `NULL` |

#### Returns

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

Since: 1.0.12

### pk_offline_get_prepared_sack ()

    PkPackageSack *
    pk_offline_get_prepared_sack (GError **error);

Gets a package sack of the packages in the prepared transaction.

#### Parameters

error | A GError or `NULL` |

#### Returns

A new PkPackageSack, or `NULL`.

[transfer full]

Since: 0.9.6

### pk_offline_get_prepared_monitor ()

    GFileMonitor *
    pk_offline_get_prepared_monitor (GCancellable *cancellable,
                                     GError **error);

Gets a file monitor for the prepared transaction.

#### Parameters

cancellable | A GCancellable or `NULL` |
error | A GError or `NULL` |

#### Returns

A GFileMonitor, or `NULL`.

[transfer full]

Since: 0.9.6

### pk_offline_get_prepared_upgrade_monitor ()

    GFileMonitor *
    pk_offline_get_prepared_upgrade_monitor
                                   (GCancellable *cancellable,
                                    GError **error);

Gets a file monitor for the prepared system upgrade transaction.

#### Parameters

cancellable | A GCancellable or `NULL` |
error | A GError or `NULL` |

#### Returns

A GFileMonitor, or `NULL`.

[transfer full]

Since: 1.0.12

### pk_offline_get_action_monitor ()

    GFileMonitor *
    pk_offline_get_action_monitor (GCancellable *cancellable,
                                   GError **error);

Gets a file monitor for the trigger.

#### Parameters

cancellable | A GCancellable or `NULL` |
error | A GError or `NULL` |

#### Returns

A GFileMonitor, or `NULL`.

[transfer full]

Since: 0.9.6

### pk_offline_get_results ()

    PkResults *
    pk_offline_get_results (GError **error);

Gets the last result of the offline transaction.

#### Parameters

error | A GError or `NULL` |

#### Returns

A PkResults, or `NULL`.

[transfer full]

Since: 0.9.6

### pk_offline_get_results_mtime ()

    guint64
    pk_offline_get_results_mtime (GError **error);

Gets the modification time of the prepared transaction.

#### Parameters

error | A GError or `NULL` |

#### Returns

a unix time, or 0 for error.

Since: 0.9.6

### pk_offline_cancel ()

    gboolean
    pk_offline_cancel (GCancellable *cancellable,
                       GError **error);

Cancels the offline operation that has been scheduled. If there is no scheduled offline operation then this method returns with success. The function always allows user interaction. To change the behavior, use `pk_offline_cancel_with_flags()`.

#### Parameters

cancellable | A GCancellable or `NULL` |
error | A GError or `NULL` |

#### Returns

`TRUE` for success, else `FALSE` and `error` set

Since: 0.9.6

### pk_offline_cancel_with_flags ()

    gboolean
    pk_offline_cancel_with_flags (PkOfflineFlags flags,
                                  GCancellable *cancellable,
                                  GError **error);

Cancels the offline operation that has been scheduled. If there is no scheduled offline operation then this method returns with success.

#### Parameters

flags | bit-or of PkOfflineFlags |
cancellable | A GCancellable or `NULL` |
error | A GError or `NULL` |

#### Returns

`TRUE` for success, else `FALSE` and `error` set

Since: 1.2.5

### pk_offline_clear_results ()

    gboolean
    pk_offline_clear_results (GCancellable *cancellable,
                              GError **error);

Clears the last offline operation report, which may be success or failure. If the report does not exist then this method returns success. The function always allows user interaction. To change the behavior, use `pk_offline_clear_results_with_flags()`.

#### Parameters

cancellable | A GCancellable or `NULL` |
error | A GError or `NULL` |

#### Returns

`TRUE` for success, else `FALSE` and `error` set

Since: 0.9.6

### pk_offline_clear_results_with_flags ()

    gboolean
    pk_offline_clear_results_with_flags (PkOfflineFlags flags,
                                         GCancellable *cancellable,
                                         GError **error);

Clears the last offline operation report, which may be success or failure. If the report does not exist then this method returns success.

#### Parameters

flags | bit-or of PkOfflineFlags |
cancellable | A GCancellable or `NULL` |
error | A GError or `NULL` |

#### Returns

`TRUE` for success, else `FALSE` and `error` set

Since: 1.2.5

### pk_offline_trigger ()

    gboolean
    pk_offline_trigger (PkOfflineAction action,
                        GCancellable *cancellable,
                        GError **error);

Triggers the offline update so that the next reboot will perform the pending transaction. The function always allows user interaction. To change the behavior, use `pk_offline_trigger_with_flags()`.

#### Parameters

action | a PkOfflineAction, e.g. `PK_OFFLINE_ACTION_REBOOT` |
cancellable | A GCancellable or `NULL` |
error | A GError or `NULL` |

#### Returns

`TRUE` for success, else `FALSE` and `error` set

Since: 0.9.6

### pk_offline_trigger_with_flags ()

    gboolean
    pk_offline_trigger_with_flags (PkOfflineAction action,
                                   PkOfflineFlags flags,
                                   GCancellable *cancellable,
                                   GError **error);

Triggers the offline update so that the next reboot will perform the pending transaction.

#### Parameters

action | a PkOfflineAction, e.g. `PK_OFFLINE_ACTION_REBOOT` |
flags | bit-or of PkOfflineFlags |
cancellable | A GCancellable or `NULL` |
error | A GError or `NULL` |

#### Returns

`TRUE` for success, else `FALSE` and `error` set

Since: 1.2.5

### pk_offline_trigger_upgrade ()

    gboolean
    pk_offline_trigger_upgrade (PkOfflineAction action,
                                GCancellable *cancellable,
                                GError **error);

Triggers the offline system upgrade so that the next reboot will perform the pending transaction. The function always allows user interaction. To change the behavior, use `pk_offline_trigger_upgrade_with_flags()`.

#### Parameters

action | a PkOfflineAction, e.g. `PK_OFFLINE_ACTION_REBOOT` |
cancellable | A GCancellable or `NULL` |
error | A GError or `NULL` |

#### Returns

`TRUE` for success, else `FALSE` and `error` set

Since: 1.0.12

### pk_offline_trigger_upgrade_with_flags ()

    gboolean
    pk_offline_trigger_upgrade_with_flags (PkOfflineAction action,
                                           PkOfflineFlags flags,
                                           GCancellable *cancellable,
                                           GError **error);

Triggers the offline system upgrade so that the next reboot will perform the pending transaction.

#### Parameters

action | a PkOfflineAction, e.g. `PK_OFFLINE_ACTION_REBOOT` |
flags | bit-or of PkOfflineFlags |
cancellable | A GCancellable or `NULL` |
error | A GError or `NULL` |

#### Returns

`TRUE` for success, else `FALSE` and `error` set

Since: 1.2.5

## Types and Values

### PK_OFFLINE_ERROR

    #define PK_OFFLINE_ERROR (pk_offline_error_quark ())

### enum PkOfflineAction

Actions that can be taken after an offline operation.

#### Members

PK_OFFLINE_ACTION_UNKNOWN | Unknown |
PK_OFFLINE_ACTION_REBOOT | Reboot |
PK_OFFLINE_ACTION_POWER_OFF | Power-off |
PK_OFFLINE_ACTION_UNSET | No action set |

### enum PkOfflineError

Errors that can be thrown

#### Members

PK_OFFLINE_ERROR_FAILED | No specific reason |
PK_OFFLINE_ERROR_INVALID_VALUE | An invalid value was specified |
PK_OFFLINE_ERROR_NO_DATA | No data was available |