Package: gio

Class gio:simple-action

Superclasses

gio:action, gobject: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 g:action-activate and g:action-change-state functions 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:action-map instance.
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 the cffi:null-pointer value if the action is stateless.
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

The g:simple-action class 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      
action
The g:simple-action object.
parameter
The g:variant parameter to the activation.
Indicates that the action was just activated. The parameter argument will always be of the expected type. In the event that an incorrect type was given, no signal will be emitted.
The "change-state" signal
lambda (action value)    :run-last      
action
The g:simple-action object.
value
The requested g:variant parameter for the state.
Indicates that the action just received a request to change its state. The value argument 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 g:simple-action-state function 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 g:simple-action-state function from the handler.

Examples: Implementation of a "change-state" signal handler:
(g:signal-connect action "change-state"
                  (lambda (simple 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 simple) 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.
 

Returned by

Slot Access Functions

Inherited Slot Access Functions

See also

2024-12-29