AmtkActionInfo

AmtkActionInfo — GAction information

Types and Values

Object Hierarchy

    GBoxed
    ╰── AmtkActionInfo

Includes

#include <amtk/amtk.h>

Description

An AmtkActionInfo 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.

The recommended way to create a set of AmtkActionInfo's is to use the amtk_action_info_store_add_entries() function.

Functions

amtk_action_info_new ()

AmtkActionInfo *
amtk_action_info_new (void);

Returns

a new AmtkActionInfo.

Since: 2.0


amtk_action_info_new_from_entry ()

AmtkActionInfo *
amtk_action_info_new_from_entry (const AmtkActionInfoEntry *info_entry,
                                 const gchar *translation_domain);

Creates a new AmtkActionInfo from an AmtkActionInfoEntry.

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

Parameters

info_entry

an AmtkActionInfoEntry.

 

translation_domain

a gettext domain, or NULL.

[nullable]

Returns

a new AmtkActionInfo.

Since: 2.0


amtk_action_info_ref ()

AmtkActionInfo *
amtk_action_info_ref (AmtkActionInfo *info);

Increments the reference count of info by one.

Parameters

info

an AmtkActionInfo.

 

Returns

the passed in info .

Since: 2.0


amtk_action_info_unref ()

void
amtk_action_info_unref (AmtkActionInfo *info);

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

Parameters

info

an AmtkActionInfo.

 

Since: 2.0


amtk_action_info_copy ()

AmtkActionInfo *
amtk_action_info_copy (const AmtkActionInfo *info);

Parameters

info

an AmtkActionInfo.

 

Returns

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

[transfer full]

Since: 2.0


amtk_action_info_get_action_name ()

const gchar *
amtk_action_info_get_action_name (const AmtkActionInfo *info);

Parameters

info

an AmtkActionInfo.

 

Returns

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

[nullable]

Since: 2.0


amtk_action_info_set_action_name ()

void
amtk_action_info_set_action_name (AmtkActionInfo *info,
                                  const gchar *action_name);

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

Parameters

info

an AmtkActionInfo.

 

action_name

the action name.

 

Since: 2.0


amtk_action_info_get_icon_name ()

const gchar *
amtk_action_info_get_icon_name (const AmtkActionInfo *info);

Parameters

info

an AmtkActionInfo.

 

Returns

the icon name, or NULL.

[nullable]

Since: 2.0


amtk_action_info_set_icon_name ()

void
amtk_action_info_set_icon_name (AmtkActionInfo *info,
                                const gchar *icon_name);

Parameters

info

an AmtkActionInfo.

 

icon_name

the icon name, or NULL.

[nullable]

Since: 2.0


amtk_action_info_get_label ()

const gchar *
amtk_action_info_get_label (const AmtkActionInfo *info);

Gets the label. The label has normally a mnemonic. To remove the mnemonic, there is the amtk_utils_remove_mnemonic() function.

Parameters

info

an AmtkActionInfo.

 

Returns

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

[nullable]

Since: 2.0


amtk_action_info_set_label ()

void
amtk_action_info_set_label (AmtkActionInfo *info,
                            const gchar *label);

Sets the label with a mnemonic. To know how to encode the mnemonic, see the documentation of gtk_label_new_with_mnemonic().

Parameters

info

an AmtkActionInfo.

 

label

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

[nullable]

Since: 2.0


amtk_action_info_get_tooltip ()

const gchar *
amtk_action_info_get_tooltip (const AmtkActionInfo *info);

Parameters

info

an AmtkActionInfo.

 

Returns

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

[nullable]

Since: 2.0


amtk_action_info_set_tooltip ()

void
amtk_action_info_set_tooltip (AmtkActionInfo *info,
                              const gchar *tooltip);

Parameters

info

an AmtkActionInfo.

 

tooltip

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

[nullable]

Since: 2.0


amtk_action_info_get_accels ()

const gchar * const *
amtk_action_info_get_accels (const AmtkActionInfo *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

an AmtkActionInfo.

 

Returns

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

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

Since: 2.0


amtk_action_info_set_accels ()

void
amtk_action_info_set_accels (AmtkActionInfo *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

an AmtkActionInfo.

 

accels

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

[array zero-terminated=1]

Since: 2.0


amtk_action_info_mark_as_used ()

void
amtk_action_info_mark_as_used (AmtkActionInfo *info);

Mark info as used. An AmtkFactory function that uses an AmtkActionInfo should call this function. See amtk_action_info_store_check_all_used().

Parameters

info

an AmtkActionInfo.

 

Since: 3.0


amtk_action_info_has_been_used ()

gboolean
amtk_action_info_has_been_used (const AmtkActionInfo *info);

Returns whether info has been used (for example by an AmtkFactory function). See also amtk_action_info_store_check_all_used().

Parameters

info

an AmtkActionInfo.

 

Returns

whether info has been used.

Since: 3.0

Types and Values

AmtkActionInfo

typedef struct _AmtkActionInfo AmtkActionInfo;

AmtkActionInfoEntry

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

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