AsStore

AsStore — a hashed array store of applications

Stability Level

Stable, unless otherwise indicated

Functions

Object Hierarchy

    GObject
    ╰── AsStore

Includes

#include <appstream-glib.h>

Description

This store contains both an array of AsApp's but also a pair of hashes to quickly retrieve an application from the ID or package name.

Applications can also be removed, and the whole store can be loaded and saved to a compressed XML file.

See also: AsApp

Functions

as_store_new ()

AsStore *
as_store_new (void);

Creates a new AsStore.

Returns

a AsStore.

[transfer full]

Since 0.1.0


as_store_get_size ()

guint
as_store_get_size (AsStore *store);

Gets the size of the store after deduplication and prioritization has taken place.

Parameters

store

a AsStore instance.

 

Returns

the number of usable applications in the store

Since 0.1.0


as_store_from_file ()

gboolean
as_store_from_file (AsStore *store,
                    GFile *file,
                    const gchar *path_icons,
                    GCancellable *cancellable,
                    GError **error);

Parses an AppStream XML file and adds any valid applications to the store.

Parameters

store

a AsStore instance.

 

file

a GFile.

 

path_icons

the icon path for the applications, or NULL.

 

cancellable

a GCancellable.

 

error

A GError or NULL.

 

Returns

TRUE for success

Since 0.1.0


as_store_get_apps ()

GPtrArray *
as_store_get_apps (AsStore *store);

Gets an array of all the valid applications in the store.

Parameters

store

a AsStore instance.

 

Returns

an array.

[element-type AsApp][transfer none]

Since 0.1.0


as_store_get_app_by_id ()

AsApp *
as_store_get_app_by_id (AsStore *store,
                        const gchar *id);

Finds an application in the store by ID.

Parameters

store

a AsStore instance.

 

id

the application short ID.

 

Returns

a AsApp or NULL.

[transfer none]

Since 0.1.0


as_store_get_app_by_pkgname ()

AsApp *
as_store_get_app_by_pkgname (AsStore *store,
                             const gchar *pkgname);

Finds an application in the store by package name.

Parameters

store

a AsStore instance.

 

pkgname

the package name.

 

Returns

a AsApp or NULL.

[transfer none]

Since 0.1.0


as_store_add_app ()

void
as_store_add_app (AsStore *store,
                  AsApp *app);

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.

Parameters

store

a AsStore instance.

 

app

a AsApp instance.

 

Since 0.1.0


as_store_remove_app ()

void
as_store_remove_app (AsStore *store,
                     AsApp *app);

Removes an application from the store if it exists.

Parameters

store

a AsStore instance.

 

app

a AsApp instance.

 

Since 0.1.0


as_store_to_xml ()

GString *
as_store_to_xml (AsStore *store,
                 AsNodeToXmlFlags flags);

Outputs an XML representation of all the applications in the store.

Parameters

store

a AsStore instance.

 

flags

the AsNodeToXmlFlags, e.g. AS_NODE_INSERT_FLAG_NONE.

 

Returns

A GString

Since 0.1.0


as_store_to_file ()

gboolean
as_store_to_file (AsStore *store,
                  GFile *file,
                  AsNodeToXmlFlags flags,
                  GCancellable *cancellable,
                  GError **error);

Outputs a compressed XML file of all the applications in the store.

Parameters

store

a AsStore instance.

 

file

file

 

flags

the AsNodeToXmlFlags, e.g. AS_NODE_INSERT_FLAG_NONE.

 

cancellable

A GCancellable, or NULL

 

error

A GError or NULL

 

Returns

A GString

Since 0.1.0

Types and Values