AsContext

AsContext — Context of an AppStream metadata document

Functions

Types and Values

Includes

#include <appstream.h>

Description

Contains information about the context of AppStream metadata, from the root node of the document. Instances of AsContext may be shared between AsComponent instances.

You usually do not want to use this directly, but use the more convenient AsMetadata instead.

See also: AsComponent, AsMetadata

Functions

as_format_version_to_string ()

const gchar *
as_format_version_to_string (AsFormatVersion version);

Converts the enumerated value to an text representation.

Parameters

version

the AsFormatKind.

 

Returns

string version of version

Since: 0.10.0

as_format_version_from_string ()

AsFormatVersion
as_format_version_from_string (const gchar *version_str);

Converts the text representation to an enumerated value.

Parameters

version_str

the string.

 

Returns

a AsFormatVersion. For unknown, the highest version number is assumed.

Since: 0.10.0

as_format_kind_to_string ()

const gchar *
as_format_kind_to_string (AsFormatKind kind);

Converts the enumerated value to an text representation.

Parameters

kind

the AsFormatKind.

 

Returns

string version of kind

Since: 0.10.0

as_format_kind_from_string ()

AsFormatKind
as_format_kind_from_string (const gchar *kind_str);

Converts the text representation to an enumerated value.

Parameters

kind_str

the string.

 

Returns

a AsFormatKind or AS_FORMAT_KIND_UNKNOWN for unknown

Since: 0.10.0

as_context_new ()

AsContext *
as_context_new (void);

Creates a new AsContext.

Returns

an AsContext.

[transfer full]

as_context_get_format_version ()

AsFormatVersion
as_context_get_format_version (AsContext *ctx);

Parameters

ctx

a AsContext instance.

 

Returns

The AppStream format version.

as_context_set_format_version ()

void
as_context_set_format_version (AsContext *ctx,
                               AsFormatVersion ver);

Sets the AppStream format version.

Parameters

ctx

a AsContext instance.

 

ver

the new format version.

 

as_context_get_style ()

AsFormatStyle
as_context_get_style (AsContext *ctx);

Parameters

ctx

a AsContext instance.

 

Returns

The document style.

as_context_set_style ()

void
as_context_set_style (AsContext *ctx,
                      AsFormatStyle style);

Sets the AppStream document style.

Parameters

ctx

a AsContext instance.

 

style

the new document style.

 

as_context_get_priority ()

gint
as_context_get_priority (AsContext *ctx);

Parameters

ctx

a AsContext instance.

 

Returns

The data priority.

as_context_set_priority ()

void
as_context_set_priority (AsContext *ctx,
                         gint priority);

Sets the data priority.

Parameters

ctx

a AsContext instance.

 

priority

the new priority.

 

as_context_get_origin ()

const gchar *
as_context_get_origin (AsContext *ctx);

Parameters

ctx

a AsContext instance.

 

Returns

The data origin.

as_context_set_origin ()

void
as_context_set_origin (AsContext *ctx,
                       const gchar *value);

Sets the data origin.

Parameters

ctx

a AsContext instance.

 

value

the new value.

 

as_context_get_locale ()

const gchar *
as_context_get_locale (AsContext *ctx);

Parameters

ctx

a AsContext instance.

 

Returns

The active locale in BCP47 format.

as_context_set_locale ()

void
as_context_set_locale (AsContext *ctx,
                       const gchar *locale);

Sets the active locale. If the magic value "ALL" is used, the current system locale will be used for data reading, but when writing data all locale will be written.

Parameters

ctx

a AsContext instance.

 

locale

a POSIX or BCP47 locale, or NULL. e.g. "en_GB".

[nullable]

as_context_has_media_baseurl ()

gboolean
as_context_has_media_baseurl (AsContext *ctx);

Parameters

ctx

a AsContext instance.

 

Returns

TRUE if a media base URL is set.

as_context_get_media_baseurl ()

const gchar *
as_context_get_media_baseurl (AsContext *ctx);

Parameters

ctx

a AsContext instance.

 

Returns

The media base URL.

as_context_set_media_baseurl ()

void
as_context_set_media_baseurl (AsContext *ctx,
                              const gchar *value);

Sets the media base URL.

Parameters

ctx

a AsContext instance.

 

value

the new value.

 

as_context_get_locale_all_enabled ()

gboolean
as_context_get_locale_all_enabled (AsContext *ctx);

Parameters

ctx

a AsContext instance.

 

Returns

TRUE if all locale should be parsed.

as_context_get_filename ()

const gchar *
as_context_get_filename (AsContext *ctx);

Parameters

ctx

a AsContext instance.

 

Returns

The name of the file the data originates from.

as_context_set_filename ()

void
as_context_set_filename (AsContext *ctx,
                         const gchar *fname);

Sets the file name we are loading data from.

Parameters

ctx

a AsContext instance.

 

fname

the new file name.

 

Types and Values

AS_TYPE_CONTEXT

#define AS_TYPE_CONTEXT (as_context_get_type ())

struct AsContextClass

struct AsContextClass {
	GObjectClass parent_class;
};

enum AsFormatVersion

Format version / API level of the AppStream metadata.

Members

AS_FORMAT_VERSION_UNKNOWN

Unknown format version

 

AS_FORMAT_VERSION_V1_0

1.0

 

AS_FORMAT_VERSION_LATEST

#define AS_FORMAT_VERSION_LATEST AS_FORMAT_VERSION_V1_0

enum AsFormatStyle

There are a few differences between AppStream's metainfo files (shipped by upstream projects) and the catalog metadata (shipped by distributors). The data source kind indicates which style we should process. Usually you do not want to set this explicitly.

Members

AS_FORMAT_STYLE_UNKNOWN

The format style is unknown.

 

AS_FORMAT_STYLE_METAINFO

Parse AppStream upstream metadata (metainfo files)

 

AS_FORMAT_STYLE_CATALOG

Parse AppStream metadata catalog (shipped by software distributors)

 

enum AsFormatKind

Format of the AppStream metadata.

Members

AS_FORMAT_KIND_UNKNOWN

Unknown metadata format.

 

AS_FORMAT_KIND_XML

AppStream XML metadata.

 

AS_FORMAT_KIND_YAML

AppStream YAML (DEP-11) metadata.

 

AS_FORMAT_KIND_DESKTOP_ENTRY

XDG Desktop Entry data.

 

AsContext

typedef struct _AsContext AsContext;