## gs-category

gs-category — An category that contains applications

## Functions

GsCategory * | gs_category_new_for_desktop_data ()
const gchar * | gs_category_get_id ()
GsCategory * | gs_category_get_parent ()
const gchar * | gs_category_get_name ()
const gchar * | gs_category_get_icon_name ()
gint | gs_category_get_score ()
GPtrArray * | gs_category_get_desktop_groups ()
gboolean | gs_category_has_desktop_group ()
GsCategory * | gs_category_find_child ()
GPtrArray * | gs_category_get_children ()
guint | gs_category_get_size ()
void | gs_category_increment_size ()

## Types and Values

#define | GS_TYPE_CATEGORY
| GsCategory

## Description

This object provides functionality that allows a plugin to create a tree structure of categories that each contain GsApp's.

## Functions

### gs_category_new_for_desktop_data ()

    GsCategory *
    gs_category_new_for_desktop_data (const GsDesktopData *data);

Create a new GsCategory instance which wraps the desktop category information in `data` . Where possible, the static data will be reused, so `data` must be static and constant across the lifetime of the process.

#### Parameters

data | data for the category, which must be static and constant |

#### Returns

a new GsCategory wrapping `data` .

[transfer full]

Since: 40

### gs_category_get_id ()

    const gchar *
    gs_category_get_id (GsCategory *category);

Gets the category ID.

#### Parameters

category | a GsCategory |

#### Returns

the string, e.g. "other"

Since: 3.22

### gs_category_get_parent ()

    GsCategory *
    gs_category_get_parent (GsCategory *category);

Gets the parent category.

#### Parameters

category | a GsCategory |

#### Returns

the GsCategory or `NULL`

Since: 3.22

### gs_category_get_name ()

    const gchar *
    gs_category_get_name (GsCategory *category);

Gets the category name.

#### Parameters

category | a GsCategory |

#### Returns

the string, or `NULL`

Since: 3.22

### gs_category_get_icon_name ()

    const gchar *
    gs_category_get_icon_name (GsCategory *category);

Gets the category icon name.

#### Parameters

category | a GsCategory |

#### Returns

the string, or `NULL`

Since: 3.22

### gs_category_get_score ()

    gint
    gs_category_get_score (GsCategory *category);

Gets if the category score. Important categories may be shown before other categories, or tagged in a different way, for example with color or in a different section.

#### Parameters

category | a GsCategory |

#### Returns

the string, or `NULL`

Since: 3.22

### gs_category_get_desktop_groups ()

    GPtrArray *
    gs_category_get_desktop_groups (GsCategory *category);

Gets the list of AppStream groups for the category.

#### Parameters

category | a GsCategory |

#### Returns

An array.

[element-type utf8][transfer none]

Since: 3.22

### gs_category_has_desktop_group ()

    gboolean
    gs_category_has_desktop_group (GsCategory *category,
                                   const gchar *desktop_group);

Finds out if the category has the specific AppStream desktop group.

#### Parameters

category | a GsCategory |
desktop_group | a group of categories found in AppStream, e.g. "AudioVisual::Player" |

#### Returns

`TRUE` if found, `FALSE` otherwise

Since: 3.22

### gs_category_find_child ()

    GsCategory *
    gs_category_find_child (GsCategory *category,
                            const gchar *id);

Find a child category with a specific ID.

#### Parameters

category | a GsCategory |
id | a category ID, e.g. "other" |

#### Returns

the GsCategory, or `NULL`.

[transfer none]

Since: 3.22

### gs_category_get_children ()

    GPtrArray *
    gs_category_get_children (GsCategory *category);

Gets the list if children for a category.

#### Parameters

category | a GsCategory |

#### Returns

A list of children.

[element-type GsApp][transfer none]

Since: 3.22

### gs_category_get_size ()

    guint
    gs_category_get_size (GsCategory *category);

Returns how many applications the category could contain.

NOTE: This may over-estimate the number if duplicate applications are filtered or core applications are not shown.

#### Parameters

category | a GsCategory |

#### Returns

the number of apps in the category

Since: 3.22

### gs_category_increment_size ()

    void
    gs_category_increment_size (GsCategory *category,
                                guint value);

Adds `value` to the size count.

#### Parameters

category | a GsCategory |
value | how many to add |

Since: 3.22

## Types and Values

### GS_TYPE_CATEGORY

    #define GS_TYPE_CATEGORY (gs_category_get_type ())

### GsCategory

    typedef struct _GsCategory GsCategory;