After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 605266 - GtkBuilder UI's from glade cannot provide Accelerators unless whole UI is used
GtkBuilder UI's from glade cannot provide Accelerators unless whole UI is used
Status: RESOLVED OBSOLETE
Product: glade
Classification: Applications
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Glade 3 Maintainers
Glade 3 Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-12-22 22:16 UTC by j_lozinski
Modified: 2018-03-26 15:11 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description j_lozinski 2009-12-22 22:16:17 UTC
If you have just a menu for example within your UI (which will be perfectly valid) and wish to add into your existing ui, there is no way to get the accelerators as defined in the GTKBuilder xml file.

This means that if you want to dynamically load parts of your UI at run time (i.e, the whole point of XML layouts) you can't use glade xml files.  The upshot of which means that the only option is to hand-code the UI, Accels etc and ignore glade.

GtkBuilder should not *require* that a UI element exist to take the accelerators defined in the UI, but place them in an accessible method (GtkBuilder.get_accels()) so that you can place them in your own top level window rather than what GtkBuilder thinks.
Comment 1 j_lozinski 2009-12-22 22:19:29 UTC
perhaps I should be clearer, here's a pygtk snippet


mywin = gtk.Window()
builder = gtk.Builder()
builder.add_from_file("somegladefile.xml")
menu = builder.get_object("MyMenuWhichIsTheOnlyWidgetDefined")
mywin.add(menu)
mywin.show_all()
gtk.main()

This will correctly put the menu within the window, *however* there are no accelerators *even* if you're xml UI defines them.  what is required is:

accels = builder.get_accels() or builder.get_accels("SomeName")
mywin.set_accel_group(accels)

Hurray, Accelerators all from XML like they're supposed to work!
Comment 2 GNOME Infrastructure Team 2018-03-26 15:11:30 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glade/issues/54.