Package: gio

Interface g-action-group

Superclasses

g-object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

Direct Slots

None

Details

The g-action-group interface 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 g-menu-model object 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 g-action-group object is to activate them with the g-action-group-activate-action function. Activating an action may require a g-variant parameter. The required type of the parameter can be inquired with the g-action-group-action-parameter-type function. Actions may be disabled, see the g-action-group-action-enabled function. Activating a disabled action has no effect.

Actions may optionally have a state in the form of a g-variant parameter. The current state of an action can be inquired with the g-action-group-action-state function. Activating a stateful action may change its state, but it is also possible to set the state by calling the g-action-group-change-action-state function.

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 the g-action-group-list-actions function take the name of an action as an argument.

The g-action-group API is meant to be the 'public' API to the action group. The calls here are exactly the interaction that 'external forces', e.g. UI, incoming D-Bus messages, etc., are supposed to have with actions. 'Internal' APIs, i.e. ones meant only to be accessed by the action group implementation, are found on subclasses. This is why you will find - for example - the g-action-group-action-enabled function but not an equivalent (setf g-action-group-action-enabled) function.

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

Implementations of the g-action-group interface should provide implementations for the g-action-group-list-actions and g-action-group-query-action virtual functions. The other virtual functions should not be implemented - their "wrappers" are actually implemented with calls to the g-action-group-query-action function.

Signal Details

The "action-added" signal
 lambda (group name)    :detailed      
Signals that a new action was just added to the group. The signal is emitted after the action has been added and is now visible.
group
The g-action-group object that changed.
name
A string with the name of the action.
The "action-enabled-changed" signal
 lambda (group name enabled)    :detailed      
Signals that the enabled status of the named action has changed.
group
The g-action-group object that changed.
name
A string with the name of the action.
enabled
A boolean whether the action is enabled or not.
The "action-removed" signal
 lambda (group name)    :detailed      
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.
group
The g-action-group object that changed.
name
A string with the name of the action.
The "action-state-changed" signal
 lambda (group name parameter)    :detailed      
Signals that the state of the named action has changed.
group
The g-action-group object that changed.
name
A string with the name of the action.
parameter
The new g-variant parameter of the state.
 

Inherited Slot Access Functions

See also

2021-9-8