ActionGroupIF

gtk.ActionGroup represents a group of actions. Actions can be used to expose functionality in a structured way, either from one part of a program to another, or to the outside world. Action groups are often used together with a gio.MenuModel that provides additional representation data for displaying the actions to the user, e.g. in a menu.

The main way to interact with the actions in a GActionGroup is to activate them with Action.groupActivateAction. Activating an action may require a glib.Variant parameter. The required type of the parameter can be inquired with Action.groupGetActionParameterType. Actions may be disabled, see Action.groupGetActionEnabled. Activating a disabled action has no effect.

Actions may optionally have a state in the form of a glib.Variant The current state of an action can be inquired with Action.groupGetActionState. Activating a stateful action may change its state, but it is also possible to set the state by calling Action.groupChangeActionState.

As typical example, consider a text editing application which has an option to change the current font to 'bold'. A good way to represent this would be a stateful action, with a boolean state. Activating the action would toggle the state.

Each action in the group has a unique name (which is a string). All method calls, except Action.groupListActions take the name of an action as an argument.

The gtk.ActionGroup API is meant to be the 'public' API to the action group. The calls here are exactly the interaction that 'external forces' (eg: UI, incoming D-Bus messages, etc.) are supposed to have with actions. 'Internal' APIs (ie: ones meant only to be accessed by the action group implementation) are found on subclasses. This is why you will find - for example - Action.groupGetActionEnabled but not an equivalent set() call.

Signals are emitted on the action group in response to state changes on individual actions.

Implementations of gtk.ActionGroup should provide implementations for the virtual functions Action.groupListActions and Action.groupQueryAction. The other virtual functions should not be implemented - their "wrappers" are actually implemented with calls to Action.groupQueryAction.

Members

Functions

actionAdded
void actionAdded(string actionName)

Emits the action-added signal on action_group.

actionEnabledChanged
void actionEnabledChanged(string actionName, bool enabled)

Emits the action-enabled-changed signal on action_group.

actionRemoved
void actionRemoved(string actionName)

Emits the action-removed signal on action_group.

actionStateChanged
void actionStateChanged(string actionName, Variant state)

Emits the action-state-changed signal on action_group.

activateAction
void activateAction(string actionName, Variant parameter)

Activate the named action within action_group.

addOnActionAdded
gulong addOnActionAdded(void delegate(string, ActionGroupIF) dlg, ConnectFlags connectFlags)

Signals that a new action was just added to the group. This signal is emitted after the action has been added and is now visible.

addOnActionEnabledChanged
gulong addOnActionEnabledChanged(void delegate(string, bool, ActionGroupIF) dlg, ConnectFlags connectFlags)

Signals that the enabled status of the named action has changed.

addOnActionRemoved
gulong addOnActionRemoved(void delegate(string, ActionGroupIF) dlg, ConnectFlags connectFlags)

Signals that an action is just about to be removed from the group. This signal is emitted before the action is removed, so the action is still visible and can be queried from the signal handler.

addOnActionStateChanged
gulong addOnActionStateChanged(void delegate(string, Variant, ActionGroupIF) dlg, ConnectFlags connectFlags)

Signals that the state of the named action has changed.

changeActionState
void changeActionState(string actionName, Variant value)

Request for the state of the named action within action_group to be changed to value.

getActionEnabled
bool getActionEnabled(string actionName)

Checks if the named action within action_group is currently enabled.

getActionGroupStruct
GActionGroup* getActionGroupStruct(bool transferOwnership)

Get the main Gtk struct

getActionParameterType
VariantType getActionParameterType(string actionName)

Queries the type of the parameter that must be given when activating the named action within action_group.

getActionState
Variant getActionState(string actionName)

Queries the current state of the named action within action_group.

getActionStateHint
Variant getActionStateHint(string actionName)

Requests a hint about the valid range of values for the state of the named action within action_group.

getActionStateType
VariantType getActionStateType(string actionName)

Queries the type of the state of the named action within action_group.

getStruct
void* getStruct()

the main Gtk struct as a void*

hasAction
bool hasAction(string actionName)

Checks if the named action exists within action_group.

listActions
string[] listActions()

Lists the actions contained within action_group.

queryAction
bool queryAction(string actionName, bool enabled, VariantType parameterType, VariantType stateType, Variant stateHint, Variant state)

Queries all aspects of the named action within an action_group.

Static functions

getType
GType getType()