gs-category-manager

gs-category-manager — A container to store GsCategory instances in

Functions

Types and Values

Description

GsCategoryManager is a container object which stores GsCategory instances, so that they can be consistently reused by other code, without creating multiple GsCategory instances for the same category ID.

It is intended to be used as a singleton, and typically accessed by calling gs_plugin_loader_get_category_manager().

Functions

gs_category_manager_new ()

GsCategoryManager *
gs_category_manager_new (void);

Create a new GsCategoryManager. It will contain all the categories, but their sizes will not be set until gs_category_increment_size() is called on them.

Returns

a new GsCategoryManager.

[transfer full]

Since: 40


gs_category_manager_lookup ()

GsCategory *
gs_category_manager_lookup (GsCategoryManager *self,
                            const gchar *id);

Look up a category by its ID. If the category is not found, NULL is returned.

Parameters

self

a GsCategoryManager

 

id

ID of the category to look up

 

Returns

the GsCategory, or NULL.

[transfer full][nullable]

Since: 40


gs_category_manager_get_categories ()

GsCategory * const	*
gs_category_manager_get_categories (GsCategoryManager *self,
                                    gsize *out_n_categories);

Get the full list of categories from the category manager. The returned array is NULL terminated and guaranteed to be non-NULL (although it may be empty).

If out_n_categories is provided, it will be set to the number of GsCategory objects in the return value, not including the NULL terminator.

Parameters

self

a GsCategoryManager

 

out_n_categories

return location for the number of categories in the return value, or NULL to ignore.

[optional][out caller-allocates]

Returns

the categories; do not free this memory.

[array length=out_n_categories][transfer none][not nullable]

Since: 40

Types and Values

GS_TYPE_CATEGORY_MANAGER

#define GS_TYPE_CATEGORY_MANAGER (gs_category_manager_get_type ())

GsCategoryManager

typedef struct _GsCategoryManager GsCategoryManager;