GNOME Bugzilla – Bug 699290
API request: MenuItem has no function to set the accelerator key
Last modified: 2013-05-11 08:23:45 UTC
There is no direct function to set the accelerator on a MenuItem. Only by reading GtkMenuItem source code, I could find out that its Label is actually an AccelLabel, and that we can set its accelerator key. Then we need to know that the MenuItem is also a Bin, and that its child is the AccelLabel. Then we can call gtk_accel_label_set_accel(). I suggest to add: void gtk_menu_item_set_accel (GtkMenuItem *menu_item, guint accelerator_key, GdkModifierType accelerator_mods); (I can provide a patch, if it makes sense)
Doesn't make much sense, no. There's nothing wrong with directly accessing the accel label inside the menuitem, if you need to.
(similar to bug 699289, extract from bug 699289, comment 2) From an application developer point of view, looking at the documentation, it is hidden. You have to discover it. You need a certain knowledge of GTK+ to figure it out. Certainly a piece of cake for an advanced GTK+ developer, but not for everybody. Maybe the API could be a bit more consistent here. I think that this is at least missing in the documentation.
> You need a certain knowledge of GTK+ to figure it out. Thats generally true when using any complex library. Closing this since I don't want to carry around more open documentation bugs - feel free to reopen if you have a patch to attach.
fixed by bug 699289