Top |
#define | AS_TYPE_COMPONENT |
struct | AsComponentClass |
enum | AsComponentKind |
#define | AS_COMPONENT_KIND_INPUTMETHOD |
enum | AsMergeKind |
enum | AsComponentScope |
enum | AsValueFlags |
enum | AsSearchTokenMatch |
#define | AS_SEARCH_TOKEN_MATCH_MIMETYPE |
enum | AsReleasesKind |
AsComponent |
This object represents an Appstream software component which is associated to a package in the distribution's repositories. A component can be anything, ranging from an application to a font, a codec or even a non-visual software project providing libraries and python-modules for other applications to use.
The type of the component is stored as AsComponentKind and can be queried to find out which kind of component we're dealing with.
See also: AsProvidesKind, AsDatabase
const gchar *
as_component_kind_to_string (AsComponentKind kind
);
Converts the enumerated value to an text representation.
AsComponentKind
as_component_kind_from_string (const gchar *kind_str
);
Converts the text representation to an enumerated value.
const gchar *
as_merge_kind_to_string (AsMergeKind kind
);
Converts the enumerated value to an text representation.
AsMergeKind
as_merge_kind_from_string (const gchar *kind_str
);
Converts the text representation to an enumerated value.
const gchar *
as_component_scope_to_string (AsComponentScope scope
);
Converts the enumerated value to an text representation.
AsComponentScope
as_component_scope_from_string (const gchar *scope_str
);
Converts the text representation to an enumerated value.
const gchar *
as_releases_kind_to_string (AsReleasesKind kind
);
Converts the enumerated value to an text representation.
Since: 0.16.0
AsReleasesKind
as_releases_kind_from_string (const gchar *kind_str
);
Converts the text representation to an enumerated value.
Since: 0.16.0
void as_component_set_value_flags (AsComponent *cpt
,AsValueFlags flags
);
const gchar *
as_component_get_active_locale (AsComponent *cpt
);
Get the current active locale for this component, which is used to get localized messages.
void as_component_set_active_locale (AsComponent *cpt
,const gchar *locale
);
Set the current active locale for this component, which is used to get localized messages. If the AsComponent was fetched from a localized database, usually only one locale is available.
const gchar *
as_component_get_id (AsComponent *cpt
);
Get the unique AppStream identifier for this component. This ID is unique for the described component, but does not uniquely identify the metadata set.
For a unique ID for this metadata set in the current
session, use as_component_get_data_id
()
void as_component_set_id (AsComponent *cpt
,const gchar *value
);
Set the AppStream identifier for this component.
const gchar *
as_component_get_data_id (AsComponent *cpt
);
Get a unique identifier for this metadata set. This unique ID is only valid for the current session, as opposed to the AppStream ID which uniquely identifies a software component.
The format of the unique id usually is: %{scope}/%{origin}/%{distribution_system}/%{appstream_id}
For example: system/os/package/org.example.FooBar
void as_component_set_data_id (AsComponent *cpt
,const gchar *value
);
Set the session-specific unique metadata identifier for this component. If two components have a different data_id but the same ID, they will be treated as independent sets of metadata describing the same component type.
AsComponentKind
as_component_get_kind (AsComponent *cpt
);
Returns the AsComponentKind of this component.
void as_component_set_kind (AsComponent *cpt
,AsComponentKind value
);
Sets the AsComponentKind of this component.
const gchar *
as_component_get_date_eol (AsComponent *cpt
);
Gets the end-of-life date for the entire component.
Since: 0.15.2
void as_component_set_date_eol (AsComponent *cpt
,const gchar *date
);
Sets an end-of-life date for this component.
Since: 0.15.2
guint64
as_component_get_timestamp_eol (AsComponent *cpt
);
Gets the UNIX timestamp for the date when this component is out of support (end-of-life) and will receive no more updates, not even security fixes.
Since: 0.15.2
const gchar *
as_component_get_branch (AsComponent *cpt
);
Gets the branch for the application.
Since: 0.14.0
void as_component_set_branch (AsComponent *cpt
,const gchar *branch
);
Set the branch that the component instance was sourced from.
Since: 0.14.0
void as_component_set_scope (AsComponent *cpt
,AsComponentScope scope
);
Sets the AsComponentScope of this component.
gchar *
as_component_get_pkgname (AsComponent *cpt
);
Get the first package name of the list of packages that need to be installed for this component to be present on the system. Since most components consist of only one package, this is safe to use for about 90% of all cases.
However, to support a component fully, please use as_component_get_pkgnames
() for
getting all packages that need to be installed, and use this method only to
e.g. get the main package to perform a quick "is it installed?" check.
gchar **
as_component_get_pkgnames (AsComponent *cpt
);
Get a list of package names which this component consists of. This usually is just one package name.
void as_component_set_pkgnames (AsComponent *cpt
,gchar **packages
);
Set a list of package names this component consists of. (This should usually be just one package name)
void as_component_set_pkgname (AsComponent *cpt
,const gchar *pkgname
);
Set the package name that provides this component.
Since: 0.14.5
const gchar *
as_component_get_source_pkgname (AsComponent *cpt
);
void as_component_set_source_pkgname (AsComponent *cpt
,const gchar *spkgname
);
const gchar *
as_component_get_name (AsComponent *cpt
);
A human-readable name for this component.
void as_component_set_name (AsComponent *cpt
,const gchar *value
,const gchar *locale
);
Set a human-readable name for this component.
cpt |
A valid AsComponent |
|
value |
The name |
|
locale |
The locale the used for this value, or |
[nullable] |
const gchar *
as_component_get_summary (AsComponent *cpt
);
Get a short description of this component.
void as_component_set_summary (AsComponent *cpt
,const gchar *value
,const gchar *locale
);
Set a short description for this component.
cpt |
A valid AsComponent |
|
value |
The summary |
|
locale |
The locale the used for this value, or |
[nullable] |
const gchar *
as_component_get_description (AsComponent *cpt
);
Get the localized long description of this component.
void as_component_set_description (AsComponent *cpt
,const gchar *value
,const gchar *locale
);
Set long description for this component.
cpt |
A valid AsComponent |
|
value |
The long description |
|
locale |
The locale the used for this value, or |
[nullable] |
GPtrArray *
as_component_get_launchables (AsComponent *cpt
);
Since: 0.11.0
AsLaunchable * as_component_get_launchable (AsComponent *cpt
,AsLaunchableKind kind
);
Gets a AsLaunchable of a specific type that contains launchable entries for this component.
Since: 0.11.0
void as_component_add_launchable (AsComponent *cpt
,AsLaunchable *launchable
);
Adds a AsLaunchable containing launchables entries for this component.
Since: 0.11.0
const gchar *
as_component_get_metadata_license (AsComponent *cpt
);
The license the metadata iself is subjected to.
void as_component_set_metadata_license (AsComponent *cpt
,const gchar *value
);
Set the license this metadata is licensed under.
const gchar *
as_component_get_project_license (AsComponent *cpt
);
Get the license of the project this component belongs to.
void as_component_set_project_license (AsComponent *cpt
,const gchar *value
);
Set the project license.
const gchar *
as_component_get_project_group (AsComponent *cpt
);
Get the component's project group.
void as_component_set_project_group (AsComponent *cpt
,const gchar *value
);
Set the component's project group.
const gchar *
as_component_get_developer_name (AsComponent *cpt
);
Get the component's developer or development team name.
void as_component_set_developer_name (AsComponent *cpt
,const gchar *value
,const gchar *locale
);
Set the the component's developer or development team name.
cpt |
a AsComponent instance. |
|
value |
the developer or developer team name |
|
locale |
the locale, or |
[nullable] |
GPtrArray *
as_component_get_compulsory_for_desktops
(AsComponent *cpt
);
void as_component_set_compulsory_for_desktop (AsComponent *cpt
,const gchar *desktop
);
Mark this component to be compulsory for the specified desktop environment.
gboolean as_component_is_compulsory_for_desktop (AsComponent *cpt
,const gchar *desktop
);
Check if this component is compulsory for the given desktop.
void as_component_add_category (AsComponent *cpt
,const gchar *category
);
Add a category.
gboolean as_component_has_category (AsComponent *cpt
,const gchar *category
);
Check if component is in the specified category.
GPtrArray *
as_component_get_screenshots (AsComponent *cpt
);
Get a list of associated screenshots.
void as_component_add_screenshot (AsComponent *cpt
,AsScreenshot *sshot
);
Add an AsScreenshot to this component.
void as_component_set_keywords (AsComponent *cpt
,gchar **value
,const gchar *locale
);
Set keywords for this component.
cpt |
a AsComponent instance. |
|
value |
String-array of keywords. |
[array zero-terminated=1] |
locale |
Locale of the values, or |
[nullable] |
AsIcon * as_component_get_icon_by_size (AsComponent *cpt
,guint width
,guint height
);
Gets an icon matching the size constraints.
The icons are not filtered by type, and the first icon
which matches the size is returned.
If you want more control over which icons you use for displaying,
use the as_component_get_icons
() function to get a list of all icons.
Note that this function is not HiDPI aware! It will never return an icon with a scaling factor > 1.
cpt |
an AsComponent instance |
|
width |
The icon width in pixels. |
|
height |
the icon height in pixels. |
AsIcon *
as_component_get_icon_stock (AsComponent *cpt
);
Gets a stock icon for this component if one is associated with it.
Will return NULL
otherwise.
void as_component_add_icon (AsComponent *cpt
,AsIcon *icon
);
Add an icon to this component.
GPtrArray *
as_component_get_provided (AsComponent *cpt
);
Get a list of AsProvided objects associated with this component.
void as_component_add_provided (AsComponent *cpt
,AsProvided *prov
);
Add a set of provided items to this component.
Since: 0.6.2
AsProvided * as_component_get_provided_for_kind (AsComponent *cpt
,AsProvidedKind kind
);
Get an AsProvided object for the given interface type, containing information about the public interfaces (mimetypes, firmware, DBus services, ...) this component provides.
cpt |
a AsComponent instance. |
|
kind |
kind of the provided item, e.g. |
void as_component_add_provided_item (AsComponent *cpt
,AsProvidedKind kind
,const gchar *item
);
Adds a provided item to the component with the given kind
, creating a new
AsProvided
for this kind internally if necessary.
cpt |
a AsComponent instance. |
|
kind |
the kind of the provided item (e.g. |
|
item |
the item to add. |
const gchar * as_component_get_url (AsComponent *cpt
,AsUrlKind url_kind
);
Gets a URL.
Since: 0.6.2
void as_component_add_url (AsComponent *cpt
,AsUrlKind url_kind
,const gchar *url
);
Adds some URL data to the component.
cpt |
a AsComponent instance. |
|
url_kind |
the URL kind, e.g. |
|
url |
the full URL. |
Since: 0.6.2
gboolean as_component_load_releases_from_bytes (AsComponent *cpt
,GBytes *bytes
,GError **error
);
Load release information from XML bytes.
Since: 0.16.0
gboolean as_component_load_releases (AsComponent *cpt
,gboolean reload
,gboolean allow_net
,GError **error
);
Load data from an external source, possibly a local file or a network resource.
cpt |
a AsComponent instance. |
|
reload |
set to |
|
allow_net |
allow fetching release data from the internet. |
|
error |
a GError. |
Since: 0.16.0
GPtrArray *
as_component_get_releases (AsComponent *cpt
);
Get an array of the AsRelease items this component provides.
void as_component_add_release (AsComponent *cpt
,AsRelease *release
);
Add an AsRelease to this component.
AsReleasesKind
as_component_get_releases_kind (AsComponent *cpt
);
Returns the AsReleasesKind of the release metadata associated with this component.
Since: 0.16.0
void as_component_set_releases_kind (AsComponent *cpt
,AsReleasesKind kind
);
Sets the AsReleasesKind of the release metadata associated with this component.
Since: 0.16.0
const gchar *
as_component_get_releases_url (AsComponent *cpt
);
Get a remote URL to obtain release information for the component.
Since: 0.16.0
void as_component_set_releases_url (AsComponent *cpt
,const gchar *url
);
Set a remote URL pointing to an AppStream release info file.
Since: 0.16.0
GPtrArray *
as_component_get_extends (AsComponent *cpt
);
Returns a string list of IDs of components which are extended by this addon.
See as_component_get_extends
() for the reverse.
Since: 0.15.5
void as_component_add_extends (AsComponent *cpt
,const gchar *cpt_id
);
Add a reference to the extended component
cpt |
a AsComponent instance. |
|
cpt_id |
The id of a component which is extended by this component |
Since: 0.15.5
GPtrArray *
as_component_get_addons (AsComponent *cpt
);
Returns a list of AsComponent objects which are addons extending this component in functionality.
This is the reverse of as_component_get_extends
()
Since: 0.9.2
void as_component_add_addon (AsComponent *cpt
,AsComponent *addon
);
Add a reference to the addon that is enhancing this component.
Since: 0.9.2
GList *
as_component_get_languages (AsComponent *cpt
);
Get a list of all languages.
Since: 0.7.0
gint as_component_get_language (AsComponent *cpt
,const gchar *locale
);
Gets the translation coverage in percent for a specific locale
Since: 0.7.0
void as_component_add_language (AsComponent *cpt
,const gchar *locale
,gint percentage
);
Adds a language to the component.
cpt |
an AsComponent instance. |
|
locale |
the locale, or |
[nullable] |
percentage |
the percentage completion of the translation, 0 for locales with unknown amount of translation |
Since: 0.7.0
void
as_component_clear_languages (AsComponent *cpt
);
Remove all registered language translation information.
Since: 0.14.5
GPtrArray *
as_component_get_translations (AsComponent *cpt
);
Get a GPtrArray of AsTranslation objects describing the translation systems and translation-ids (e.g. Gettext domains) used by this software component.
Only set for metainfo files.
Since: 0.9.2
void as_component_add_translation (AsComponent *cpt
,AsTranslation *tr
);
Assign an AsTranslation object describing the translation system used by this component.
Since: 0.9.2
GPtrArray *
as_component_get_bundles (AsComponent *cpt
);
Get a list of all software bundles associated with this component.
Since: 0.10
AsBundle * as_component_get_bundle (AsComponent *cpt
,AsBundleKind bundle_kind
);
Gets a bundle identifier string.
Since: 0.8.0
void as_component_add_bundle (AsComponent *cpt
,AsBundle *bundle
);
Adds a bundle to the component.
Since: 0.8.0
GPtrArray *
as_component_get_suggested (AsComponent *cpt
);
Get a list of associated suggestions.
void as_component_add_suggested (AsComponent *cpt
,AsSuggested *suggested
);
Add an AsSuggested to this component.
GPtrArray *
as_component_get_search_tokens (AsComponent *cpt
);
Returns all search tokens for this component.
Since: 0.9.7
guint as_component_search_matches (AsComponent *cpt
,const gchar *term
);
Searches component data for a specific keyword.
Since: 0.9.7
guint as_component_search_matches_all (AsComponent *cpt
,gchar **terms
);
Searches component data for all the specific keywords.
Since: 0.9.8
AsMergeKind
as_component_get_merge_kind (AsComponent *cpt
);
Get the merge method which should apply to duplicate components with this ID.
Since: 0.9.8
void as_component_set_merge_kind (AsComponent *cpt
,AsMergeKind kind
);
Sets the AsMergeKind for this component.
Since: 0.9.8
gboolean as_component_is_member_of_category (AsComponent *cpt
,AsCategory *category
);
Test if the component cpt
is a member of category category
.
gboolean
as_component_is_valid (AsComponent *cpt
);
Check if the essential properties of this Component are populated with useful data.
gchar *
as_component_to_string (AsComponent *cpt
);
Returns a string identifying this component. (useful for debugging)
gint
as_component_get_priority (AsComponent *cpt
);
Returns the priority of this component. This method is used internally.
Since: 0.6.1
void as_component_set_priority (AsComponent *cpt
,gint priority
);
Sets the priority of this component. This method is used internally.
Since: 0.6.1
const gchar * as_component_get_custom_value (AsComponent *cpt
,const gchar *key
);
Retrieve value for a custom data entry with the given key.
Since: 0.10.5
gboolean as_component_insert_custom_value (AsComponent *cpt
,const gchar *key
,const gchar *value
);
Add a key and value pair to the custom data table.
Since: 0.10.5
GPtrArray *
as_component_get_content_ratings (AsComponent *cpt
);
Gets all content ratings defined for this software.
Since: 0.11.0
AsContentRating * as_component_get_content_rating (AsComponent *cpt
,const gchar *kind
);
Gets a content ratings of a specific type that are defined for this component.
Since: 0.11.0
void as_component_add_content_rating (AsComponent *cpt
,AsContentRating *content_rating
);
Adds a content rating to this component.
Since: 0.11.0
GPtrArray *
as_component_get_requires (AsComponent *cpt
);
Get an array of items that are required by this component.
Since: 0.12.0
GPtrArray *
as_component_get_recommends (AsComponent *cpt
);
Get an array of items that are recommended by this component.
Since: 0.12.0
GPtrArray *
as_component_get_supports (AsComponent *cpt
);
Get an array of items that are supported by this component, e.g. to indicate support for a specific piece of hardware.
Since: 0.15.0
void as_component_add_relation (AsComponent *cpt
,AsRelation *relation
);
Adds a AsRelation to set a recommends or requires relation of
component cpt
on the item mentioned in the AsRelation.
Since: 0.12.0
GPtrArray *
as_component_get_replaces (AsComponent *cpt
);
Get a list of component IDs of components that this software replaces entirely.
void as_component_add_replaces (AsComponent *cpt
,const gchar *cid
);
Add the component ID of a component that gets replaced by the current component.
GPtrArray *
as_component_get_agreements (AsComponent *cpt
);
Get a list of all agreements registered with this software component.
Since: 0.15.0
void as_component_add_agreement (AsComponent *cpt
,AsAgreement *agreement
);
Adds an agreement to the software component.
Since: 0.12.1
AsAgreement * as_component_get_agreement_by_kind (AsComponent *cpt
,AsAgreementKind kind
);
Gets an agreement the component has specified for the particular kind.
Since: 0.12.1
AsBranding *
as_component_get_branding (AsComponent *cpt
);
Get the branding associated with this component, or NULL
in case this component has no special branding.
Since: 0.15.2
void as_component_set_branding (AsComponent *cpt
,AsBranding *branding
);
Set branding for this component.
Since: 0.15.2
void
as_component_clear_tags (AsComponent *cpt
);
Remove all tags associated with this component.
Since: 0.15.0
gboolean as_component_add_tag (AsComponent *cpt
,const gchar *ns
,const gchar *tag
);
Add a tag to this component.
Since: 0.15.0
gboolean as_component_remove_tag (AsComponent *cpt
,const gchar *ns
,const gchar *tag
);
Remove a tag from this component
Since: 0.15.0
gboolean as_component_has_tag (AsComponent *cpt
,const gchar *ns
,const gchar *tag
);
Test if the component is tagged with the selected tag.
Since: 0.15.0
const gchar *
as_component_get_name_variant_suffix (AsComponent *cpt
);
Get variant suffix for the component name (only to be displayed if two components have the same name).
Since: 0.12.10
void as_component_set_name_variant_suffix (AsComponent *cpt
,const gchar *value
,const gchar *locale
);
Set a variant suffix for the component name (only to be displayed if components have the same name).
cpt |
a AsComponent instance. |
|
value |
the developer or developer team name |
|
locale |
the locale, or |
[nullable] |
Since: 0.12.10
guint
as_component_get_sort_score (AsComponent *cpt
);
Returns the sorting priority of this component.
This will only return a valid value if this component was the result of or involved in a search operation which returned sorted results. In most cases you will not need to access this value explicitly, as all results of search operations in AppStream are already sorted from best match to worst.
The returned value is an arbitrary integer value, valid only for the search terms involved in the search operation that yielded this component as a result.
Since: 0.12.11
void as_component_set_sort_score (AsComponent *cpt
,guint score
);
Sets the sorting score of this component.
Since: 0.9.8
GPtrArray *
as_component_get_reviews (AsComponent *cpt
);
Gets any reviews associated with the component.
Since: 0.14.0
void as_component_add_review (AsComponent *cpt
,AsReview *review
);
Adds a user review to a software component.
Since: 0.14.0
AsContext *
as_component_get_context (AsComponent *cpt
);
Get the AsContext associated with this component.
This function may return NULL
if no context is set
(which will be the case if the component was not loaded from
a file or cache but constructed in memory).
Since: 0.11.2
GHashTable *
as_component_get_name_table (AsComponent *cpt
);
Get the internal locale to component name mapping table.
GHashTable *
as_component_get_summary_table (AsComponent *cpt
);
Get the internal locale to component summary mapping table.
GHashTable *
as_component_get_keywords_table (AsComponent *cpt
);
Retrieve the internal hash table mapping languages to keword arrays.
gboolean
as_component_is_free (AsComponent *cpt
);
Returns TRUE
if this component is free and open source software.
To determine this status, this function will check if it comes
from a vetted free-software-only source or whether its licenses
are only free software licenses.
Since: 0.15.5
gboolean as_component_load_from_bytes (AsComponent *cpt
,AsContext *context
,AsFormatKind format
,GBytes *bytes
,GError **error
);
Load metadata for this component from an XML string. You normally do not want to use this method directly and instead use the more convenient API of AsMetadata to create and update components.
If this function returns TRUE
, a valid component is returned unless the selected
format was AS_FORMAT_KIND_DESKTOP_ENTRY
, in which case a component ID will have to
be set explicitly by the caller in order to make the component valid.
cpt |
an AsComponent instance. |
|
context |
an AsContext instance. |
|
format |
the format of the data to load, e.g. |
|
bytes |
the data to load. |
|
error |
a GError. |
Since: 0.14.0
gchar * as_component_to_xml_data (AsComponent *cpt
,AsContext *context
,GError **error
);
Serialize this component into an XML string. You normally do not want to use this method directly and instead use the more convenient API of AsMetadata to serialize components.
Since: 0.12.10
const gchar *
as_component_get_desktop_id (AsComponent *cpt
);
as_component_get_desktop_id
has been deprecated since version 0.11.0 and should not be used in newly-written code.
Replaced by AsLaunchable and as_component_get_launchable
Get the Desktop Entry ID for this component, if it is of type "desktop-application". For most desktop-application components, this is the name of the .desktop file.
Refer to https://specifications.freedesktop.org/desktop-entry-spec/latest/ape.html for more information.
Since: 0.9.8
gboolean as_component_load_from_xml_data (AsComponent *cpt
,AsContext *context
,const gchar *data
,GError **error
);
as_component_load_from_xml_data
is deprecated and should not be used in newly-written code.
Load metadata for this component from an XML string. You normally do not want to use this method directly and instead use the more convenient API of AsMetadata to create and update components.
cpt |
an AsComponent instance. |
|
context |
an AsContext instance. |
|
data |
The XML data to load. |
|
error |
a GError. |
Since: 0.12.10
The type of an AsComponent.
Type invalid or not known |
||
A generic (= without specialized type) component |
||
An application with a .desktop-file |
||
A console application |
||
A web application |
||
An extension of existing software, which does not run standalone |
||
A font |
||
A multimedia codec |
||
An input-method provider |
||
Firmware |
||
A driver |
||
Software localization (usually l10n resources) |
||
A system service launched by the init system |
||
A remote software or data source |
||
A computer operating system |
||
An icon theme following the XDG specification |
||
An application runtime platform |
Set how values assigned to an AsComponent should be treated when they are set or retrieved.
The token match kind, which we want to be exactly 16 bits for storage reasons.
#define AS_SEARCH_TOKEN_MATCH_MIMETYPE AS_SEARCH_TOKEN_MATCH_MEDIATYPE