TeplWidgetListCategory: Tepl 6 Reference Manual

## TeplWidgetListCategory TeplWidgetListCategory — A category of TeplWidgetListItem's |

## Functions

TeplWidgetListCategory * | tepl_widget_list_category_new ()
void | tepl_widget_list_category_free ()
const gchar * | tepl_widget_list_category_get_name ()
void | tepl_widget_list_category_add_item ()
GList * | tepl_widget_list_category_get_all ()

## Types and Values

| TeplWidgetListCategory
#define | TEPL_WIDGET_LIST_CATEGORY_CORE
#define | TEPL_WIDGET_LIST_CATEGORY_DEFAULT
#define | TEPL_WIDGET_LIST_CATEGORY_PLUGINS

## Includes

    #include <tepl/tepl.h>

## Description

This API is in a draft state and is incomplete.

A TeplWidgetListCategory object contains:

- A name.

- A list of TeplWidgetListItem's.

The main idea is to put several TeplWidgetListItem's in a list. The usual case is to have a single list, with `TEPL_WIDGET_LIST_CATEGORY_DEFAULT`. But it's possible to categorize the items, for example to distinguish between core components (always there) and plugins components, with `TEPL_WIDGET_LIST_CATEGORY_CORE` and `TEPL_WIDGET_LIST_CATEGORY_PLUGINS`. But the name of a category is a simple string, so other schemes are possible too.

The use-case for distinguishing between core components and plugins components is to clearly show in the UI that it comes from a plugin. For sorting the items too: first show core components (sorted alphabetically by title for example), then plugins components. If there are no plugins components, show an empty state icon.

## Functions

### tepl_widget_list_category_new ()

    TeplWidgetListCategory *
    tepl_widget_list_category_new (const gchar *name);

[skip]

#### Parameters

name | the category name. |

#### Returns

a new TeplWidgetListCategory.

[transfer full]

Since: 6.4

### tepl_widget_list_category_free ()

    void
    tepl_widget_list_category_free (TeplWidgetListCategory *category);

#### Parameters

category | a TeplWidgetListCategory. | [nullable]

Since: 6.4

### tepl_widget_list_category_get_name ()

    const gchar *
    tepl_widget_list_category_get_name (const TeplWidgetListCategory *category);

#### Parameters

category | a TeplWidgetListCategory. |

#### Returns

the name of `category` .

Since: 6.4

### tepl_widget_list_category_add_item ()

    void
    tepl_widget_list_category_add_item (TeplWidgetListCategory *category,
                                        TeplWidgetListItem *item);

#### Parameters

category | a TeplWidgetListCategory. |
item | an item to add to `category` . `category` then owns the item. | [transfer full]

Since: 6.4

### tepl_widget_list_category_get_all ()

    GList *
    tepl_widget_list_category_get_all (TeplWidgetListCategory *category);

#### Parameters

category | a TeplWidgetListCategory. |

#### Returns

the list of items that are part of `category` .

[transfer none][element-type TeplWidgetListItem]

Since: 6.4

## Types and Values

### TeplWidgetListCategory

    typedef struct _TeplWidgetListCategory TeplWidgetListCategory;

### TEPL_WIDGET_LIST_CATEGORY_CORE

    #define TEPL_WIDGET_LIST_CATEGORY_CORE "core"

A category name for core components.

Usually used in combination with `TEPL_WIDGET_LIST_CATEGORY_PLUGINS` to distinguish between the two.

Since: 6.4

### TEPL_WIDGET_LIST_CATEGORY_DEFAULT

    #define TEPL_WIDGET_LIST_CATEGORY_DEFAULT "default"

A category name, used as a default.

Usually used when only a single list is preferred.

Since: 6.4

### TEPL_WIDGET_LIST_CATEGORY_PLUGINS

    #define TEPL_WIDGET_LIST_CATEGORY_PLUGINS "plugins"

A category name for plugins components.

Usually used in combination with `TEPL_WIDGET_LIST_CATEGORY_CORE` to distinguish between the two.

Since: 6.4