Top | ![]() |
![]() |
![]() |
![]() |
#define | AS_TYPE_COMPONENT |
struct | AsComponentClass |
enum | AsComponentKind |
enum | AsMergeKind |
enum | AsComponentScope |
enum | AsValueFlags |
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.
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.
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)
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. |
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. |
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
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.
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.7.0
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.7.0
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
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)
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_recommends (AsComponent *cpt
);
Get an array of items that are recommended by this component.
Since: 0.12.0
GPtrArray *
as_component_get_requires (AsComponent *cpt
);
Get an array of items that are required by this component.
Since: 0.12.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
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
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
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 remote software or data source |
Set how values assigned to an AsComponent should be treated when they are set or retrieved.