AppStreamGlib.Store¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
Properties¶
None
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The |
|
The |
|
The |
|
The |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class AppStreamGlib.Store(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new()[source]¶
- Returns:
- Return type:
Creates a new
AppStreamGlib.Store
.New in version 0.1.0.
- add_app(app)[source]¶
- Parameters:
app (
AppStreamGlib.App
) – aAppStreamGlib.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
) – aAppStreamGlib.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
) – theAppStreamGlib.IconKind
, e.g.AppStreamGlib.IconKind.EMBEDDED
.- Raises:
- Returns:
True
for success- Return type:
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:
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:
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:
bytes (
GLib.Bytes
) – aGLib.Bytes
.cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
.
- Raises:
- Returns:
True
for success- Return type:
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:
icon_root (
str
orNone
) – the icon path, orNone
for the default (unused)cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
.
- Raises:
- Returns:
True
for success- Return type:
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. OtherGLib.IOErrors
andAppStreamGlib.StoreErrors
may be returned as appropriate.New in version 0.1.0.
- from_xml(data, icon_root)[source]¶
- Parameters:
- Raises:
- Returns:
True
for success- Return type:
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:
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:
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
orNone
- Return type:
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
orNone
- Return type:
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
orNone
- Return type:
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:
kind (
AppStreamGlib.LaunchableKind
) – theAppStreamGlib.LaunchableKind
value (
str
) – the provide value, e.g. “gimp.desktop”
- Returns:
a
AppStreamGlib.App
orNone
- Return type:
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
orNone
- Return type:
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
orNone
- Return type:
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:
kind (
AppStreamGlib.ProvideKind
) – theAppStreamGlib.ProvideKind
value (
str
) – the provide value, e.g. “com.hughski.ColorHug2.firmware”
- Returns:
a
AppStreamGlib.App
orNone
- Return type:
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:
unique_id (
str
) – the application unique ID, e.g.user/flatpak/gnome-apps-nightly/app/gimp.desktop/master
search_flags (
int
) – the search flags, e.g.AppStreamGlib.StoreSearchFlags.USE_WILDCARDS
- Returns:
a
AppStreamGlib.App
orNone
- Return type:
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:
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:
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:
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:
- Returns:
an array
- Return type:
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:
kind (
AppStreamGlib.ProvideKind
) – theAppStreamGlib.ProvideKind
value (
str
) – the provide value, e.g. “com.hughski.ColorHug2.firmware”
- Returns:
an array of applications
- Return type:
Finds any applications in the store by something that they provides.
New in version 0.7.5.
- get_builder_id()[source]¶
-
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_origin()[source]¶
-
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:
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:
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:
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:
Gets the flags used for adding files to the store.
New in version 0.4.2.
- load(flags, cancellable)[source]¶
- Parameters:
flags (
int
) –AppStreamGlib.StoreLoadFlags
, e.g.AppStreamGlib.StoreLoadFlags.APP_INFO_SYSTEM
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
.
- Raises:
- Returns:
True
for success- Return type:
Loads the store from the default locations.
New in version 0.1.2.
- load_async(flags, cancellable, callback, *user_data)[source]¶
- Parameters:
flags (
AppStreamGlib.StoreLoadFlags
) –AppStreamGlib.StoreLoadFlags
, e.g.AppStreamGlib.StoreLoadFlags.APP_INFO_SYSTEM
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
.callback (
Gio.AsyncReadyCallback
orNone
) – AGio.AsyncReadyCallback
Asynchronously loads the store from the default locations.
New in version 0.7.11.
- load_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – AGio.AsyncResult
- Raises:
- Returns:
True
for success- Return type:
Retrieve the result of
AppStreamGlib.Store.load_async
().New in version 0.7.11.
- load_path(path, cancellable)[source]¶
- Parameters:
path (
str
) – A path to loadcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
.
- Raises:
- Returns:
True
for success- Return type:
Loads the store from a specific path.
New in version 0.2.2.
- load_path_async(path, cancellable, callback, *user_data)[source]¶
- Parameters:
path (
str
) – A path to loadcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
.callback (
Gio.AsyncReadyCallback
orNone
) – AGio.AsyncReadyCallback
Asynchronously loads the store from a specific path.
New in version 0.7.11.
- load_path_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – AGio.AsyncResult
- Raises:
- Returns:
True
for success- Return type:
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 theAppStreamGlib.App
object if it has not already been generated.New in version 0.6.5.
- remove_app(app)[source]¶
- Parameters:
app (
AppStreamGlib.App
) – aAppStreamGlib.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
) – aAppStreamGlib.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
) – theAppStreamGlib.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
) – theAppStreamGlib.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
) – theAppStreamGlib.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:
file (
Gio.File
) – fileflags (
int
) – theAppStreamGlib.NodeToXmlFlags
, e.g.AppStreamGlib.NodeToXmlFlags.NONE
.cancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
, orNone
- Raises:
- Returns:
- Return type:
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
) – theAppStreamGlib.NodeToXmlFlags
, e.g.AppStreamGlib.NodeToXmlFlags.NONE
.- Returns:
- Return type:
Outputs an XML representation of all the applications in the store.
New in version 0.1.0.
- validate(flags)[source]¶
- Parameters:
flags (
int
) – theAppStreamGlib.AppValidateFlags
to use, e.g.AppStreamGlib.AppValidateFlags.NONE
- Raises:
- Returns:
A list of problems, or
None
- Return type:
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:
- Parameters:
store (
AppStreamGlib.Store
) – The object which received the signalapp (
AppStreamGlib.App
) – theAppStreamGlib.App
instance
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:
- Parameters:
store (
AppStreamGlib.Store
) – The object which received the signalapp (
AppStreamGlib.App
) – theAppStreamGlib.App
instance
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:
- Parameters:
store (
AppStreamGlib.Store
) – The object which received the signalapp (
AppStreamGlib.App
) – theAppStreamGlib.App
instance
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:
- 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.