AppStream.Pool

g AppStream.Pool AppStream.Pool GObject.Object GObject.Object GObject.Object->AppStream.Pool

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

add_components (cbox)

add_extra_data_location (directory, format_style)

add_flags (flags)

build_search_tokens (search)

clear ()

get_components ()

get_components_by_bundle_id (kind, bundle_id, match_prefix)

get_components_by_categories (categories)

get_components_by_extends (extended_id)

get_components_by_id (cid)

get_components_by_kind (kind)

get_components_by_launchable (kind, id)

get_components_by_provided_item (kind, item)

get_flags ()

get_locale ()

is_empty ()

load (cancellable)

load_async (cancellable, callback, *user_data)

load_finish (result)

remove_flags (flags)

reset_extra_data_locations ()

search (search)

set_flags (flags)

set_load_std_data_locations (enabled)

set_locale (locale)

Virtual Methods

Inherited:

GObject.Object (7)

do_changed ()

Properties

None

Signals

Inherited:

GObject.Object (1)

Name

Short Description

changed

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

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class AppStream.Pool(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

AppStream.PoolClass

classmethod new()
Returns:

a AppStream.Pool

Return type:

AppStream.Pool

Creates a new AppStream.Pool.

add_components(cbox)
Parameters:

cbox (AppStream.ComponentBox) – Components to add to the pool.

Raises:

GLib.Error

Returns:

True if the new components were successfully added to the pool.

Return type:

bool

Register a set of components with the pool temporarily. Data from components added like this will not be cached.

New in version 0.15.0.

add_extra_data_location(directory, format_style)
Parameters:

Add an additional non-standard location to the metadata pool where metadata will be read from. If directory contains a “xml”, “xmls”, “yaml” or “icons” subdirectory (or all of them), those paths will be added to the search paths instead.

add_flags(flags)
Parameters:

flags (AppStream.PoolFlags) – The AppStream.PoolFlags to add.

Convenience function to add one or multiple AppStream.PoolFlags to the flag set of this data pool.

New in version 0.15.0.

build_search_tokens(search)
Parameters:

search (str) – the (user-provided) search phrase.

Returns:

(array zero-terminated=1): Valid tokens to search for, or None for error

Return type:

[str]

Splits up a string into an array of tokens that are suitable for searching. This includes stripping whitespaces, casefolding the terms and removing greylist words.

This function is usually called automatically when needed, you will only need to run it explicitly when you need to check which search tokens the pool will actually use internally for a given phrase.

clear()

Remove all metadata from the pool, data will be reloaded once AppStream.Pool.load is called again.

get_components()
Returns:

an AppStream.ComponentBox.

Return type:

AppStream.ComponentBox

Get a list of found components.

get_components_by_bundle_id(kind, bundle_id, match_prefix)
Parameters:
Returns:

an AppStream.ComponentBox.

Return type:

AppStream.ComponentBox

Find components that are provided by a bundle with a specific ID by its prefix. For example, given a AppStream.BundleKind.FLATPAK and a bundle_id “org.kde.dolphin/”, it will list all the components that bundle dolphin. If the bundle_id is “org.kde.dolphin/x86_64” it will give those with also the architecture.

New in version 0.16.0.

get_components_by_categories(categories)
Parameters:

categories ([str]) – An array of XDG categories to include.

Returns:

an AppStream.ComponentBox of found components.

Return type:

AppStream.ComponentBox

Return a list of components which are in all of the categories.

get_components_by_extends(extended_id)
Parameters:

extended_id (str) – The ID of the component to search extensions for.

Returns:

an AppStream.ComponentBox.

Return type:

AppStream.ComponentBox

Find components extending the component with the given ID. They can then be registered to the AppStream.Component they extend via AppStream.Component.add_addon. If the AppStream.PoolFlags.RESOLVE_ADDONS pool flag is set, addons are automatically resolved and this explicit function is not needed, but overall query time will be increased (so only use this flag if you will be resolving addon information later anyway).

New in version 0.15.0.

get_components_by_id(cid)
Parameters:

cid (str) – The AppStream-ID to look for.

Returns:

an AppStream.ComponentBox.

Return type:

AppStream.ComponentBox

Get a specific component by its ID. This function may contain multiple results if we have data describing this component from multiple scopes/origin types.

get_components_by_kind(kind)
Parameters:

kind (AppStream.ComponentKind) – An AppStream.ComponentKind.

Returns:

an AppStream.ComponentBox of found components.

Return type:

AppStream.ComponentBox

Return a list of all components in the pool which are of a certain kind.

get_components_by_launchable(kind, id)
Parameters:
Returns:

an AppStream.ComponentBox of found components.

Return type:

AppStream.ComponentBox

Find components in the AppStream data pool which provide a specific launchable. See AppStream.Launchable for details on launchables, or refer to the AppStream specification.

New in version 0.11.4.

get_components_by_provided_item(kind, item)
Parameters:
Returns:

an AppStream.ComponentBox of found components.

Return type:

AppStream.ComponentBox

Find components in the AppStream data pool which provide a certain item.

get_flags()
Return type:

AppStream.PoolFlags

Get the AppStream.PoolFlags for this data pool.

get_locale()
Returns:

Locale used for metadata parsing.

Return type:

str

Gets the currently used locale.

is_empty()
Returns:

True if the pool is empty.

Return type:

bool

Check if this pool contains any data.

load(cancellable)
Parameters:

cancellable (Gio.Cancellable or None) – a Gio.Cancellable.

Raises:

GLib.Error

Returns:

True if update completed without error.

Return type:

bool

Builds an index of all found components in the watched locations. The function will try to get as much data into the pool as possible, so even if the update completes with False, it might still have added components to the pool.

The function will load from all possible data sources, preferring caches if they are up to date.

load_async(cancellable, callback, *user_data)
Parameters:

Asynchronously loads data from all registered locations. Equivalent to AppStream.Pool.load() (but asynchronous)

New in version 0.12.10.

load_finish(result)
Parameters:

result (Gio.AsyncResult) – A Gio.AsyncResult

Raises:

GLib.Error

Returns:

True for success

Return type:

bool

Retrieve the result of AppStream.Pool.load_async().

New in version 0.12.10.

remove_flags(flags)
Parameters:

flags (AppStream.PoolFlags) – The AppStream.PoolFlags to remove.

Convenience function to remove one or multiple AppStream.PoolFlags from the flag set of this data pool.

New in version 0.15.0.

reset_extra_data_locations()

Remove all explicitly added metadata locations.

New in version 0.15.0.

search(search)
Parameters:

search (str) – A search string

Returns:

an AppStream.ComponentBox of the found components.

Return type:

AppStream.ComponentBox

Search for a list of components matching the search term. The list will be ordered by match score.

New in version 0.9.7.

set_flags(flags)
Parameters:

flags (AppStream.PoolFlags) – The new AppStream.PoolFlags.

Set the AppStream.PoolFlags for this data pool.

set_load_std_data_locations(enabled)
Parameters:

enabled (bool) – Whether loading of data from standard locations should be enabled.

This is a convenience function that enables or disables loading of metadata from well-known standard locations by configuring the AppStream.PoolFlags of this AppStream.Pool accordingly. Data affected by this includes the OS data catalog, metainfo, desktop-entry files and Flatpak data. If you need more fine-grained control, set the AppStream.PoolFlags explicitly.

New in version 0.15.0.

set_locale(locale)
Parameters:

locale (str) – the BCP47 or POSIX locale to use for this pool.

Sets the current locale which should be used when parsing metadata.

do_changed() virtual

Signal Details

AppStream.Pool.signals.changed(pool)
Signal Name:

changed

Flags:

RUN_LAST

Parameters:

pool (AppStream.Pool) – The object which received the signal

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

New in version 0.15.0.