AppStreamGlib.Store

g AppStreamGlib.Store AppStreamGlib.Store GObject.Object GObject.Object GObject.Object->AppStreamGlib.Store

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

error_quark ()

class

new ()

add_app (app)

add_apps (apps)

add_filter (kind)

add_metadata_index (key)

convert_icons (kind)

dup_apps ()

dup_apps_by_id_merge (id)

from_bytes (bytes, cancellable)

from_file (file, icon_root, cancellable)

from_xml (data, icon_root)

get_add_flags ()

get_api_version ()

get_app_by_id (id)

get_app_by_id_ignore_prefix (id)

get_app_by_id_with_fallbacks (id)

get_app_by_launchable (kind, value)

get_app_by_pkgname (pkgname)

get_app_by_pkgnames (pkgnames)

get_app_by_provide (kind, value)

get_app_by_unique_id (unique_id, search_flags)

get_apps ()

get_apps_by_id (id)

get_apps_by_id_merge (id)

get_apps_by_metadata (key, value)

get_apps_by_provide (kind, value)

get_builder_id ()

get_destdir ()

get_origin ()

get_search_match ()

get_size ()

get_version ()

get_watch_flags ()

load (flags, cancellable)

load_async (flags, cancellable, callback, *user_data)

load_finish (result)

load_path (path, cancellable)

load_path_async (path, cancellable, callback, *user_data)

load_path_finish (result)

load_search_cache ()

remove_all ()

remove_app (app)

remove_app_by_id (id)

remove_apps_with_veto ()

remove_filter (kind)

set_add_flags (add_flags)

set_api_version (api_version)

set_builder_id (builder_id)

set_destdir (destdir)

set_origin (origin)

set_search_match (search_match)

set_version (api_version)

set_watch_flags (watch_flags)

to_file (file, flags, cancellable)

to_xml (flags)

validate (flags)

Virtual Methods

Inherited:

GObject.Object (7)

do_app_added (app)

do_app_changed (app)

do_app_removed (app)

do_changed ()

Properties

None

Signals

Inherited:

GObject.Object (1)

Name

Short Description

app-added

The ::app-added signal is emitted when a component has been added to the store.

app-changed

The ::app-changed signal is emitted when a component has been changed in the store.

app-removed

The ::app-removed signal is emitted when a component has been removed from the store.

changed

The ::changed signal is emitted when components have been added or removed from the store.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class AppStreamGlib.Store(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

AppStreamGlib.StoreClass

classmethod error_quark()[source]
Returns:

An error quark.

Return type:

int

New in version 0.1.2.

classmethod new()[source]
Returns:

a AppStreamGlib.Store

Return type:

AppStreamGlib.Store

Creates a new AppStreamGlib.Store.

New in version 0.1.0.

add_app(app)[source]
Parameters:

app (AppStreamGlib.App) – a AppStreamGlib.App instance.

Adds an application to the store. If a lower priority application has already been added then this new application will replace it.

Additionally only applications where the kind is known will be added.

New in version 0.1.0.

add_apps(apps)[source]
Parameters:

apps ([AppStreamGlib.App]) – an array of apps

Adds several applications to the store.

Additionally only applications where the kind is known will be added.

New in version 0.6.4.

add_filter(kind)[source]
Parameters:

kind (AppStreamGlib.AppKind) – a AppStreamGlib.AppKind, e.g. AppStreamGlib.AppKind.FIRMWARE

Adds a filter to the store so that only components of this type are loaded into the store. This may be useful if the client is only interested in certain types of component, or not interested in loading components it cannot process.

If no filter is set then all types of components are loaded.

New in version 0.3.5.

add_metadata_index(key)[source]
Parameters:

key (str) – the metadata key.

Adds a metadata index key.

NOTE: if applications are removed *all* the indexes will be invalid and will have to be re-added.

New in version 0.3.0.

convert_icons(kind)[source]
Parameters:

kind (AppStreamGlib.IconKind) – the AppStreamGlib.IconKind, e.g. AppStreamGlib.IconKind.EMBEDDED.

Raises:

GLib.Error

Returns:

True for success

Return type:

bool

Converts all the icons in the store to a specific kind.

New in version 0.3.1.

dup_apps()[source]
Returns:

an array

Return type:

[AppStreamGlib.App]

Gets an array of all the valid applications in the store.

New in version 0.7.15.

dup_apps_by_id_merge(id)[source]
Parameters:

id (str) – the application full ID.

Returns:

an array

Return type:

[AppStreamGlib.App]

Gets an array of all the merge applications that match a specific ID.

New in version 0.7.15.

from_bytes(bytes, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

True for success

Return type:

bool

Parses an appstream store presented as an archive. This is typically a .cab file containing firmware files.

New in version 0.5.2.

from_file(file, icon_root, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

True for success

Return type:

bool

Parses an AppStream XML or DEP-11 YAML file and adds any valid applications to the store.

If the root node does not have a ‘origin’ attribute, then the method AppStreamGlib.Store.set_origin() should be called *before* this function if cached icons are required.

If file does not exist, Gio.IOErrorEnum.NOT_FOUND will be returned. Other GLib.IOErrors and AppStreamGlib.StoreErrors may be returned as appropriate.

New in version 0.1.0.

from_xml(data, icon_root)[source]
Parameters:
  • data (str) – XML data

  • icon_root (str or None) – the icon path, or None for the default.

Raises:

GLib.Error

Returns:

True for success

Return type:

bool

Parses AppStream XML file and adds any valid applications to the store.

If the root node does not have a ‘origin’ attribute, then the method AppStreamGlib.Store.set_origin() should be called *before* this function if cached icons are required.

New in version 0.1.1.

get_add_flags()[source]
Returns:

the AppStreamGlib.StoreAddFlags, or 0 if unset

Return type:

int

Gets the flags used for adding applications to the store.

New in version 0.2.2.

get_api_version()[source]
Returns:

the API version

Return type:

float

Gets the AppStream API version.

New in version 0.1.1.

Deprecated since version 0.7.19: Use AppStreamGlib.Store.get_version() instead.

get_app_by_id(id)[source]
Parameters:

id (str) – the application full ID.

Returns:

a AppStreamGlib.App or None

Return type:

AppStreamGlib.App

Finds an application in the store by ID. If more than one application exists matching the specific ID, (for instance when using AppStreamGlib.StoreAddFlags.USE_UNIQUE_ID) then the first item that was added is returned.

New in version 0.1.0.

get_app_by_id_ignore_prefix(id)[source]
Parameters:

id (str) – the application full ID.

Returns:

a AppStreamGlib.App or None

Return type:

AppStreamGlib.App

Finds an application in the store ignoring the prefix type.

New in version 0.5.12.

get_app_by_id_with_fallbacks(id)[source]
Parameters:

id (str) – the application full ID.

Returns:

a AppStreamGlib.App or None

Return type:

AppStreamGlib.App

Finds an application in the store by either by the current desktop ID or a desktop ID that it has used previously. This allows upstream software to change their ID (e.g. from cheese.desktop to org.gnome.Cheese.desktop) without us duplicating entries in the software center.

New in version 0.4.1.

get_app_by_launchable(kind, value)[source]
Parameters:
Returns:

a AppStreamGlib.App or None

Return type:

AppStreamGlib.App

Finds an application in the store that provides a specific launchable.

New in version 0.7.8.

get_app_by_pkgname(pkgname)[source]
Parameters:

pkgname (str) – the package name.

Returns:

a AppStreamGlib.App or None

Return type:

AppStreamGlib.App

Finds an application in the store by package name.

New in version 0.1.0.

get_app_by_pkgnames(pkgnames)[source]
Parameters:

pkgnames (str) – the package names to find.

Returns:

a AppStreamGlib.App or None

Return type:

AppStreamGlib.App

Finds an application in the store by any of the possible package names.

New in version 0.4.1.

get_app_by_provide(kind, value)[source]
Parameters:
Returns:

a AppStreamGlib.App or None

Return type:

AppStreamGlib.App

Finds an application in the store by something that it provides.

New in version 0.5.0.

get_app_by_unique_id(unique_id, search_flags)[source]
Parameters:
Returns:

a AppStreamGlib.App or None

Return type:

AppStreamGlib.App

Finds an application in the store by matching the unique ID.

New in version 0.6.1.

get_apps()[source]
Returns:

an array

Return type:

[AppStreamGlib.App]

Gets an array of all the valid applications in the store.

New in version 0.1.0.

get_apps_by_id(id)[source]
Parameters:

id (str) – the application full ID.

Returns:

an array

Return type:

[AppStreamGlib.App]

Gets an array of all the applications that match a specific ID, ignoring the prefix type.

New in version 0.5.12.

get_apps_by_id_merge(id)[source]
Parameters:

id (str) – the application full ID.

Returns:

an array

Return type:

[AppStreamGlib.App]

Gets an array of all the merge applications that match a specific ID.

New in version 0.7.0.

get_apps_by_metadata(key, value)[source]
Parameters:
  • key (str) – metadata key

  • value (str) – metadata value

Returns:

an array

Return type:

[AppStreamGlib.App]

Gets an array of all the applications that match a specific metadata element.

New in version 0.1.4.

get_apps_by_provide(kind, value)[source]
Parameters:
Returns:

an array of applications

Return type:

[AppStreamGlib.App]

Finds any applications in the store by something that they provides.

New in version 0.7.5.

get_builder_id()[source]
Returns:

the builder_id string, or None if unset

Return type:

str

Gets the metadata builder identifier, which is used to work out if old metadata is compatible with this builder.

New in version 0.2.5.

get_destdir()[source]
Returns:

the destdir path, or None if unset

Return type:

str

Gets the destdir, which is used to prefix usr.

New in version 0.2.4.

get_origin()[source]
Returns:

the origin string, or None if unset

Return type:

str

Gets the metadata origin, which is used to locate icons.

New in version 0.1.1.

get_search_match()[source]
Returns:

a AppStreamGlib.AppSearchMatch, e.g. AppStreamGlib.AppSearchMatch.PKGNAME

Return type:

int

Gets the token match fields. The bitfield given here is used to choose what is included in the token cache.

New in version 0.6.13.

get_size()[source]
Returns:

the number of usable applications in the store

Return type:

int

Gets the size of the store after deduplication and prioritization has taken place.

New in version 0.1.0.

get_version()[source]
Returns:

the API version

Return type:

str

Gets the AppStream API version.

New in version 0.7.19.

get_watch_flags()[source]
Returns:

the AppStreamGlib.StoreWatchFlags, or 0 if unset

Return type:

int

Gets the flags used for adding files to the store.

New in version 0.4.2.

load(flags, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

True for success

Return type:

bool

Loads the store from the default locations.

New in version 0.1.2.

load_async(flags, cancellable, callback, *user_data)[source]
Parameters:

Asynchronously loads the store from the default locations.

New in version 0.7.11.

load_finish(result)[source]
Parameters:

result (Gio.AsyncResult) – A Gio.AsyncResult

Raises:

GLib.Error

Returns:

True for success

Return type:

bool

Retrieve the result of AppStreamGlib.Store.load_async().

New in version 0.7.11.

load_path(path, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

True for success

Return type:

bool

Loads the store from a specific path.

New in version 0.2.2.

load_path_async(path, cancellable, callback, *user_data)[source]
Parameters:

Asynchronously loads the store from a specific path.

New in version 0.7.11.

load_path_finish(result)[source]
Parameters:

result (Gio.AsyncResult) – A Gio.AsyncResult

Raises:

GLib.Error

Returns:

True for success

Return type:

bool

Retrieve the result of AppStreamGlib.Store.load_path_async().

New in version 0.7.11.

load_search_cache()[source]

Populates the token cache for all applications in the store. This allows all the search keywords for all applications in the store to be pre-processed at one time in multiple threads rather than on demand.

Note: Calling AppStreamGlib.App.search_matches() automatically generates the search cache for the AppStreamGlib.App object if it has not already been generated.

New in version 0.6.5.

remove_all()[source]

Removes all applications from the store.

New in version 0.2.5.

remove_app(app)[source]
Parameters:

app (AppStreamGlib.App) – a AppStreamGlib.App instance.

Removes an application from the store if it exists.

New in version 0.1.0.

remove_app_by_id(id)[source]
Parameters:

id (str) – an application id

Removes an application from the store if it exists.

New in version 0.3.0.

remove_apps_with_veto()[source]

Removes any applications from the store if they have any vetos.

New in version 0.5.13.

remove_filter(kind)[source]
Parameters:

kind (AppStreamGlib.AppKind) – a AppStreamGlib.AppKind, e.g. AppStreamGlib.AppKind.FIRMWARE

Removed a filter from the store so that components of this type are no longer loaded into the store. This may be useful if the client is only interested in certain types of component.

If all filters are removed then all types of components are loaded.

New in version 0.3.5.

set_add_flags(add_flags)[source]
Parameters:

add_flags (int) – the AppStreamGlib.StoreAddFlags, e.g. AppStreamGlib.StoreAddFlags.NONE

Sets the flags used when adding applications to the store.

NOTE: Using AppStreamGlib.StoreAddFlags.PREFER_LOCAL may be a privacy risk depending on your level of paranoia, and should not be used by default.

New in version 0.2.2.

set_api_version(api_version)[source]
Parameters:

api_version (float) – the API version

Sets the AppStream API version.

New in version 0.1.1.

Deprecated since version 0.7.19: Use AppStreamGlib.Store.set_version() instead.

set_builder_id(builder_id)[source]
Parameters:

builder_id (str) – the builder_id, e.g. “appstream-glib:1”

Sets the metadata builder identifier, which is used to work out if old metadata can be used.

New in version 0.2.5.

set_destdir(destdir)[source]
Parameters:

destdir (str) – the destdir, e.g. “/tmp”

Sets the destdir, which is used to prefix usr.

New in version 0.2.4.

set_origin(origin)[source]
Parameters:

origin (str) – the origin, e.g. “fedora-21”

Sets the metadata origin, which is used to locate icons.

New in version 0.1.1.

set_search_match(search_match)[source]
Parameters:

search_match (int) – the AppStreamGlib.AppSearchMatch, e.g. AppStreamGlib.AppSearchMatch.PKGNAME

Sets the token match fields. The bitfield given here is used to choose what is included in the token cache.

New in version 0.6.5.

set_version(api_version)[source]
Parameters:

api_version (str) – the API version

Sets the AppStream API version.

New in version 0.7.19.

set_watch_flags(watch_flags)[source]
Parameters:

watch_flags (int) – the AppStreamGlib.StoreWatchFlags, e.g. AppStreamGlib.StoreWatchFlags.NONE

Sets the flags used when adding files to the store.

New in version 0.4.2.

to_file(file, flags, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

A GLib.String

Return type:

bool

Outputs an optionally compressed XML file of all the applications in the store.

New in version 0.1.0.

to_xml(flags)[source]
Parameters:

flags (int) – the AppStreamGlib.NodeToXmlFlags, e.g. AppStreamGlib.NodeToXmlFlags.NONE.

Returns:

A GLib.String

Return type:

GLib.String

Outputs an XML representation of all the applications in the store.

New in version 0.1.0.

validate(flags)[source]
Parameters:

flags (int) – the AppStreamGlib.AppValidateFlags to use, e.g. AppStreamGlib.AppValidateFlags.NONE

Raises:

GLib.Error

Returns:

A list of problems, or None

Return type:

[AppStreamGlib.Problem]

Validates information in the store for data applicable to the defined metadata version.

New in version 0.2.4.

do_app_added(app) virtual
Parameters:

app (AppStreamGlib.App) –

do_app_changed(app) virtual
Parameters:

app (AppStreamGlib.App) –

do_app_removed(app) virtual
Parameters:

app (AppStreamGlib.App) –

do_changed() virtual

Signal Details

AppStreamGlib.Store.signals.app_added(store, app)
Signal Name:

app-added

Flags:

RUN_LAST

Parameters:

The ::app-added signal is emitted when a component has been added to the store.

New in version 0.6.5.

AppStreamGlib.Store.signals.app_changed(store, app)
Signal Name:

app-changed

Flags:

RUN_LAST

Parameters:

The ::app-changed signal is emitted when a component has been changed in the store.

New in version 0.6.5.

AppStreamGlib.Store.signals.app_removed(store, app)
Signal Name:

app-removed

Flags:

RUN_LAST

Parameters:

The ::app-removed signal is emitted when a component has been removed from the store.

New in version 0.6.5.

AppStreamGlib.Store.signals.changed(store)
Signal Name:

changed

Flags:

RUN_LAST

Parameters:

store (AppStreamGlib.Store) – The object which received the signal

The ::changed signal is emitted when components have been added or removed from the store.

New in version 0.1.2.