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 752093 - Improvement to GtkImageMenuItem long description and code snippet
Improvement to GtkImageMenuItem long description and code snippet
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Documentation
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-07-07 18:56 UTC by Eric Williams
Modified: 2015-07-08 17:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Improved description and code snippet for GtkImageMenuItem.c (2.01 KB, patch)
2015-07-07 18:56 UTC, Eric Williams
committed Details | Review

Description Eric Williams 2015-07-07 18:56:41 UTC
Created attachment 307029 [details] [review]
Improved description and code snippet for GtkImageMenuItem.c

Since GtkImageMenuItem is deprecated, the documentation page provides an example code snippet that demonstrates how to produce the equivalent functionality using a GtkMenuItem.

I discovered, however, that when you create a keyboard accelerator and try to attach it to a custom GtkMenuItem (containing a box as a child), the currently provided code snippet fails. In order to correctly attach a keyboard accelerator, you have to use gtk_box_pack_end(), in addition to aligning the label. An good example of this can be found here (lines 81-94): https://git.gnome.org/browse/gtk+/tree/tests/teststockbuttonmenu.c

Since gtk_image_menu_item_new_with_label() is commonly used, I think it is valuable to explain the equivalent functionality using GtkMenuItem.

I have attached a proposed patch to the documentation that includes a short explanatory paragraph and an additional updated snippet.
Comment 1 Matthias Clasen 2015-07-08 17:52:16 UTC
thanks, thats useful information to add