GNOME Bugzilla – Bug 118906
key accelerator in popup menu
Last modified: 2011-07-19 23:27:09 UTC
key accelerator in popup menu does not work. My application even crashes when I have keyboard accelerator defined in the popup menu.
Key accelerators are not shown in popup menus with my version of libglade either. gtk2-2.4.7-2.5 libglade2-2.3.6-1 (same happens with current HEAD, latest ChangeLog entry 2004-09-23) Test case attached below. Compile with: gcc -Wall -o test `pkg-config --cflags --libs libglade-2.0 gtk+-2.0 libgnomeui-2.0` test.c Run "./test" and click on the "Click Me!" button, you'll see the warning, and the accelerator being set to "-/-". $ ./test ** Message: button pressed (test:17375): Gtk-CRITICAL **: file gtkaccelgroup.c: line 267 (gtk_accel_group_find): assertion `GTK_IS_ACCEL_GROUP (accel_group)' failed
Created attachment 31937 [details] popup-accel.tar.gz
Sorry about not replying to this earlier -- I had no idea what would be causing the problem, and didn't get round to investigating. The answer to this question may simply be "don't do that" :) When libglade is building a user interface, it creates a new accel group for each toplevel. So a popup menu defined like this will have its accelerators registered in a new group. This accel group isn't being referenced anywhere else, so gets freed when libglade moves on to the next window. Now, since it is a separate accel group, none of the accelerators will actually be available in any of the other toplevels. Automatically adding the accel group to other toplevels would be a problem for the case where a glade file contains more than one toplevel window (which one(s) do you add it to?). The warning seems to be a bug in GtkAccelGroup where it doesn't handle the accel group for the closure it is watching disappearing from under it (and it doesn't hold a reference to it either).
The GNOME Release team has officially deprecated libglade in favor of GtkBuilder[1]. So it's unlikely to get further development. I am closing bugs as WONTFIX. Please feel free to reopen the bugs in future if anyone takes the responsibility for active development. [1] http://permalink.gmane.org/gmane.comp.gnome.devel.announce/28