Re: menu accelerators not working



Paul Davis wrote:
On Sun, 2007-10-28 at 19:33 -0400, Philip Tricca wrote:
Anyone willing to help diagnose a problem?

I'm using the GtkUIManager to build my menus from GtkActionEntrys and
an
xml description.  Everything works great except for the accelerators.
I
can't seem to get them working at all, even the stock quit.

As a test I wrote a very simple application with only one "Quit" item
and some test code to query the accelerator map for the accelerators
associated with each menu item.  The accelerator for the quit action
is in the map and is the expected string ("<control>q"). Pressing
control q however on my computer does not activate the action.

the action must exist with a menu item as a proxy for the accelerator to
take effect. does the item exist in a menu?

Yes, I believe the item does exist in a menu. The actions are invoked when the menu item is selected manually with the mouse, and the actions have an accelerator path when queried using gtk_action_get_accel_path (action).

I've also written test code that queries the UIManager for the menu item widget:

gtk_ui_manager_get_widget (ui_mgr, "/menubar/FileMenu/Quit").

The associated action can be got using the gtk_widget_get_action call which returns an action object with the same action accel path as when querying the Action directly.

I'm even able to save the accel map to an rc file using gtk_accel_map_save. The accel rc file looks like:

; menu-test GtkAccelMap rc-file        -*- scheme -*-
; this file is an automated accelerator map dump
;
; (gtk_accel_path "<Actions>/MenuActions/QuitAction" "<Control>q")

I can post my test code if you're willing to take a look. I'm pretty stumped.

Thanks much for your help,
- Philip




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]