TeplActionInfo: Tepl 3 Reference Manual

## TeplActionInfo TeplActionInfo — GAction information |

## Functions

TeplActionInfo * | tepl_action_info_new ()
TeplActionInfo * | tepl_action_info_new_from_entry ()
TeplActionInfo * | tepl_action_info_ref ()
void | tepl_action_info_unref ()
TeplActionInfo * | tepl_action_info_copy ()
const gchar * | tepl_action_info_get_action_name ()
void | tepl_action_info_set_action_name ()
const gchar * | tepl_action_info_get_icon_name ()
void | tepl_action_info_set_icon_name ()
const gchar * | tepl_action_info_get_label ()
void | tepl_action_info_set_label ()
const gchar * | tepl_action_info_get_tooltip ()
void | tepl_action_info_set_tooltip ()
const gchar * const * | tepl_action_info_get_accels ()
void | tepl_action_info_set_accels ()

## Types and Values

| TeplActionInfo
| TeplActionInfoEntry

## Object Hierarchy

        GBoxed
        ╰── TeplActionInfo

## Includes

    #include <tepl/tepl.h>

## Description

A TeplActionInfo instance contains a set of information about a GAction. Those pieces of information are useful to create UI elements that trigger the GAction, for example a menu item or a toolbar item.

When writing an XML file to create a GMenu, with the format understood by GtkBuilder (see the class description of GtkApplicationWindow), the information in the XML file can be used only to create a GMenu. The initial goal with TeplActionInfo and its related classes is to encode the information just once, and be able to create both a menu and a toolbar easily (to have a traditional user interface).

## Functions

### tepl_action_info_new ()

    TeplActionInfo *
    tepl_action_info_new (void);

#### Returns

a new TeplActionInfo.

Since: 2.0

### tepl_action_info_new_from_entry ()

    TeplActionInfo *
    tepl_action_info_new_from_entry (const TeplActionInfoEntry *info_entry,
                                     const gchar *translation_domain);

Creates a new TeplActionInfo from a TeplActionInfoEntry.

If `translation_domain` is not `NULL`, `g_dgettext()` is used to translate the `label` and `tooltip` before setting them to the TeplActionInfo.

#### Parameters

info_entry | a TeplActionInfoEntry. |
translation_domain | a gettext domain, or `NULL`. | [nullable]

#### Returns

a new TeplActionInfo.

Since: 2.0

### tepl_action_info_ref ()

    TeplActionInfo *
    tepl_action_info_ref (TeplActionInfo *info);

Increments the reference count of `info` by one.

#### Parameters

info | a TeplActionInfo. |

#### Returns

the passed in `info` .

Since: 2.0

### tepl_action_info_unref ()

    void
    tepl_action_info_unref (TeplActionInfo *info);

Decrements the reference count of `info` by one. If the reference count drops to 0, `info` is freed.

#### Parameters

info | a TeplActionInfo. |

Since: 2.0

### tepl_action_info_copy ()

    TeplActionInfo *
    tepl_action_info_copy (const TeplActionInfo *info);

#### Parameters

info | a TeplActionInfo. |

#### Returns

a copy of `info` . The copy will have a reference count of one.

[transfer full]

Since: 2.0

### tepl_action_info_get_action_name ()

    const gchar *
    tepl_action_info_get_action_name (const TeplActionInfo *info);

#### Parameters

info | a TeplActionInfo. |

#### Returns

the action name, or `NULL`. Example: `"win.save"`.

[nullable]

Since: 2.0

### tepl_action_info_set_action_name ()

    void
    tepl_action_info_set_action_name (TeplActionInfo *info,
                                      const gchar *action_name);

Sets the action name, for example `"win.save"`.

#### Parameters

info | a TeplActionInfo. |
action_name | the action name. |

Since: 2.0

### tepl_action_info_get_icon_name ()

    const gchar *
    tepl_action_info_get_icon_name (const TeplActionInfo *info);

#### Parameters

info | a TeplActionInfo. |

#### Returns

the icon name, or `NULL`.

[nullable]

Since: 2.0

### tepl_action_info_set_icon_name ()

    void
    tepl_action_info_set_icon_name (TeplActionInfo *info,
                                    const gchar *icon_name);

#### Parameters

info | a TeplActionInfo. |
icon_name | the icon name, or `NULL`. | [nullable]

Since: 2.0

### tepl_action_info_get_label ()

    const gchar *
    tepl_action_info_get_label (const TeplActionInfo *info);

#### Parameters

info | a TeplActionInfo. |

#### Returns

the label (i.e. a short description), or `NULL`.

[nullable]

Since: 2.0

### tepl_action_info_set_label ()

    void
    tepl_action_info_set_label (TeplActionInfo *info,
                                const gchar *label);

#### Parameters

info | a TeplActionInfo. |
label | the label (i.e. a short description), or `NULL`. | [nullable]

Since: 2.0

### tepl_action_info_get_tooltip ()

    const gchar *
    tepl_action_info_get_tooltip (const TeplActionInfo *info);

#### Parameters

info | a TeplActionInfo. |

#### Returns

the tooltip (i.e. a long description), or `NULL`.

[nullable]

Since: 2.0

### tepl_action_info_set_tooltip ()

    void
    tepl_action_info_set_tooltip (TeplActionInfo *info,
                                  const gchar *tooltip);

#### Parameters

info | a TeplActionInfo. |
tooltip | the tooltip (i.e. a long description), or `NULL`. | [nullable]

Since: 2.0

### tepl_action_info_get_accels ()

    const gchar * const *
    tepl_action_info_get_accels (const TeplActionInfo *info);

Returns the accelerators. This function never returns `NULL`, it always returns a `NULL`-terminated array, to be suitable for `gtk_application_set_accels_for_action()`.

#### Parameters

info | a TeplActionInfo. |

#### Returns

a `NULL`-terminated array of accelerators in the format understood by `gtk_accelerator_parse()`.

[transfer none][array zero-terminated=1]

Since: 2.0

### tepl_action_info_set_accels ()

    void
    tepl_action_info_set_accels (TeplActionInfo *info,
                                 const gchar * const *accels);

A function similar to `gtk_application_set_accels_for_action()`.

`accels` must not be `NULL`, it must be a `NULL`-terminated array, to be consistent with `gtk_application_set_accels_for_action()`.

#### Parameters

info | a TeplActionInfo. |
accels | a `NULL`-terminated array of accelerators in the format understood by `gtk_accelerator_parse()`. | [array zero-terminated=1]

Since: 2.0

## Types and Values

### TeplActionInfo

    typedef struct _TeplActionInfo TeplActionInfo;

### TeplActionInfoEntry

    typedef struct {
    	const gchar *action_name;
    	const gchar *icon_name;
    	const gchar *label;
    	const gchar *accel;
    	const gchar *tooltip;
    } TeplActionInfoEntry;

This struct defines a set of information for a single action. It is for use with `tepl_action_info_store_add_entries()`.

Like GActionEntry, it is permissible to use an incomplete initialiser in order to leave some of the later values as `NULL`. Additional optional fields may be added in the future.

#### Members

const gchar *`action_name`; | the action name. |
const gchar *`icon_name`; | the icon name, or `NULL`. |
const gchar *`label`; | the label (i.e. a short description), or `NULL`. |
const gchar *`accel`; | the accelerator, in the format understood by `gtk_accelerator_parse()`. Or `NULL`. |
const gchar *`tooltip`; | the tooltip (i.e. a long description), or `NULL`. |

Since: 2.0

## See Also

TeplActionInfoStore