Top | ![]() |
![]() |
![]() |
![]() |
char * | accel | Read / Write |
gboolean | active | Read / Write |
gboolean | enabled | Read / Write |
char * | icon-name | Read / Write |
gboolean | is-visible | Read |
char * | label | Read / Write |
char * | map-name | Read / Write / Construct Only |
char * | name | Read / Write / Construct Only |
GVariantType * | parameter-type | Read / Write / Construct Only |
gboolean | sensitive | Read / Write |
GVariant * | state | Read / Write |
GVariantType * | state-hint | Read / Write |
GVariantType * | state-type | Read |
char * | tooltip | Read / Write |
gboolean | visible | Read / Write |
void | accel-added | Action |
void | accel-removed | Action |
void | activate | Run Last |
void | change-state | Run Last |
void | changed | Action |
The EUIAction is similar to a GSimpleAction, with added properties suitable for easier manipulation of the action appearance. It implements a GAction interface.
The action can be part of a single EUIActionGroup only. The GAction::enabled property considers also the groups sensitive value.
While the EUIAction
:visible property is relevant for the action itself,
the EUIAction
:is-visible property considers also visibility of the group, if any.
The object is not thread-safe, it's meant to be used only from the main/GUI thread.
void (*EUIActionFunc) (EUIAction *action
,GVariant *value
,gpointer user_data
);
A function called either on action
activate or change_state signal.
For the activate, the value
is a parameter, with which the activate
was called. Stateless actions do not provide any parameter.
For the change_state, the value
is a new value the state should be changed to.
action |
an EUIAction |
|
value |
a GVariant value for the function. |
[nullable] |
user_data |
user data for the function |
Since: 3.56
EUIAction * e_ui_action_new (const gchar *map_name
,const gchar *action_name
,const GVariantType *parameter_type
);
Creates a new EUIAction.
map_name |
a name of a GActionMap the action belongs to |
|
action_name |
a name of the action to be created |
|
parameter_type |
a type of the action parameter, as GVariantType, or |
[nullable] |
Since: 3.56
EUIAction * e_ui_action_new_stateful (const gchar *map_name
,const gchar *action_name
,const GVariantType *parameter_type
,GVariant *state
);
Creates a new stateful EUIAction. Actions with boolean state are
usually presented as toggle buttons and menu items, while actions
with string states are usually presented as radio buttons and menu
items. Radio actions need to have set radio group with
e_ui_action_set_radio_group()
.
map_name |
a name of a GActionMap the action belongs to |
|
action_name |
a name of the action to be created |
|
parameter_type |
a type of the action parameter, as GVariantType, or |
[nullable] |
state |
a GVariant for the action to have set a state to |
Since: 3.56
EUIAction * e_ui_action_new_from_entry (const gchar *map_name
,const EUIActionEntry *entry
,const gchar *translation_domain
);
Creates a new EUIAction from the entry
.
map_name |
a name of a GActionMap the action belongs to |
|
entry |
a single EUIActionEntry to construct the action from |
|
translation_domain |
a translation domain to use to localize the entry members for label and tooltip. |
[nullable] |
Since: 3.56
EUIAction * e_ui_action_new_from_enum_entry (const gchar *map_name
,const EUIActionEnumEntry *entry
,const gchar *translation_domain
);
Creates a new EUIAction from the entry
.
map_name |
a name of a GActionMap the action belongs to |
|
entry |
a single EUIActionEnumEntry to construct the action from |
|
translation_domain |
a translation domain to use to localize the entry members for label and tooltip. |
[nullable] |
Since: 3.56
const gchar *
e_ui_action_get_map_name (EUIAction *self
);
Get name of the action map. It usually matches a name of an associated EUIActionGroup.
Since: 3.56
GVariant *
e_ui_action_ref_target (EUIAction *self
);
References target of a stateful action. This is usable for radio actions, where the state contains the current state of the whole radio group, while the target is the value to be set in the group when the action is activated.
the target value of the self
,
or NULL
, when the self
is not a radio action.
[transfer full][nullable]
Since: 3.56
void e_ui_action_set_state (EUIAction *self
,GVariant *value
);
Sets a state of the self
to value
.
Since: 3.56
void e_ui_action_set_state_hint (EUIAction *self
,GVariant *state_hint
);
Sets or unsets the action state hint.
self |
an EUIAction |
|
state_hint |
a state hint as a GVariant, or |
[nullable][transfer full] |
Since: 3.56
void e_ui_action_set_visible (EUIAction *self
,gboolean visible
);
Sets whether the self
is visible.
Since: 3.56
gboolean
e_ui_action_get_visible (EUIAction *self
);
Gets whether the action is visible. It does not consider the associated
group visibility; use e_ui_action_is_visible()
instead.
Since: 3.56
void e_ui_action_set_sensitive (EUIAction *self
,gboolean sensitive
);
Sets whether the action is sensitive.
Since: 3.56
gboolean
e_ui_action_get_sensitive (EUIAction *self
);
Gets whether the action is sensitive. It does not consider the associated
group sensitivity; use g_action_get_enabled()
instead.
Since: 3.56
gboolean
e_ui_action_is_visible (EUIAction *self
);
Gets whether the action itself and the associated EUIActionGroup,
if any, are both visible. Use e_ui_action_get_visible()
to get
visibility of the action itself.
Since: 3.56
void e_ui_action_set_icon_name (EUIAction *self
,const gchar *icon_name
);
Sets or unsets and icon name for the self
. It can be a standard icon name,
or a text with prefix "gicon::", which are generated by the action owner
through “create-gicon” signal. The signal is executed without
the "gicon::" prefix.
Since: 3.56
const gchar *
e_ui_action_get_icon_name (EUIAction *self
);
Gets the icon name of the self
.
Since: 3.56
void e_ui_action_set_label (EUIAction *self
,const gchar *label
);
Sets a label for the action. The label should be already localized.
Since: 3.56
const gchar *
e_ui_action_get_label (EUIAction *self
);
Gets a label of the self
.
Since: 3.56
void e_ui_action_set_accel (EUIAction *self
,const gchar *accel
);
Sets or unsets an accelerator string for the self
.
The accel
should be parseable by the gtk_accelerator_parse()
function.
Since: 3.56
const gchar *
e_ui_action_get_accel (EUIAction *self
);
Gets an accelarator string for the self
.
Since: 3.56
void e_ui_action_add_secondary_accel (EUIAction *self
,const gchar *accel
);
Adds a secondary accelerator string for the self
. This is in addition
to the "accel" property, which is meant to be the main accelerator,
shown in the GUI and such.
The accel
should be parseable by the gtk_accelerator_parse()
function.
Since: 3.56
GPtrArray *
e_ui_action_get_secondary_accels (EUIAction *self
);
Gets an array of the secondary accelarators for the self
. The caller should
not modify the array in any way.
an array
of the secondary accelerator strings for the self
, or NULL
, when none is set.
[nullable][transfer none][element-type utf8]
Since: 3.56
void
e_ui_action_remove_secondary_accels (EUIAction *self
);
Removes all secondary accelerator strings.
Since: 3.56
void e_ui_action_set_tooltip (EUIAction *self
,const gchar *tooltip
);
Sets or unsets a tooltip text (not markup) for the self
.
Since: 3.56
const gchar *
e_ui_action_get_tooltip (EUIAction *self
);
Gets tooltip text for the self
.
Since: 3.56
void e_ui_action_set_radio_group (EUIAction *self
,GPtrArray *radio_group
);
Stateful actions can be grouped together, by setting the same radio
group to each action. When not NULL
, the self
references the radio_group
,
thus the caller can just create one array, set it to each action
and then unref it.
An action can be in a single radio group only. Trying to set a different radio group when one is already set is considered a programming error.
self |
an EUIAction |
|
radio_group |
a radio group to use, or |
[nullable][transfer none][element-type EUIAction] |
Since: 3.56
void e_ui_action_set_action_group (EUIAction *self
,struct _EUIActionGroup *action_group
);
Sets the self
as being part of the action_group
, or unsets the group,
when it's NULL
. An action cannot be part of multiple action groups,
thus when trying to set a different action group the action is removed
from the previous group (unlike e_ui_action_set_radio_group()
, which
does not move an action between radio groups automatically).
The action_group
usually matches the EUIAction
:map-name property.
See e_ui_action_get_sensitive()
, e_ui_action_get_visible()
,
e_ui_action_is_visible()
.
Since: 3.56
struct _EUIActionGroup *
e_ui_action_get_action_group (EUIAction *self
);
Gets an action group the self
is part of.
Since: 3.56
gboolean
e_ui_action_get_active (EUIAction *self
);
Checks whether the self
state is the active, aka current, value.
For toggle actions (with boolean state) returns whether the state is TRUE
.
For radio actions returns whether the state matches the action target.
For stateless actions returns FALSE.
Since: 3.56
void e_ui_action_set_active (EUIAction *self
,gboolean active
);
Sets whether the self
state is the active
, aka current, value.
For toggle actions (with boolean state) sets the active
directly.
For radio actions sets the state to the self
target when active
is TRUE
,
otherwise does nothing. For stateless actions does nothing.
Since: 3.56
void
e_ui_action_emit_changed (EUIAction *self
);
Emits the “changed” signal on the self
.
Since: 3.56
guint32
e_ui_action_get_usable_for_kinds (EUIAction *self
);
Returns bit-or of EUIElementKind, for which the action can be used.
Only the E_UI_ELEMENT_KIND_HEADERBAR
, E_UI_ELEMENT_KIND_TOOLBAR
and E_UI_ELEMENT_KIND_MENU
are considered.
By default, the self
can be used for all these kinds.
Since: 3.56
void e_ui_action_set_usable_for_kinds (EUIAction *self
,guint32 kinds
);
Sets which EUIElementKind -s the self
can be used for.
Only the E_UI_ELEMENT_KIND_HEADERBAR
, E_UI_ELEMENT_KIND_TOOLBAR
and E_UI_ELEMENT_KIND_MENU
are considered.
By default, the self
can be used for all these kinds.
Since: 3.56
gboolean e_ui_action_util_gvalue_to_enum_state (GBinding *binding
,const GValue *from_value
,GValue *to_value
,gpointer user_data
);
A utility function, which can be used as a transformation function
of a GBinding from an enum property to an enum state of an EUIAction
created by e_ui_action_new_from_enum_entry()
.
binding |
a GBinding |
|
from_value |
a source GValue |
|
to_value |
a destination GValue |
|
user_data |
unused binding user data |
Since: 3.56
gboolean e_ui_action_util_enum_state_to_gvalue (GBinding *binding
,const GValue *from_value
,GValue *to_value
,gpointer user_data
);
A utility function, which can be used as a transformation function
of a GBinding from an enum state of an EUIAction created by
e_ui_action_new_from_enum_entry()
to an enum property.
binding |
a GBinding |
|
from_value |
a source GValue |
|
to_value |
a destination GValue |
|
user_data |
unused binding user data |
Since: 3.56
typedef struct { const gchar *name; const gchar *icon_name; const gchar *label; const gchar *accel; const gchar *tooltip; EUIActionFunc activate; const gchar *parameter_type; const gchar *state; EUIActionFunc change_state; } EUIActionEntry;
A structure describing an action, which can be created in bulk
with e_ui_manager_add_actions()
function.
Simple actions declare only the activate
callback, where it reacts
to the action activation.
To create a checkbox-like widgets from the action, set the state
to a boolean value (like "true") and provide a change_state
function, which will set e_ui_action_set_state (action, value);
and also react to the change of the state.
To create a radiobutton-like widgets from the action, set the parameter_type
for example to string ("s"), the state
to the value the radio group
should be switched to (like "'value1'") and the change_state
function, which calls e_ui_action_set_state (action, value); and reacts
to the change of the state. Each action in the radio group can use the same
change_state
callback. Make sure the actions are part of the same radio
group with the e_ui_action_set_radio_group()
.
an action name |
||
an icon name |
||
an action label |
||
an action accelerator |
||
an action tooltip |
||
EUIActionFunc |
an EUIActionFunc callback to call when the action is activated, or |
[nullable] |
an action parameter type |
||
an action state for stateful actions |
||
EUIActionFunc |
an EUIActionFunc callback to call when the state of the action should be changed, or |
[nullable] |
Since: 3.56
typedef struct { const gchar *name; const gchar *icon_name; const gchar *label; const gchar *accel; const gchar *tooltip; EUIActionFunc activate; gint state; } EUIActionEnumEntry;
A structure describing a radio action, whose states are enum values.
The actions can be created in bulk with e_ui_manager_add_actions_enum()
function.
See EUIActionEntry.
an action name |
||
an icon name |
||
an action label |
||
an action accelerator |
||
an action tooltip |
||
EUIActionFunc |
an EUIActionFunc callback to call when the action is activated, or |
[nullable] |
the corresponding enum value, as gint |
Since: 3.56
“accel”
property “accel” char *
An action accelerator.
Owner: EUIAction
Flags: Read / Write
Default value: NULL
Since: 3.56
“active”
property “active” gboolean
Action's active state. It is relevant only for stateful actions, like toggle
actions (with a boolean state) or radio actions (with state and target).
See e_ui_action_get_active()
and e_ui_action_set_active()
for more information.
Owner: EUIAction
Flags: Read / Write
Default value: TRUE
Since: 3.56
“enabled”
property “enabled” gboolean
An enabled state of the action. When the action is part of an action group,
the EUIActionGroup
:sensitive is consulted together with the EUIAction
:sensitive
property when determining whether the action is enabled.
Owner: EUIAction
Flags: Read / Write
Default value: TRUE
Since: 3.56
“icon-name”
property “icon-name” char *
An icon name, which can be a standard icon name, or a text with prefix "gicon::", which are generated by the action owner through “create-gicon” signal. The signal is executed without the "gicon::" prefix.
Owner: EUIAction
Flags: Read / Write
Default value: NULL
Since: 3.56
“is-visible”
property “is-visible” gboolean
Read-only property to determine whether both EUIAction
:visible property and
possibly associated EUIActionGroup 's visible property are TRUE
.
Owner: EUIAction
Flags: Read
Default value: TRUE
Since: 3.56
“label”
property “label” char *
An action label.
Owner: EUIAction
Flags: Read / Write
Default value: NULL
Since: 3.56
“map-name”
property “map-name” char *
A GActionMap name the action is declared at. It usually matches EUIActionGroup name, when one is set on the action.
Owner: EUIAction
Flags: Read / Write / Construct Only
Default value: NULL
Since: 3.56
“name”
property “name” char *
An action name.
Owner: EUIAction
Flags: Read / Write / Construct Only
Default value: NULL
Since: 3.56
“parameter-type”
property “parameter-type” GVariantType *
A parameter type of a stateful action, as a GVariantType, or NULL
.
Owner: EUIAction
Flags: Read / Write / Construct Only
Since: 3.56
“sensitive”
property “sensitive” gboolean
Action's sensitive state. It does not consult associated EUIActionGroup sensitivity.
Owner: EUIAction
Flags: Read / Write
Default value: TRUE
Since: 3.56
“state”
property “state” GVariant *
A state of a stateful action, as a GVariant, or NULL
.
Owner: EUIAction
Flags: Read / Write
Allowed values: GVariant<*>
Default value: NULL
Since: 3.56
“state-hint”
property “state-hint” GVariantType *
A state hint of a stateful action, as a GVariantType, or NULL
.
Owner: EUIAction
Flags: Read / Write
Since: 3.56
“state-type”
property “state-type” GVariantType *
State type of a stateful action, as a GVariantType, or NULL
.
Owner: EUIAction
Flags: Read
Since: 3.56
“tooltip”
property “tooltip” char *
An action tooltip text (not markup).
Owner: EUIAction
Flags: Read / Write
Default value: NULL
Since: 3.56
“visible”
property “visible” gboolean
Whether the action is visible. It does not consult associated EUIActionGroup visibility.
Owner: EUIAction
Flags: Read / Write
Default value: TRUE
Since: 3.56
“accel-added”
signalvoid user_function (EUIAction *self, char *accel, gpointer user_data)
A signal emitted when the action has either set the primary accelerator or it has added a secondary accelerator.
self |
an EUIAction |
|
accel |
the added accelerator string |
|
user_data |
user data set when the signal handler was connected. |
Flags: Action
Since: 3.56
“accel-removed”
signalvoid user_function (EUIAction *self, char *accel, gpointer user_data)
A signal emitted when the action has either unset the primary
accelerator or it has removed a secondary accelerator.
The accel
is the removed accelerator string.
self |
an EUIAction |
|
accel |
the removed accelerator string |
|
user_data |
user data set when the signal handler was connected. |
Flags: Action
Since: 3.56
“activate”
signalvoid user_function (EUIAction *self, GVariant *parameter, gpointer user_data)
A signal emitted when the action should be activated.
The parameter
is provided only for stateful actions.
self |
an EUIAction |
|
parameter |
an activation parameter as a GVariant, or |
[nullable] |
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 3.56
“change-state”
signalvoid user_function (EUIAction *self, GVariant *new_state, gpointer user_data)
A signal emitted to set a new state to a stateful action.
self |
an EUIAction |
|
new_state |
a new state |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 3.56
“changed”
signalvoid user_function (EUIAction *self, gpointer user_data)
A signal emitted when the action changes its content. It's meant to be called when the menu content corresponding to this action should be regenerated, similar to when the “is-visible” property changes.
Flags: Action
Since: 3.56