Package: gtk

Class gtk-accel-map

Superclasses

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

Documented Subclasses

None

Direct Slots

None

Details

Accelerator maps are used to define runtime configurable accelerators. Functions for manipulating them are usually used by higher level convenience mechanisms like gtk-ui-manager and are thus considered "low-level". You will want to use them if you are manually creating menus that should have user-configurable accelerators.

An accelerator is uniquely defined by:
  • an accelerator path,
  • an accelerator key, and
  • accelerator modifiers.
The accelerator path must consist of "<WINDOWTYPE>/Category1/Category2/.../Action", where WINDOWTYPE should be a unique application specific identifier that corresponds to the kind of window the accelerator is being used in, e.g. "Gimp-Image", "Abiword-Document" or "Gnumeric-Settings". The "Category1/.../Action" portion is most appropriately chosen by the action the accelerator triggers, i.e. for accelerators on menu items, choose the item's menu path, e.g. "File/Save As", "Image/View/Zoom" or "Edit/Select All". So a full valid accelerator path may look like: "<Gimp-Toolbox>/File/Dialogs/Tool Options...".

All accelerators are stored inside one global gtk-accel-map object that can be obtained using the function gtk-accel-map-get. See Monitoring changes for additional details.

Manipulating accelerators
New accelerators can be added using the function gtk-accel-map-add-entry. To search for a specific accelerator, use the function gtk-accel-map-lookup-entry. Modifications of existing accelerators should be done using the function gtk-accel-map-change-entry.

In order to avoid having some accelerators changed, they can be locked using the function gtk-accel-map-lock-path. Unlocking is done using the function gtk-accel-map-unlock-path.

Saving and loading accelerator maps
Accelerator maps can be saved to and loaded from some external resource. For simple saving and loading from file, the functions gtk-accel-map-save and gtk-accel-map-load are provided.

Monitoring changes
A gtk-accel-map object is only useful for monitoring changes of accelerators. By connecting to the "changed" signal, one can monitor changes of all accelerators. It is also possible to monitor only a single accelerator path by using it as a detail of the "changed" signal.

Signal Details

The "changed" signal
 lambda (object accel-path accel-key accel-mods)    : Has Details      
Notifies of a change in the global accelerator map. The path is also used as the detail for the signal, so it is possible to connect to "changed::accel-path".
object
The global gtk-accel-map object.
accel-path
The path of the accelerator that changed of type :string.
accel-key
The key value of type :uint for the new accelerator.
accel-mods
The modifier mask of type gdk-modifier-type for the new accelerator.
 

Inherited Slot Access Functions

See also

2020-9-20