![]() |
![]() |
![]() |
![]() |
#define | AS_TYPE_POOL |
struct | AsPoolClass |
enum | AsPoolFlags |
enum | AsCacheFlags |
enum | AsPoolError |
#define | AS_POOL_ERROR |
AsPool |
This class loads AppStream metadata from various sources and refines it with existing knowledge about the system (e.g. by setting absolute paths for cached icons). An AsPool will use an on-disk cache to store metadata is has read and refined to speed up the loading time when the same data is requested a second time.
You can find AppStream metadata matching various user-defined criteria, and also add new metadata to the pool. The caching behavior can be controlled by the application using AsCacheFlags.
An AppStream cache object can also be created and read using the appstreamcli(1) utility.
This class is threadsafe.
See also: AsComponent
const gchar *
as_pool_get_locale (AsPool *pool
);
Gets the currently used locale.
void as_pool_set_locale (AsPool *pool
,const gchar *locale
);
Sets the current locale which should be used when parsing metadata.
gboolean as_pool_load (AsPool *pool
,GCancellable *cancellable
,GError **error
);
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.
void as_pool_load_async (AsPool *pool
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Asynchronously loads data from all registered locations.
Equivalent to as_pool_load()
(but asynchronous)
pool |
An instance of AsPool. |
|
cancellable |
a GCancellable. |
|
callback |
||
user_data |
Data to pass to |
Since: 0.12.10
gboolean as_pool_load_finish (AsPool *pool
,GAsyncResult *result
,GError **error
);
Retrieve the result of as_pool_load_async()
.
Since: 0.12.10
void
as_pool_clear (AsPool *pool
);
Remove all metadata from the pool, data will be reloaded
once as_pool_load
is called again.
gboolean as_pool_add_components (AsPool *pool
,AsComponentBox *cbox
,GError **error
);
Register a set of components with the pool temporarily. Data from components added like this will not be cached.
Since: 0.15.0
AsComponentBox *
as_pool_get_components (AsPool *pool
);
Get a list of found components.
AsComponentBox * as_pool_get_components_by_id (AsPool *pool
,const gchar *cid
);
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.
AsComponentBox * as_pool_get_components_by_provided_item (AsPool *pool
,AsProvidedKind kind
,const gchar *item
);
Find components in the AppStream data pool which provide a certain item.
AsComponentBox * as_pool_get_components_by_kind (AsPool *pool
,AsComponentKind kind
);
Return a list of all components in the pool which are of a certain kind.
AsComponentBox * as_pool_get_components_by_categories (AsPool *pool
,gchar **categories
);
Return a list of components which are in all of the categories.
pool |
An instance of AsDatabase. |
|
categories |
An array of XDG categories to include. |
[array zero-terminated=1] |
AsComponentBox * as_pool_get_components_by_launchable (AsPool *pool
,AsLaunchableKind kind
,const gchar *id
);
Find components in the AppStream data pool which provide a specific launchable. See AsLaunchable for details on launchables, or refer to the AppStream specification.
Since: 0.11.4
AsComponentBox * as_pool_get_components_by_extends (AsPool *pool
,const gchar *extended_id
);
Find components extending the component with the given ID. They can then be registered to the
AsComponent they extend via as_component_add_addon
.
If the AS_POOL_FLAG_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).
pool |
An instance of AsPool. |
|
extended_id |
The ID of the component to search extensions for. |
Since: 0.15.0
AsComponentBox * as_pool_get_components_by_bundle_id (AsPool *pool
,AsBundleKind kind
,const gchar *bundle_id
,gboolean match_prefix
);
Find components that are provided by a bundle with a specific ID by its prefix. For example, given a AS_BUNDLE_KIND_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.
Since: 0.16.0
AsComponentBox * as_pool_search (AsPool *pool
,const gchar *search
);
Search for a list of components matching the search term. The list will be ordered by match score.
Since: 0.9.7
gchar ** as_pool_build_search_tokens (AsPool *pool
,const gchar *search
);
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.
void
as_pool_reset_extra_data_locations (AsPool *pool
);
Remove all explicitly added metadata locations.
Since: 0.15.0
void as_pool_add_extra_data_location (AsPool *pool
,const gchar *directory
,AsFormatStyle format_style
);
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.
pool |
An instance of AsPool. |
|
directory |
An existing filesystem location. |
|
format_style |
The expected format style of the metadata, e.g. |
AsPoolFlags
as_pool_get_flags (AsPool *pool
);
Get the AsPoolFlags for this data pool.
void as_pool_set_flags (AsPool *pool
,AsPoolFlags flags
);
Set the AsPoolFlags for this data pool.
void as_pool_add_flags (AsPool *pool
,AsPoolFlags flags
);
Convenience function to add one or multiple AsPoolFlags to the flag set of this data pool.
Since: 0.15.0
void as_pool_remove_flags (AsPool *pool
,AsPoolFlags flags
);
Convenience function to remove one or multiple AsPoolFlags from the flag set of this data pool.
Since: 0.15.0
void as_pool_set_load_std_data_locations (AsPool *pool
,gboolean enabled
);
This is a convenience function that enables or disables loading of metadata from well-known standard locations by configuring the AsPoolFlags of this AsPool 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 AsPoolFlags explicitly.
pool |
An instance of AsPool. |
|
enabled |
Whether loading of data from standard locations should be enabled. |
Since: 0.15.0
struct AsPoolClass { GObjectClass parent_class; void (*changed) (AsPool *pool); };
Flags controlling the metadata pool behavior.
No flags. |
||
Load AppStream catalog metadata from OS locations. |
||
Load MetaInfo data from OS locations. |
||
Load components from desktop-entry files in OS locations. |
||
Load AppStream catalog metadata from Flatpak. |
||
Load fresh data even if an up-o-date cache is available. |
||
Always resolve addons for returned components. |
||
Prefer local metainfo data over the system-provided catalog data. Useful for previewing local data. |
||
Monitor registered directories for changes, and auto-reload metadata if necessary. |
Flags on how caching should be used.
A metadata pool error.