AsCategory 3 APPSTREAM Library
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 ()

## Properties

gpointer | children | Read
gchar * | icon | Read / Write
gchar * | id | Read / Write
gchar * | name | Read / Write
gchar * | summary | Read
GPtrArray * | categories | Read
gchar * | description | Read / Write
gchar * | developer-name | Read / Write
gpointer | icons | Read
gchar * | id | Read / Write
GStrv | keywords | Read / Write
AsComponentKind | kind | Read / Write
gchar * | name | Read / Write
GStrv | pkgnames | Read / Write
gchar * | project-group | Read / Write
gchar * | project-license | Read / Write
GPtrArray * | screenshots | Read
gchar * | summary | Read / Write
GHashTable * | urls | Read

## Types and Values

#define | AS_TYPE_CATEGORY
struct | AsCategoryClass
| AsCategory
| AsComponent

## Object Hierarchy

        GObject
        ├── AsCategory
        ╰── AsComponent

## Includes

    #include <appstream.h>

## Description

This object represents an XDG category, as defined at: http://standards.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_new

### 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_get_id

### 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_set_id

### 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_get_name

### 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_set_name

### 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_get_summary

### 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_set_summary

### 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_get_icon

### 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_set_icon

### 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_get_children

### 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_has_children

### 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_add_child

### 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_remove_child

### 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_get_desktop_groups

### 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_add_desktop_group

### 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_get_components

### 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_add_component

### 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_category_has_component

### 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.

#### Parameters

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

#### Returns

a list of AsCategory.

[transfer container][element-type AsCategory]

as_get_default_categories

## Types and Values

### AS_TYPE_CATEGORY

    #define AS_TYPE_CATEGORY (as_category_get_type ())

AS_TYPE_CATEGORY

### struct AsCategoryClass

    struct AsCategoryClass {
    	GObjectClass parent_class;
    };

AsCategoryClass

### AsCategory

    typedef struct _AsCategory AsCategory;

AsCategory

### AsComponent

    typedef struct _AsComponent AsComponent;

AsComponent

## Property Details

### The `“children”` property

      “children”                 gpointer

children.

Flags: Read

AsCategory:children

### The `“icon”` property

      “icon”                     gchar *

icon.

Flags: Read / Write

Default value: NULL

AsCategory:icon

### The `“id”` property

      “id”                       gchar *

id.

Flags: Read / Write

Default value: NULL

AsCategory:id

### The `“name”` property

      “name”                     gchar *

name.

Flags: Read / Write

Default value: NULL

AsCategory:name

### The `“summary”` property

      “summary”                  gchar *

summary.

Flags: Read

Default value: NULL

AsCategory:summary

### The `“categories”` property

      “categories”               GPtrArray *

string array of categories

Flags: Read

AsComponent:categories

### The `“description”` property

      “description”              gchar *

the description

Flags: Read / Write

Default value: NULL

AsComponent:description

### The `“developer-name”` property

      “developer-name”           gchar *

the developer name

Flags: Read / Write

Default value: NULL

AsComponent:developer-name

### The `“icons”` property

      “icons”                    gpointer

hash map of icon urls and sizes

[type GList(AsIcon)]

Flags: Read

AsComponent:icons

### The `“id”` property

      “id”                       gchar *

the unique identifier

Flags: Read / Write

Default value: NULL

AsComponent:id

### The `“keywords”` property

      “keywords”                 GStrv

string array of keywords

Flags: Read / Write

AsComponent:keywords

### The `“kind”` property

      “kind”                     AsComponentKind

the AsComponentKind of this component

Flags: Read / Write

Default value: AS_COMPONENT_KIND_UNKNOWN

AsComponent:kind

### The `“name”` property

      “name”                     gchar *

the name

Flags: Read / Write

Default value: NULL

AsComponent:name

### The `“pkgnames”` property

      “pkgnames”                 GStrv

string array of packages name

Flags: Read / Write

AsComponent:pkgnames

### The `“project-group”` property

      “project-group”            gchar *

the project group

Flags: Read / Write

Default value: NULL

AsComponent:project-group

### The `“project-license”` property

      “project-license”          gchar *

the project license

Flags: Read / Write

Default value: NULL

AsComponent:project-license

### The `“screenshots”` property

      “screenshots”              GPtrArray *

screenshots.

Flags: Read

AsComponent:screenshots

### The `“summary”` property

      “summary”                  gchar *

the summary

Flags: Read / Write

Default value: NULL

AsComponent:summary

### The `“urls”` property

      “urls”                     GHashTable *

urls.

Flags: Read

AsComponent:urls