PkProgress: PackageKit Reference Manual

## PkProgress PkProgress — Transaction progress information |

## Functions

PkProgress * | pk_progress_new ()
void | (*PkProgressCallback) ()
gboolean | pk_progress_set_package_id ()
const gchar * | pk_progress_get_package_id ()
gboolean | pk_progress_set_item_progress ()
PkItemProgress * | pk_progress_get_item_progress ()
gboolean | pk_progress_set_transaction_id ()
const gchar * | pk_progress_get_transaction_id ()
gboolean | pk_progress_set_percentage ()
gint | pk_progress_get_percentage ()
gboolean | pk_progress_set_status ()
PkStatusEnum | pk_progress_get_status ()
gboolean | pk_progress_set_role ()
PkRoleEnum | pk_progress_get_role ()
gboolean | pk_progress_set_allow_cancel ()
gboolean | pk_progress_get_allow_cancel ()
gboolean | pk_progress_set_caller_active ()
gboolean | pk_progress_get_caller_active ()
gboolean | pk_progress_set_elapsed_time ()
guint | pk_progress_get_elapsed_time ()
gboolean | pk_progress_set_remaining_time ()
guint | pk_progress_get_remaining_time ()
gboolean | pk_progress_set_speed ()
guint | pk_progress_get_speed ()
gboolean | pk_progress_set_download_size_remaining ()
guint64 | pk_progress_get_download_size_remaining ()
gboolean | pk_progress_set_transaction_flags ()
guint64 | pk_progress_get_transaction_flags ()
gboolean | pk_progress_set_uid ()
guint | pk_progress_get_uid ()
gboolean | pk_progress_set_package ()
PkPackage * | pk_progress_get_package ()

## Properties

gboolean | allow-cancel | Read / Write
gboolean | caller-active | Read / Write
guint64 | download-size-remaining | Read / Write
guint | elapsed-time | Read / Write
PkItemProgress * | item-progress | Read / Write
PkPackage * | package | Read / Write
gchar * | package-id | Read / Write
gint | percentage | Read / Write
guint | remaining-time | Read / Write
guint | role | Read / Write
guint | speed | Read / Write
guint | status | Read / Write
guint64 | transaction-flags | Read / Write
gchar * | transaction-id | Read / Write
guint | uid | Read / Write

## Types and Values

#define | PK_PROGRESS_TYPE_ERROR
enum | PkProgressType

## Object Hierarchy

        GEnum
        ╰── PkProgressType
        GObject
        ╰── PkProgress

## Description

This GObject is available to clients to be able to query details about the transaction. All of the details on this object are stored as properties.

## Functions

### pk_progress_new ()

    PkProgress *
    pk_progress_new (void);

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

#### Returns

A new PkProgress instance

Since: 0.5.2

### PkProgressCallback ()

    void
    (*PkProgressCallback) (PkProgress *progress,
                           PkProgressType type,
                           gpointer user_data);

Function that is called when progress updates are given.

#### Parameters

progress | a PkProgress |
type | the type of progress update this is |
user_data | User data supplied when the callback was registered. |

### pk_progress_set_package_id ()

    gboolean
    pk_progress_set_package_id (PkProgress *progress,
                                const gchar *package_id);

Set the package ID this transaction is acting on.

#### Parameters

progress | a valid PkProgress instance |
package_id | a PackageID |

#### Returns

`TRUE` if value changed.

Since: 0.5.2

### pk_progress_get_package_id ()

    const gchar *
    pk_progress_get_package_id (PkProgress *progress);

Get the package ID this transaction is acting on.

#### Parameters

progress | a valid PkProgress instance |

#### Returns

a PackageID

Since: 1.0.12

### pk_progress_set_item_progress ()

    gboolean
    pk_progress_set_item_progress (PkProgress *progress,
                                   PkItemProgress *item_progress);

Set the item progress associated with this transaction.

#### Parameters

progress | a valid PkProgress instance |
item_progress | a PkItemProgress |

#### Returns

`TRUE` if value changed.

Since: 0.8.1

### pk_progress_get_item_progress ()

    PkItemProgress *
    pk_progress_get_item_progress (PkProgress *progress);

Get the item progress associated with this transaction.

#### Parameters

progress | a valid PkProgress instance |

#### Returns

a PkItemProgress.

[transfer none]

Since: 1.0.12

### pk_progress_set_transaction_id ()

    gboolean
    pk_progress_set_transaction_id (PkProgress *progress,
                                    const gchar *transaction_id);

Set the ID used by this transaction.

#### Parameters

progress | a valid PkProgress instance |
transaction_id | a transaction ID. |

#### Returns

`TRUE` if value changed.

Since: 0.5.3

### pk_progress_get_transaction_id ()

    const gchar *
    pk_progress_get_transaction_id (PkProgress *progress);

Get the ID used by this transaction.

#### Parameters

progress | a valid PkProgress instance |

#### Returns

a transaction ID.

Since: 1.0.12

### pk_progress_set_percentage ()

    gboolean
    pk_progress_set_percentage (PkProgress *progress,
                                gint percentage);

Set the percentage complete of this transaction.

#### Parameters

progress | a valid PkProgress instance |
percentage | a percentage value (0-100) |

#### Returns

`TRUE` if value changed.

Since: 0.5.2

### pk_progress_get_percentage ()

    gint
    pk_progress_get_percentage (PkProgress *progress);

Get the percentage complete.

#### Parameters

progress | a valid PkProgress instance |

#### Returns

a percentage (0-100)

Since: 1.0.12

### pk_progress_set_status ()

    gboolean
    pk_progress_set_status (PkProgress *progress,
                            PkStatusEnum status);

Set the status of this transaction.

#### Parameters

progress | a valid PkProgress instance |
status | a PkStatusEnum |

#### Returns

`TRUE` if value changed.

Since: 0.5.2

### pk_progress_get_status ()

    PkStatusEnum
    pk_progress_get_status (PkProgress *progress);

Get the status of this transaction.

#### Parameters

progress | a valid PkProgress instance |

#### Returns

a status string

Since: 1.0.12

### pk_progress_set_role ()

    gboolean
    pk_progress_set_role (PkProgress *progress,
                          PkRoleEnum role);

Set the role of this transaction.

#### Parameters

progress | a valid PkProgress instance |
role | a PkRoleEnum |

#### Returns

`TRUE` if value changed.

Since: 0.5.2

### pk_progress_get_role ()

    PkRoleEnum
    pk_progress_get_role (PkProgress *progress);

Get the role of this transaction.

#### Parameters

progress | a valid PkProgress instance |

#### Returns

a PkRoleEnum

Since: 1.0.12

### pk_progress_set_allow_cancel ()

    gboolean
    pk_progress_set_allow_cancel (PkProgress *progress,
                                  gboolean allow_cancel);

Set if this transaction can be cancelled.

#### Parameters

progress | a valid PkProgress instance |
allow_cancel | `TRUE` if this transaction can be cancelled. |

#### Returns

`TRUE` if value changed.

Since: 0.5.2

### pk_progress_get_allow_cancel ()

    gboolean
    pk_progress_get_allow_cancel (PkProgress *progress);

Get if this transaction can be cancelled.

#### Parameters

progress | a valid PkProgress instance |

#### Returns

`TRUE` if progress can be cancelled.

Since: 1.0.12

### pk_progress_set_caller_active ()

    gboolean
    pk_progress_set_caller_active (PkProgress *progress,
                                   gboolean caller_active);

Set if the transaction caller is connected.

#### Parameters

progress | a valid PkProgress instance |
caller_active | `TRUE` if the transaction caller is still connected. |

#### Returns

`TRUE` if value changed.

Since: 0.5.2

### pk_progress_get_caller_active ()

    gboolean
    pk_progress_get_caller_active (PkProgress *progress);

Get if the transaction caller is connected.

#### Parameters

progress | a valid PkProgress instance |

#### Returns

`TRUE` if the transaction caller is still connected.

Since: 1.0.12

### pk_progress_set_elapsed_time ()

    gboolean
    pk_progress_set_elapsed_time (PkProgress *progress,
                                  guint elapsed_time);

Set the amount of time the transaction has taken.

#### Parameters

progress | a valid PkProgress instance |
elapsed_time | time in seconds |

#### Returns

`TRUE` if value changed.

Since: 0.5.2

### pk_progress_get_elapsed_time ()

    guint
    pk_progress_get_elapsed_time (PkProgress *progress);

Get the amount of time the transaction has taken.

#### Parameters

progress | a valid PkProgress instance |

#### Returns

time in seconds

Since: 1.0.12

### pk_progress_set_remaining_time ()

    gboolean
    pk_progress_set_remaining_time (PkProgress *progress,
                                    guint remaining_time);

Set the amount of time the transaction will take to complete.

#### Parameters

progress | a valid PkProgress instance |
remaining_time | time in seconds or 0 if unknown. |

#### Returns

`TRUE` if value changed.

Since: 0.5.2

### pk_progress_get_remaining_time ()

    guint
    pk_progress_get_remaining_time (PkProgress *progress);

Get the amount of time the transaction will take to complete.

#### Parameters

progress | a valid PkProgress instance |

#### Returns

time in seconds or 0 if unknown.

Since: 1.0.12

### pk_progress_set_speed ()

    gboolean
    pk_progress_set_speed (PkProgress *progress,
                           guint speed);

Set the speed of this transaction.

#### Parameters

progress | a valid PkProgress instance |
speed | speed in bits per second or 0 if unknown |

#### Returns

`TRUE` if value changed.

Since: 0.5.2

### pk_progress_get_speed ()

    guint
    pk_progress_get_speed (PkProgress *progress);

Get the speed of this transaction.

#### Parameters

progress | a valid PkProgress instance |

#### Returns

speed in bits per scond or 0 if unknown

Since: 1.0.12

### pk_progress_set_download_size_remaining ()

    gboolean
    pk_progress_set_download_size_remaining
                                   (PkProgress *progress,
                                    guint64 download_size_remaining);

Set the number of bytes remaining to download.

#### Parameters

progress | a valid PkProgress instance |
download_size_remaining | number of bytes remaining to download. |

#### Returns

`TRUE` if value changed.

Since: 0.8.0

### pk_progress_get_download_size_remaining ()

    guint64
    pk_progress_get_download_size_remaining
                                   (PkProgress *progress);

Get the number of bytes remaining to download.

#### Parameters

progress | a valid PkProgress instance |

#### Returns

number of bytes remaining to download.

Since: 1.0.12

### pk_progress_set_transaction_flags ()

    gboolean
    pk_progress_set_transaction_flags (PkProgress *progress,
                                       guint64 transaction_flags);

Set the flags associated with this transaction.

#### Parameters

progress | a valid PkProgress instance |
transaction_flags | a PkBitfield containing PkTransactionFlagEnum values. |

#### Returns

`TRUE` if value changed.

Since: 0.8.8

### pk_progress_get_transaction_flags ()

    guint64
    pk_progress_get_transaction_flags (PkProgress *progress);

Get the flags associated with this transaction.

#### Parameters

progress | a valid PkProgress instance |

#### Returns

a PkBitfield containing PkTransactionFlagEnum values.

Since: 1.0.12

### pk_progress_set_uid ()

    gboolean
    pk_progress_set_uid (PkProgress *progress,
                         guint uid);

Set the UID that started this transaction.

#### Parameters

progress | a valid PkProgress instance |
uid | a UID |

#### Returns

`TRUE` if value changed.

Since: 0.5.2

### pk_progress_get_uid ()

    guint
    pk_progress_get_uid (PkProgress *progress);

Get the UID that started this transaction.

#### Parameters

progress | a valid PkProgress instance |

#### Returns

an UID

Since: 1.0.12

### pk_progress_set_package ()

    gboolean
    pk_progress_set_package (PkProgress *progress,
                             PkPackage *package);

Set the package this transaction is acting on.

#### Parameters

progress | a valid PkProgress instance |
package | a PkPackage |

#### Returns

`TRUE` if value changed.

Since: 0.5.2

### pk_progress_get_package ()

    PkPackage *
    pk_progress_get_package (PkProgress *progress);

Get the package this transaction is acting on.

#### Parameters

progress | a valid PkProgress instance |

#### Returns

a PkPackage.

[transfer none]

Since: 1.0.12

## Types and Values

### PK_PROGRESS_TYPE_ERROR

    #define PK_PROGRESS_TYPE_ERROR		(pk_progress_error_get_type ())

### enum PkProgressType

Flag to show which progress field has been updated.

#### Members

PK_PROGRESS_TYPE_PACKAGE_ID | package id updated |
PK_PROGRESS_TYPE_TRANSACTION_ID | transaction ID updated |
PK_PROGRESS_TYPE_PERCENTAGE | percentage updated |
PK_PROGRESS_TYPE_ALLOW_CANCEL | allow cancel updated |
PK_PROGRESS_TYPE_STATUS | status updated |
PK_PROGRESS_TYPE_ROLE | role updated |
PK_PROGRESS_TYPE_CALLER_ACTIVE | called active updated |
PK_PROGRESS_TYPE_ELAPSED_TIME | elapsed time updated |
PK_PROGRESS_TYPE_REMAINING_TIME | remaining time updated |
PK_PROGRESS_TYPE_SPEED | speed updated |
PK_PROGRESS_TYPE_DOWNLOAD_SIZE_REMAINING | download size remaining updated |
PK_PROGRESS_TYPE_UID | uid updated |
PK_PROGRESS_TYPE_PACKAGE | package updated |
PK_PROGRESS_TYPE_ITEM_PROGRESS | item progress updated |
PK_PROGRESS_TYPE_TRANSACTION_FLAGS | transaction flags updated |
PK_PROGRESS_TYPE_INVALID |  |

## Property Details

### The `“allow-cancel”` property

      “allow-cancel”             gboolean

`TRUE` if this transaction can be cancelled.

Flags: Read / Write

Default value: FALSE

Since: 0.5.2

### The `“caller-active”` property

      “caller-active”            gboolean

`TRUE` if the transaction caller is still connected.

Flags: Read / Write

Default value: FALSE

Since: 0.5.2

### The `“download-size-remaining”` property

      “download-size-remaining”  guint64

Number of bytes remaining to download.

Flags: Read / Write

Default value: 0

Since: 0.8.0

### The `“elapsed-time”` property

      “elapsed-time”             guint

Amount of time the transaction has taken in seconds.

Flags: Read / Write

Default value: 0

Since: 0.5.2

### The `“item-progress”` property

      “item-progress”            PkItemProgress *

Item progress associated with this transaction.

Flags: Read / Write

Since: 0.8.1

### The `“package”` property

      “package”                  PkPackage *

The package this transaction is acting on.

Flags: Read / Write

Since: 0.5.3

### The `“package-id”` property

      “package-id”               gchar *

Package ID this transaction is acting on.

Flags: Read / Write

Default value: NULL

Since: 0.5.2

### The `“percentage”` property

      “percentage”               gint

Percentage complete of this transaction.

Flags: Read / Write

Allowed values: >= -1

Default value: -1

Since: 0.5.2

### The `“remaining-time”` property

      “remaining-time”           guint

Amount of time the transaction will take to complete in seconds or 0 if unknown.

Flags: Read / Write

Default value: 0

Since: 0.5.2

### The `“role”` property

      “role”                     guint

Role of this transaction.

Flags: Read / Write

Allowed values: <= 34

Default value: 0

Since: 0.5.2

### The `“speed”` property

      “speed”                    guint

Transaction speed in bits per second or 0 if unknown.

Flags: Read / Write

Default value: 0

Since: 0.5.2

### The `“status”` property

      “status”                   guint

Status of this transaction.

Flags: Read / Write

Allowed values: <= 37

Default value: 0

Since: 0.5.2

### The `“transaction-flags”` property

      “transaction-flags”        guint64

A PkBitfield containing PkTransactionFlagEnum associated with this transaction.

Flags: Read / Write

Default value: 0

Since: 0.8.8

### The `“transaction-id”` property

      “transaction-id”           gchar *

ID used by this transaction.

Flags: Read / Write

Default value: NULL

Since: 0.5.2

### The `“uid”` property

      “uid”                      guint

The UID that started this transaction.

Flags: Read / Write

Default value: 0

Since: 0.5.2