GNOME Bugzilla – Bug 695917
Allow specifying multiple accelerators for the same action
Last modified: 2014-03-10 23:21:27 UTC
gtk_application_add_accelerator() will check if there is already a given accelerator for a given action, and if there is one, it will replace it with the new one passed. This actually blocks having more than one accelerator for the same action.
The code doing the lookup is doing this because gtk_accel_map_add_entry() documents this; but that's not the cause of there only being one accel per action allowed. The accel path is derived from the action name and its parameter GVariant, and the accel map can only have one entry for each accel path.
It makes gtk_application_add_accelerator() pretty useless for any application that wants to have 2 bindings for the same action. One would probably handle all the keyboard shortcuts by hand, or by installing an accel, not doing both.
*** Bug 693830 has been marked as a duplicate of this bug. ***
gtk_application_set_accels_for_action() exists for a little while now...
As for gtk_application_add_accelerator(): it has always replaced the existing accel, so I think it would be an incompatible change to make it add and keep the old one. Perhaps we should deprecate it for having a confusing name.
Created attachment 271491 [details] [review] Patch to handle multiple accels per action in _initAction it is now checked, if actionEntry.accel is an array, if so, the new function "set_accels_for_action()" is used.