pk-common

pk-common — Common utility functions for PackageKit

Synopsis

#define             PK_DBUS_SERVICE
#define             PK_DBUS_PATH
#define             PK_DBUS_INTERFACE
#define             PK_DBUS_INTERFACE_TRANSACTION
#define             PK_SERVICE_PACK_GROUP_NAME
#define             PK_SYSTEM_PACKAGE_LIST_FILENAME
gboolean            pk_strvalidate                      (const gchar *text);
gchar *             pk_strsafe                          (const gchar *text);
gchar **            pk_ptr_array_to_strv                (GPtrArray *array);
GPtrArray *         pk_strv_to_ptr_array                (gchar **array);
gchar **            pk_va_list_to_argv                  (const gchar *string_first,
                                                         va_list *args);
gchar *             pk_iso8601_present                  (void);
guint               pk_iso8601_difference               (const gchar *isodate);
gchar *             pk_iso8601_from_date                (const GDate *date);
GDate *             pk_iso8601_to_date                  (const gchar *iso_date);
gchar *             pk_get_distro_id                    (void);

Description

This file contains functions that may be useful.

Details

PK_DBUS_SERVICE

#define	PK_DBUS_SERVICE			"org.freedesktop.PackageKit"

The SYSTEM service DBUS name


PK_DBUS_PATH

#define	PK_DBUS_PATH			"/org/freedesktop/PackageKit"

The DBUS path


PK_DBUS_INTERFACE

#define	PK_DBUS_INTERFACE		"org.freedesktop.PackageKit"

The DBUS interface


PK_DBUS_INTERFACE_TRANSACTION

#define	PK_DBUS_INTERFACE_TRANSACTION	"org.freedesktop.PackageKit.Transaction"

The DBUS interface for the transactions


PK_SERVICE_PACK_GROUP_NAME

#define	PK_SERVICE_PACK_GROUP_NAME	"PackageKit Service Pack"

The group name of the Service Pack config file


PK_SYSTEM_PACKAGE_LIST_FILENAME

#define	PK_SYSTEM_PACKAGE_LIST_FILENAME	"/var/lib/PackageKit/system.package-list"


pk_strvalidate ()

gboolean            pk_strvalidate                      (const gchar *text);

Tests a string to see if it may be dangerous or invalid.

text :

The text to check for validity

Returns :

TRUE if the string is valid

pk_strsafe ()

gchar *             pk_strsafe                          (const gchar *text);

Replaces chars in the text that may be dangerous, or that may print incorrectly. These chars include new lines, tabs and line feed, and are replaced by spaces.

text :

The input text to make safe

Returns :

the new string with no insane chars

pk_ptr_array_to_strv ()

gchar **            pk_ptr_array_to_strv                (GPtrArray *array);

Form a composite string array of strings. The data in the GPtrArray is copied.

array :

the GPtrArray of strings

Returns :

the string array, or NULL if invalid

pk_strv_to_ptr_array ()

GPtrArray *         pk_strv_to_ptr_array                (gchar **array);

Form a GPtrArray array of strings. The data in the array is copied.

array :

the gchar** array of strings

Returns :

the string array, or NULL if invalid

pk_va_list_to_argv ()

gchar **            pk_va_list_to_argv                  (const gchar *string_first,
                                                         va_list *args);

Form a composite string array of the va_list

string_first :

the first string

args :

any subsequant string's

Returns :

the string array, or NULL if invalid

pk_iso8601_present ()

gchar *             pk_iso8601_present                  (void);

Returns :

The current iso8601 date and time

pk_iso8601_difference ()

guint               pk_iso8601_difference               (const gchar *isodate);

isodate :

The ISO8601 date to compare

Returns :

The difference in seconds between the iso8601 date and current

pk_iso8601_from_date ()

gchar *             pk_iso8601_from_date                (const GDate *date);

date :

a GDate to convert

Returns :

If valid then a new ISO8601 date, else NULL

pk_iso8601_to_date ()

GDate *             pk_iso8601_to_date                  (const gchar *iso_date);

iso_date :

The ISO8601 date to convert

Returns :

If valid then a new GDate, else NULL

pk_get_distro_id ()

gchar *             pk_get_distro_id                    (void);

Returns :

The current distro-id, e.g. fedora-8-i386, or NULL for an error or not known