Package: gio

Class g-simple-action

Superclasses

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

Documented Subclasses

None

Direct Slots

enabled
The enabled property of type :boolean (Read / Write)
Whether the action is currently enabled. If the action is disabled then calls to the functions g-action-activate and g-action-change-state have no effect.
Default value: true
name
The name property of type :string (Read / Write / Construct Only)
The name of the action. This is mostly meaningful for identifying the action once it has been added to a g-simple-action-group object.
Default value: nil
parameter-type
The parameter-type property of type g-variant-type (Read / Write / Construct Only)
The type of the parameter that must be given when activating the action.
state
The state property of type g-variant (Read / Write / Construct)
The state of the action, or nil if the action is stateless.
Allowed values: GVariant<*>
Default value: nil
state-type
The state-type property of type g-variant-type (Read)
The type of the state that the action has, or nil if the action is stateless.

Details

A g-simple-action object is the obvious simple implementation of the g-action interface. This is the easiest way to create an action for purposes of adding it to a g-simple-action-group object.

Signal Details

The "activate" signal
 lambda (action parameter)    :run-last      
Indicates that the action was just activated. The argument parameter will always be of the expected type. In the event that an incorrect type was given, no signal will be emitted.
action
The g-simple-action object.
parameter
The g-variant parameter to the activation.
The "change-state" signal
 lambda (action value)    :run-last      
Indicates that the action just received a request to change its state. The argument value will always be of the correct state type. In the event that an incorrect type was given, no signal will be emitted.

If no handler is connected to this signal then the default behaviour is to call the function g-simple-action-state to set the state to the requested value. If you connect a signal handler then no default action is taken. If the state should change then you must call the function g-simple-action-state from the handler.

Example: Implementation of a "change-state" handler
(g-signal-connect action "change-state"
                  (lambda (action value)
                    (let ((requested (g-variant-int32 value)))
                      ;; Volume only goes from 0 to 10
                      (when (and (>= requested 0) (<= requested 10))
                        (setf (g-simple-action-state action) value)))))      
The handler need not set the state to the requested value. It could set it to any value at all, or take some other action.
action
The g-simple-action object.
value
The requested g-variant value for the state.
 

Slot Access Functions

Inherited Slot Access Functions

See also

2021-8-1