Description [src]

final class Gtk.AccelMap : GObject.Object
  /* No available fields */

Accelerator maps are used to define runtime configurable accelerators. Functions for manipulating them are are usually used by higher level convenience mechanisms like GtkUIManager and are thus considered “low-level”. You’ll want to use them if you’re manually creating menus that should have user-configurable accelerators.

An accelerator is uniquely defined by: - accelerator path - accelerator key - accelerator modifiers

The accelerator path must consist of “/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: “/File/Dialogs/Tool Options…”.

All accelerators are stored inside one global GtkAccelMap that can be obtained using gtk_accel_map_get(). See [Monitoring changes][monitoring-changes] for additional details.

Manipulating accelerators

New accelerators can be added using gtk_accel_map_add_entry(). To search for specific accelerator, use gtk_accel_map_lookup_entry(). Modifications of existing accelerators should be done using gtk_accel_map_change_entry().

In order to avoid having some accelerators changed, they can be locked using gtk_accel_map_lock_path(). Unlocking is done using 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, gtk_accel_map_save() and gtk_accel_map_load() are provided. Saving and loading can also be done by providing file descriptor to gtk_accel_map_save_fd() and gtk_accel_map_load_fd().

Monitoring changes

GtkAccelMap object is only useful for monitoring changes of accelerators. By connecting to GtkAccelMap::changed signal, one can monitor changes of all accelerators. It is also possible to monitor only single accelerator path by using it as a detail of the GtkAccelMap::changed signal.


hierarchy this GtkAccelMap ancestor_0 GObject ancestor_0--this




Registers a new accelerator with the global accelerator map. This function should only be called once per accel_path with the canonical accel_key and accel_mods for this path. To change the accelerator during runtime programatically, use gtk_accel_map_change_entry().


Adds a filter to the global list of accel path filters.


Changes the accel_key and accel_mods currently associated with accel_path. Due to conflicts with other accelerators, a change may not always be possible, replace indicates whether other accelerators may be deleted to resolve such conflicts. A change will only occur if all conflicts could be resolved (which might not be the case if conflicting accelerators are locked). Successful changes are indicated by a TRUE return value.


Loops over the entries in the accelerator map whose accel path doesn’t match any of the filters added with gtk_accel_map_add_filter(), and execute foreach_func on each. The signature of foreach_func is that of GtkAccelMapForeach, the changed parameter indicates whether this accelerator was changed during runtime (thus, would need saving during an accelerator map dump).


Loops over all entries in the accelerator map, and execute foreach_func on each. The signature of foreach_func is that of GtkAccelMapForeach, the changed parameter indicates whether this accelerator was changed during runtime (thus, would need saving during an accelerator map dump).


Gets the singleton global GtkAccelMap object. This object is useful only for notification of changes to the accelerator map via the ::changed signal; it isn’t a parameter to the other accelerator map functions.

since: 2.4


Parses a file previously saved with gtk_accel_map_save() for accelerator specifications, and propagates them accordingly.


Filedescriptor variant of gtk_accel_map_load().


GScanner variant of gtk_accel_map_load().


Locks the given accelerator path. If the accelerator map doesn’t yet contain an entry for accel_path, a new one is created.

since: 2.4


Looks up the accelerator entry for accel_path and fills in key.


Saves current accelerator specifications (accelerator path, key and modifiers) to file_name. The file is written in a format suitable to be read back in by gtk_accel_map_load().


Filedescriptor variant of gtk_accel_map_save().


Undoes the last call to gtk_accel_map_lock_path() on this accel_path. Refer to gtk_accel_map_lock_path() for information about accelerator path locking.

since: 2.4

Instance methods

Methods inherited from GObject (43)

Please see GObject for a full list of methods.



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.

since: 2.4

Signals inherited from GObject (1)

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct GtkAccelMapClass {
  /* no available fields */
No description available.