AsCategory: AppStream Library Reference Manual

## AsCategory AsCategory — Representation of a XDG category |

## Functions

AsCategory * | as_category_new ()
const gchar * | as_category_get_id ()
void | as_category_set_id ()
const gchar * | as_category_get_name ()
void | as_category_set_name ()
const gchar * | as_category_get_summary ()
void | as_category_set_summary ()
const gchar * | as_category_get_icon ()
void | as_category_set_icon ()
GPtrArray * | as_category_get_children ()
gboolean | as_category_has_children ()
void | as_category_add_child ()
void | as_category_remove_child ()
GPtrArray * | as_category_get_desktop_groups ()
void | as_category_add_desktop_group ()
GPtrArray * | as_category_get_components ()
void | as_category_add_component ()
gboolean | as_category_has_component ()
GPtrArray * | as_get_default_categories ()

## Types and Values

#define | AS_TYPE_CATEGORY
struct | AsCategoryClass
| AsCategory
| AsComponent

## Includes

    #include <appstream.h>

## Description

This object represents a XDG category, as defined at: https://specifications.freedesktop.org/menu-spec/menu-spec-1.0.htmlcategory-registry

The AsCategory object does not support all aspects of a menu. Its main purpose is to be used in software-centers to group visual components (gui/web applications).

You can use `as_get_default_categories`() to get a set of supported default categories.

See also: AsComponent

## Functions

### as_category_new ()

    AsCategory *
    as_category_new (void);

Creates a new AsCategory.

#### Returns

a new AsCategory.

[transfer full]

### as_category_get_id ()

    const gchar *
    as_category_get_id (AsCategory *category);

Get the ID of this category.

#### Parameters

category | An instance of AsCategory. |

### as_category_set_id ()

    void
    as_category_set_id (AsCategory *category,
                        const gchar *id);

Set the ID of this category.

#### Parameters

category | An instance of AsCategory. |

### as_category_get_name ()

    const gchar *
    as_category_get_name (AsCategory *category);

Get the name of this category.

#### Parameters

category | An instance of AsCategory. |

### as_category_set_name ()

    void
    as_category_set_name (AsCategory *category,
                          const gchar *value);

Set the name of this category.

#### Parameters

category | An instance of AsCategory. |

### as_category_get_summary ()

    const gchar *
    as_category_get_summary (AsCategory *category);

Get the summary (short description) of this category.

#### Parameters

category | An instance of AsCategory. |

### as_category_set_summary ()

    void
    as_category_set_summary (AsCategory *category,
                             const gchar *value);

Get the summary (short description) of this category.

#### Parameters

category | An instance of AsCategory. |
value | A new short summary of this category. |

### as_category_get_icon ()

    const gchar *
    as_category_get_icon (AsCategory *category);

Get the stock icon name for this category.

#### Parameters

category | An instance of AsCategory. |

### as_category_set_icon ()

    void
    as_category_set_icon (AsCategory *category,
                          const gchar *value);

Set the stock icon name for this category.

#### Parameters

category | An instance of AsCategory. |

### as_category_get_children ()

    GPtrArray *
    as_category_get_children (AsCategory *category);

#### Parameters

category | An instance of AsCategory. |

#### Returns

A list of subcategories.

[element-type AsCategory][transfer none]

### as_category_has_children ()

    gboolean
    as_category_has_children (AsCategory *category);

Test for sub-categories.

#### Parameters

category | An instance of AsCategory. |

#### Returns

`TRUE` if this category has any subcategory

### as_category_add_child ()

    void
    as_category_add_child (AsCategory *category,
                           AsCategory *subcat);

Add a subcategory to this category.

#### Parameters

category | An instance of AsCategory. |
subcat | A subcategory to add. |

### as_category_remove_child ()

    void
    as_category_remove_child (AsCategory *category,
                              AsCategory *subcat);

Drop a subcategory from this AsCategory.

#### Parameters

category | An instance of AsCategory. |
subcat | A subcategory to remove. |

### as_category_get_desktop_groups ()

    GPtrArray *
    as_category_get_desktop_groups (AsCategory *category);

#### Parameters

category | An instance of AsCategory. |

#### Returns

A list of desktop-file categories.

[transfer none][element-type utf8]

### as_category_add_desktop_group ()

    void
    as_category_add_desktop_group (AsCategory *category,
                                   const gchar *group_name);

Add a desktop-file category to this AsCategory.

#### Parameters

category | An instance of AsCategory. |
group_name | A subcategory to add. |

### as_category_get_components ()

    GPtrArray *
    as_category_get_components (AsCategory *category);

Get list of components which have been sorted into this category.

#### Parameters

category | An instance of AsCategory. |

#### Returns

List of AsCategory.

[transfer none][element-type AsComponent]

### as_category_add_component ()

    void
    as_category_add_component (AsCategory *category,
                               AsComponent *cpt);

Add a component to this category.

#### Parameters

category | An instance of AsCategory. |
cpt | The AsComponent to add. |

### as_category_has_component ()

    gboolean
    as_category_has_component (AsCategory *category,
                               AsComponent *cpt);

Check if the exact AsComponent `cpt` is a member of this category already.

#### Parameters

category | An instance of AsCategory. |
cpt | The AsComponent to look for. |

#### Returns

`TRUE` if the component is present.

### as_get_default_categories ()

    GPtrArray *
    as_get_default_categories (gboolean with_special);

Get a list of the default Freedesktop and AppStream categories that software components (especially GUI applications) can be sorted into in software centers.

[skip]

#### Parameters

with_special | Include special categories (e.g. "addons", and "all"/"featured" in submenus) |

#### Returns

a list of AsCategory.

[transfer container][element-type AsCategory]

## Types and Values

### AS_TYPE_CATEGORY

    #define AS_TYPE_CATEGORY (as_category_get_type ())

### struct AsCategoryClass

    struct AsCategoryClass {
    	GObjectClass parent_class;
    };

### AsCategory

    typedef struct _AsCategory AsCategory;

### AsComponent

    typedef struct _AsComponent AsComponent;