GtefActionInfo

GtefActionInfo — GAction information

Functions

Types and Values

Object Hierarchy

    GBoxed
    ╰── GtefActionInfo

Includes

#include <gtef/gtef.h>

Description

A GtefActionInfo 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 GtefActionInfo 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

gtef_action_info_new ()

GtefActionInfo *
gtef_action_info_new (void);

Returns

a new GtefActionInfo.

Since: 2.0


gtef_action_info_new_from_entry ()

GtefActionInfo *
gtef_action_info_new_from_entry (const GtefActionInfoEntry *info_entry,
                                 const gchar *translation_domain);

Creates a new GtefActionInfo from a GtefActionInfoEntry.

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

Parameters

info_entry

a GtefActionInfoEntry.

 

translation_domain

a gettext domain, or NULL.

[nullable]

Returns

a new GtefActionInfo.

Since: 2.0


gtef_action_info_ref ()

GtefActionInfo *
gtef_action_info_ref (GtefActionInfo *info);

Increments the reference count of info by one.

Parameters

info

a GtefActionInfo.

 

Returns

the passed in info .

Since: 2.0


gtef_action_info_unref ()

void
gtef_action_info_unref (GtefActionInfo *info);

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

Parameters

info

a GtefActionInfo.

 

Since: 2.0


gtef_action_info_copy ()

GtefActionInfo *
gtef_action_info_copy (const GtefActionInfo *info);

Parameters

info

a GtefActionInfo.

 

Returns

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

[transfer full]

Since: 2.0


gtef_action_info_get_action_name ()

const gchar *
gtef_action_info_get_action_name (const GtefActionInfo *info);

Parameters

info

a GtefActionInfo.

 

Returns

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

[nullable]

Since: 2.0


gtef_action_info_set_action_name ()

void
gtef_action_info_set_action_name (GtefActionInfo *info,
                                  const gchar *action_name);

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

Parameters

info

a GtefActionInfo.

 

action_name

the action name.

 

Since: 2.0


gtef_action_info_get_icon_name ()

const gchar *
gtef_action_info_get_icon_name (const GtefActionInfo *info);

Parameters

info

a GtefActionInfo.

 

Returns

the icon name, or NULL.

[nullable]

Since: 2.0


gtef_action_info_set_icon_name ()

void
gtef_action_info_set_icon_name (GtefActionInfo *info,
                                const gchar *icon_name);

Parameters

info

a GtefActionInfo.

 

icon_name

the icon name, or NULL.

[nullable]

Since: 2.0


gtef_action_info_get_label ()

const gchar *
gtef_action_info_get_label (const GtefActionInfo *info);

Parameters

info

a GtefActionInfo.

 

Returns

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

[nullable]

Since: 2.0


gtef_action_info_set_label ()

void
gtef_action_info_set_label (GtefActionInfo *info,
                            const gchar *label);

Parameters

info

a GtefActionInfo.

 

label

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

[nullable]

Since: 2.0


gtef_action_info_get_tooltip ()

const gchar *
gtef_action_info_get_tooltip (const GtefActionInfo *info);

Parameters

info

a GtefActionInfo.

 

Returns

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

[nullable]

Since: 2.0


gtef_action_info_set_tooltip ()

void
gtef_action_info_set_tooltip (GtefActionInfo *info,
                              const gchar *tooltip);

Parameters

info

a GtefActionInfo.

 

tooltip

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

[nullable]

Since: 2.0


gtef_action_info_get_accels ()

const gchar * const *
gtef_action_info_get_accels (const GtefActionInfo *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 GtefActionInfo.

 

Returns

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

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

Since: 2.0


gtef_action_info_set_accels ()

void
gtef_action_info_set_accels (GtefActionInfo *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 GtefActionInfo.

 

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

GtefActionInfo

typedef struct _GtefActionInfo GtefActionInfo;

GtefActionInfoEntry

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

This struct defines a set of information for a single action. It is for use with gtef_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

GtefActionInfoStore