PackageKit Reference Manual: PkPackage

## PkPackage PkPackage — Package object |

## Functions

PkPackage * | pk_package_new ()
void | pk_package_test ()
gboolean | pk_package_set_id ()
gboolean | pk_package_parse ()
void | pk_package_print ()
gboolean | pk_package_equal ()
gboolean | pk_package_equal_id ()
const gchar * | pk_package_get_id ()
PkInfoEnum | pk_package_get_info ()
void | pk_package_set_info ()
const gchar * | pk_package_get_summary ()
void | pk_package_set_summary ()
const gchar * | pk_package_get_name ()
const gchar * | pk_package_get_version ()
const gchar * | pk_package_get_arch ()
const gchar * | pk_package_get_data ()

## Properties

gchar * | description | Read / Write
guint | group | Read / Write
guint | info | Read / Write
gchar * | license | Read / Write
gchar * | package-id | Read
guint64 | size | Read / Write
gchar * | summary | Read / Write
GStrv | update-bugzilla-urls | Read / Write
gchar * | update-changelog | Read / Write
GStrv | update-cve-urls | Read / Write
gchar * | update-issued | Read / Write
gchar * | update-obsoletes | Read / Write
guint | update-restart | Read / Write
guint | update-state | Read / Write
gchar * | update-text | Read / Write
gchar * | update-updated | Read / Write
gchar * | update-updates | Read / Write
GStrv | update-vendor-urls | Read / Write
gchar * | url | Read / Write

## Signals

void | changed | Run Last

## Types and Values

#define | PK_PACKAGE_TYPE_ERROR

## Object Hierarchy

        GObject
        ╰── PkSource
            ╰── PkPackage

## Description

This GObject represents a package from a transaction. These objects represent single items of data from the transaction, and are often present in lists (PkResults) or just refcounted in client programs.

## Functions

### pk_package_new ()

    PkPackage *
    pk_package_new (void);

#### Returns

a new PkPackage object.

Since 0.5.4

### pk_package_test ()

    void
    pk_package_test (gpointer user_data);

### pk_package_set_id ()

    gboolean
    pk_package_set_id (PkPackage *package,
                       const gchar *package_id,
                       GError **error);

Sets the package object to have the given ID

#### Parameters

package | a valid PkPackage instance |
package_id | the valid package_id |
error | a `GError` to put the error code and message in, or `NULL` |

#### Returns

`TRUE` if the package_id was set

Since 0.5.4

### pk_package_parse ()

    gboolean
    pk_package_parse (PkPackage *package,
                      const gchar *data,
                      GError **error);

Parses the data to populate the PkPackage.

#### Parameters

package | a valid PkPackage instance |
data | the data describing the package |
error | a `GError` to put the error code and message in, or `NULL` |

#### Returns

`TRUE` if the data was parsed correcty

Since 0.8.11

### pk_package_print ()

    void
    pk_package_print (PkPackage *package);

Prints details about the package to standard out.

#### Parameters

package | a valid PkPackage instance |

Since 0.5.4

### pk_package_equal ()

    gboolean
    pk_package_equal (PkPackage *package1,
                      PkPackage *package2);

Do the PkPackage's have the same ID.

#### Parameters

package1 | a valid PkPackage instance |
package2 | a valid PkPackage instance |

#### Returns

`TRUE` if the packages have the same package_id, info and summary.

Since 0.5.4

### pk_package_equal_id ()

    gboolean
    pk_package_equal_id (PkPackage *package1,
                         PkPackage *package2);

Do the PkPackage's have the same ID.

#### Parameters

package1 | a valid PkPackage instance |
package2 | a valid PkPackage instance |

#### Returns

`TRUE` if the packages have the same package_id.

Since 0.5.4

### pk_package_get_id ()

    const gchar *
    pk_package_get_id (PkPackage *package);

Gets the package object ID

#### Parameters

package | a valid PkPackage instance |

#### Returns

the ID, or `NULL` if unset

Since 0.5.4

### pk_package_get_info ()

    PkInfoEnum
    pk_package_get_info (PkPackage *package);

Gets the package object ID

#### Parameters

package | a valid PkPackage instance |

#### Returns

the `PkInfoEnum`

Since 0.5.4

### pk_package_set_info ()

    void
    pk_package_set_info (PkPackage *package,
                         PkInfoEnum info);

Sets the package info enum.

#### Parameters

package | a valid PkPackage instance |
info | the `PkInfoEnum` |

Since 0.8.14

### pk_package_get_summary ()

    const gchar *
    pk_package_get_summary (PkPackage *package);

Gets the package object ID

#### Parameters

package | a valid PkPackage instance |

#### Returns

the summary, or `NULL` if unset

Since 0.5.4

### pk_package_set_summary ()

    void
    pk_package_set_summary (PkPackage *package,
                            const gchar *summary);

Sets the package summary.

#### Parameters

package | a valid PkPackage instance |
summary | the package summary |

Since 0.8.14

### pk_package_get_name ()

    const gchar *
    pk_package_get_name (PkPackage *package);

Gets the package name.

#### Parameters

package | a valid PkPackage instance |

#### Returns

the name, or `NULL` if unset

Since 0.6.4

### pk_package_get_version ()

    const gchar *
    pk_package_get_version (PkPackage *package);

Gets the package version.

#### Parameters

package | a valid PkPackage instance |

#### Returns

the version, or `NULL` if unset

Since 0.6.4

### pk_package_get_arch ()

    const gchar *
    pk_package_get_arch (PkPackage *package);

Gets the package arch.

#### Parameters

package | a valid PkPackage instance |

#### Returns

the arch, or `NULL` if unset

Since 0.6.4

### pk_package_get_data ()

    const gchar *
    pk_package_get_data (PkPackage *package);

Gets the package data, which is usually the repository ID that contains the package. Special ID's include "installed" for installed packages, and "local" for local packages that exist on disk but not in a repoitory.

#### Parameters

package | a valid PkPackage instance |

#### Returns

the data, or `NULL` if unset

Since 0.6.4

## Types and Values

### PK_PACKAGE_TYPE_ERROR

    #define PK_PACKAGE_TYPE_ERROR (pk_package_error_get_type ())

## Property Details

### The `“description”` property

      “description”              gchar *

The package description.

Flags: Read / Write

Default value: NULL

Since 0.5.4

### The `“group”` property

      “group”                    guint

The package group.

Flags: Read / Write

Allowed values: <= 35

Default value: 0

Since 0.5.4

### The `“info”` property

      “info”                     guint

The PkInfoEnum package type, e.g. PK_INFO_ENUM_NORMAL.

Flags: Read / Write

Default value: 0

Since 0.5.4

### The `“license”` property

      “license”                  gchar *

The package license.

Flags: Read / Write

Default value: NULL

Since 0.5.4

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

      “package-id”               gchar *

The full package_id, e.g. 'gnome-power-manager;0.1.2;i386;fedora'.

Flags: Read

Default value: NULL

Since 0.5.4

### The `“size”` property

      “size”                     guint64

The package size.

Flags: Read / Write

Default value: 0

Since 0.5.4

### The `“summary”` property

      “summary”                  gchar *

The package summary.

Flags: Read / Write

Default value: NULL

Since 0.5.4

### The `“update-bugzilla-urls”` property

      “update-bugzilla-urls”     GStrv

The update bugzilla URLs.

Flags: Read / Write

Since 0.8.1

### The `“update-changelog”` property

      “update-changelog”         gchar *

The update ChangeLog.

Flags: Read / Write

Default value: NULL

Since 0.5.4

### The `“update-cve-urls”` property

      “update-cve-urls”          GStrv

The update CVE URLs.

Flags: Read / Write

Since 0.8.1

### The `“update-issued”` property

      “update-issued”            gchar *

When the update was issued.

Flags: Read / Write

Default value: NULL

Since 0.5.4

### The `“update-obsoletes”` property

      “update-obsoletes”         gchar *

The update packages that are obsoleted.

Flags: Read / Write

Default value: NULL

Since 0.5.4

### The `“update-restart”` property

      “update-restart”           guint

The update restart type.

Flags: Read / Write

Allowed values: <= 7

Default value: 0

Since 0.5.4

### The `“update-state”` property

      “update-state”             guint

The update state.

Flags: Read / Write

Allowed values: <= 4

Default value: 0

Since 0.5.4

### The `“update-text”` property

      “update-text”              gchar *

The update description.

Flags: Read / Write

Default value: NULL

Since 0.5.4

### The `“update-updated”` property

      “update-updated”           gchar *

When the update was last updated.

Flags: Read / Write

Default value: NULL

Since 0.5.4

### The `“update-updates”` property

      “update-updates”           gchar *

The update packages.

Flags: Read / Write

Default value: NULL

Since 0.5.4

### The `“update-vendor-urls”` property

      “update-vendor-urls”       GStrv

The update vendor URLs.

Flags: Read / Write

Since 0.8.1

### The `“url”` property

      “url”                      gchar *

The package homepage URL.

Flags: Read / Write

Default value: NULL

Since 0.5.4

## Signal Details

### The `“changed”` signal

    void
    user_function (PkPackage *package,
                   gpointer   user_data)

The ::changed signal is emitted when the package data may have changed.

#### Parameters

package | the PkPackage instance that emitted the signal |
user_data | user data set when the signal handler was connected. |

Flags: Run Last