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 516425 - Optionally display accelerators in popups
Optionally display accelerators in popups
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: UIManager / Actions
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-02-14 11:38 UTC by Michael Natterer
Modified: 2008-12-19 11:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch implementing the above (8.18 KB, patch)
2008-02-14 11:40 UTC, Michael Natterer
needs-work Details | Review
Updated patch (8.25 KB, patch)
2008-09-23 13:45 UTC, Michael Natterer
accepted-commit_now Details | Review

Description Michael Natterer 2008-02-14 11:38:49 UTC
GtkUIManager-created <popup> menus don't show accelerators. While this
policy is completely reasonable on the desktop, it is a *policy* that
is inappropriate on certain platforms (e.g. embedded systems, in this
case maemo) where the platform might choose to have a popup menu
as toplevel menu (instead of a menu bar).

Attached patch allows to have accels in individual popup menus,
by either saying

<popup accelerators="true"> in the xml

or using

GTK_UI_MANAGER_POPUP_WITH_ACCEL in gtk_ui_manager_add_ui().
Comment 1 Michael Natterer 2008-02-14 11:40:02 UTC
Created attachment 105220 [details] [review]
Patch implementing the above
Comment 2 Matthias Clasen 2008-02-16 03:14:15 UTC
Mitch, what did we discuss about this patch ? 
I think we wanted to make ui manager swallow unknown attributes.
Comment 3 Michael Natterer 2008-02-27 12:00:25 UTC
Yes we wanted to do that. But in the meantime I wonder if that
shouldn't be simply a boolean property on GtkAction, just
as there are many other obscure special-case properties.

As in:

g_object_set (action, "popup-accelerators", TRUE, NULL);

Which would require people to keep around a special action
for the popup menu, which is probably not asked too much.

I'm really not sure what the "right" way is here.
Comment 4 Sven Neumann 2008-06-13 08:41:40 UTC
I am working on the GIMP help browser currently and there it would be really nice to have this feature. The browser window is supposed to be very compact and I don't want to add a menubar as most functionality is accessible from the toolbar already. For the sake of discoverability it would be nice if the right-click popup menu showed the accelerators though.

I favor the approach of specifying this in the UI manager XML. In my opinion this is an option of the view. Making it a property of the model (the action), would be wrong, IMO.
Comment 5 Christian Dywan 2008-06-13 08:55:01 UTC
Going through the three options you suggested:

> GTK_UI_MANAGER_POPUP_WITH_ACCEL

That seems a bit awkward. All of the present types map to widget types. This one would only be a special cased variant of GTK_UI_MANAGER_POPUP.

> <popup accelerators="true"> in the xml

Looks fine in the markup. If you know at creating time of the popup whether you need accelerators or not, this could work.

> g_object_set (action, "popup-accelerators", TRUE, NULL);

This is, imho, too specialized, compared to what GtkAction currently has. Even compared to the less generic properties. On the other hand, if you need to show or hide accelerators at runtime, it's the only viable way I can see.
Comment 6 Michael Natterer 2008-06-13 10:45:40 UTC
re comment #2, we skip unknown attributes now, which is the right
thing to do regardless of whether this patch is right or not:

2008-06-13  Michael Natterer  <mitch@imendio.com>

	* gtk/gtkuimanager.c (start_element_handler): silently skip
	unknown attributes instead of bailing out with an error in order
	to be compatible with possible future attribute names.

	This is related to the discussion in bug #516425 but actually
	needed for any kind of XML format extension.
Comment 7 André Klapper 2008-08-06 13:28:20 UTC
Downstream bug: https://bugs.maemo.org/show_bug.cgi?id=2281
Comment 8 Michael Natterer 2008-09-23 13:45:29 UTC
Created attachment 119222 [details] [review]
Updated patch

Same patch, but applies without conflicts on top of trunk.
Comment 9 Matthias Clasen 2008-09-27 01:03:10 UTC
Ok, lets do this, I guess.
Comment 10 Michael Natterer 2008-10-09 08:51:51 UTC
Fixed in SVN:

2008-10-09  Michael Natterer  <mitch@imendio.com>

	Bug 516425 – Optionally display accelerators in popups

	* gtk/gtkuimanager.h (enum GtkUIManagerItemType): add value
	GTK_UI_MANAGER_POPUP_WITH_ACCELS which works like _POPUP but
	shows the actions' accelerators.

	* gtk/gtkuimanager.c: honor the new enum value for programmatically
	created UIs, and support <popup accelerators="true"> in the XML
	for the same purpose.

2008-10-09  Michael Natterer  <mitch@imendio.com>

	Bug 516425 – Optionally display accelerators in popups

	* gtk/tmpl/gtkuimanager.sgml: document the enhanced XML syntax and
	the new enum value for popups with accelerators.