AsCategory: AppStream Library Reference Manual

## AsCategory AsCategory — Representation of a XDG category |

## Functions

#define | AS_TYPE_CATEGORY
AsCategory * | as_category_new ()
void | as_category_complete ()
const gchar * | as_category_get_directory ()
void | as_category_set_directory ()
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 ()
gboolean | as_category_has_subcategory ()
void | as_category_add_subcategory ()
void | as_category_remove_subcategory ()
GList * | as_category_get_included ()
GList * | as_category_get_excluded ()
GList * | as_category_get_subcategories ()
gint | as_category_get_level ()
void | as_category_set_level ()

## Properties

gchar * | directory | Read / Write
gpointer | excluded | Read
gchar * | icon | Read / Write
gpointer | included | Read
gint | level | Read / Write
gchar * | name | Read / Write
gpointer | subcategories | Read
gchar * | summary | Read

## Types and Values

struct | AsCategoryClass
| AsCategory

## Object Hierarchy

        GObject
        ╰── AsCategory

## 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. It's main purpose is to be used in software-centers to show information about application-groups, which are use to thematically group applications.

You can use AsMenuParser to get a set of supported default categories.

See also: AsMenuParser

## Functions

### AS_TYPE_CATEGORY

    #define AS_TYPE_CATEGORY (as_category_get_type ())

### as_category_new ()

    AsCategory *
    as_category_new (void);

Creates a new AsCategory.

#### Returns

a new AsCategory.

[transfer full]

### as_category_complete ()

    void
    as_category_complete (AsCategory *cat);

Update incomplete category data with information from "/usr/share/desktop-directories".

### as_category_get_directory ()

    const gchar *
    as_category_get_directory (AsCategory *cat);

Get associated XDG directory name for this category, in case one exists in "/usr/share/desktop-directories/".

#### Parameters

cat | An instance of AsCategory. |

### as_category_set_directory ()

    void
    as_category_set_directory (AsCategory *cat,
                               const gchar *value);

Set associated XDG directory name for this category.

#### Parameters

cat | An instance of AsCategory. |

### as_category_get_name ()

    const gchar *
    as_category_get_name (AsCategory *cat);

Get the name of this category.

#### Parameters

cat | An instance of AsCategory. |

### as_category_set_name ()

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

Set the name of this category.

#### Parameters

cat | An instance of AsCategory. |

### as_category_get_summary ()

    const gchar *
    as_category_get_summary (AsCategory *cat);

Get the summary (short description) of this category.

#### Parameters

cat | An instance of AsCategory. |

### as_category_set_summary ()

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

Get the summary (short description) of this category.

#### Parameters

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

### as_category_get_icon ()

    const gchar *
    as_category_get_icon (AsCategory *cat);

Get the stock icon name for this category.

#### Parameters

cat | An instance of AsCategory. |

### as_category_set_icon ()

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

Set the stock icon name for this category.

#### Parameters

cat | An instance of AsCategory. |

### as_category_has_subcategory ()

    gboolean
    as_category_has_subcategory (AsCategory *cat);

Test for sub-categories.

#### Parameters

cat | An instance of AsCategory. |

#### Returns

`TRUE` if this category has any subcategory

### as_category_add_subcategory ()

    void
    as_category_add_subcategory (AsCategory *cat,
                                 AsCategory *subcat);

Add a subcategory to this category.

#### Parameters

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

### as_category_remove_subcategory ()

    void
    as_category_remove_subcategory (AsCategory *cat,
                                    AsCategory *subcat);

Drop a subcategory from this AsCategory.

#### Parameters

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

### as_category_get_included ()

    GList *
    as_category_get_included (AsCategory *cat);

#### Parameters

cat | An instance of AsCategory. |

#### Returns

A list of category names.

[element-type utf8][transfer none]

### as_category_get_excluded ()

    GList *
    as_category_get_excluded (AsCategory *cat);

#### Parameters

cat | An instance of AsCategory. |

#### Returns

A list of category names.

[element-type utf8][transfer none]

### as_category_get_subcategories ()

    GList *
    as_category_get_subcategories (AsCategory *cat);

#### Parameters

cat | An instance of AsCategory. |

#### Returns

A list of subcategories.

[element-type AsCategory][transfer none]

### as_category_get_level ()

    gint
    as_category_get_level (AsCategory *cat);

### as_category_set_level ()

    void
    as_category_set_level (AsCategory *cat,
                           gint value);

## Types and Values

### struct AsCategoryClass

    struct AsCategoryClass {
    	GObjectClass parent_class;
    };

### AsCategory

    typedef struct _AsCategory AsCategory;

## Property Details

### The `“directory”` property

      “directory”                gchar *

directory.

Flags: Read / Write

Default value: NULL

### The `“excluded”` property

      “excluded”                 gpointer

excluded.

Flags: Read

### The `“icon”` property

      “icon”                     gchar *

icon.

Flags: Read / Write

Default value: NULL

### The `“included”` property

      “included”                 gpointer

included.

Flags: Read

### The `“level”` property

      “level”                    gint

level.

Flags: Read / Write

Default value: 0

### The `“name”` property

      “name”                     gchar *

name.

Flags: Read / Write

Default value: NULL

### The `“subcategories”` property

      “subcategories”            gpointer

subcategories.

Flags: Read

### The `“summary”` property

      “summary”                  gchar *

summary.

Flags: Read

Default value: NULL