Package: gio

Function g-action-map-add-action-entries

Lambda List

g-action-map-add-action-entries (map entries)

Arguments

map -- a g-action-map object
entries -- a list of descriptions for the actions

Details

A convenience function for creating multiple g-simple-action instances and adding them to a g-action-map object.

Each action in the entries list is constructed from the following parameters:
name
A string with the name of the action.
activate
The callback function to connect to the "activate" signal of the action. This can be nil for stateful actions, in which case the default handler is used. For boolean-stated actions with no parameter, this is a toggle. For other state types, and parameter type equal to the state type, this will be a function that just calls the change-state callback function, which you should provide.
parameter-type
The type of the parameter that must be passed to the activate function for this action, given as a single g-variant-type parameter type string, or nil for no parameter.
state
The initial state for this action, given in g-variant text format. The state is parsed with no extra type information, so type tags must be added to the string if they are necessary. Stateless actions should give nil here.
change-state
The callback function to connect to the "change-state" signal of the action. All stateful actions should provide a handler here, stateless actions should not.
All values after name are optional. Additional optional fields may be added in the future.

Example

Using the g-action-map-add-action-entries function:
(defun activate-quit (action parameter)
  (declare (ignore action parameter)))

(defun activate-print (action parameter) (declare (ignore action parameter)))

(defun create-action-group () (let ((entries (list (list "quit" #'activate-quit) (list "print" #'activate-print "s"))) (group (g-simple-action-group-new))) (g-action-map-add-action-entries group entries) group))
 

See also

*2021-10-10