[gtk+] docs: Add replacement example for ImageMenuItem



commit 183257f9e1442d6053eac0a98396d8407f129667
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Oct 23 17:42:19 2014 +0100

    docs: Add replacement example for ImageMenuItem
    
    Otherwise we will be doomed to answer the question of how to replace
    GtkImageMenuItem for all eternity.

 gtk/deprecated/gtkimagemenuitem.c |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/gtk/deprecated/gtkimagemenuitem.c b/gtk/deprecated/gtkimagemenuitem.c
index 73debc9..e308d51 100644
--- a/gtk/deprecated/gtkimagemenuitem.c
+++ b/gtk/deprecated/gtkimagemenuitem.c
@@ -49,8 +49,36 @@
  *
  * A GtkImageMenuItem is a menu item which has an icon next to the text label.
  *
- * Note that the user can disable display of menu icons, so make sure to still
- * fill in the text label.
+ * This is functionally equivalent to:
+ *
+ * |[<!-- language="C" -->
+ *   GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ *   GtkWidget *icon = gtk_image_new_from_icon_name ("folder-music-symbolic, GTK_ICON_SIZE_MENU);
+ *   GtkWidget *label = gtk_label_new ("Music");
+ *   GtkWidget *menu_item = gtk_menu_item_new ();
+ *
+ *   gtk_container_add (GTK_CONTAINER (box), icon);
+ *   gtk_container_add (GTK_CONTAINER (box), label);
+ *
+ *   gtk_container_add (GTK_CONTAINER (menu_item), box);
+ *
+ *   gtk_widget_show_all (menu_item);
+ * ]|
+ *
+ * Note that the user may disable display of menu icons using
+ * the #GtkSettings:gtk-menu-images setting, so make sure to still
+ * fill in the text label. If you want to ensure that your menu items
+ * show an icon you are strongly encouraged to use a #GtkMenuItem
+ * with a #GtkImage instead.
+ *
+ * #GtkImageMenuItem has been deprecated since GTK+ 3.10. If you want to
+ * display an icon in a menu item, you should use #GtkMenuItem and pack a
+ * #GtkBox with a #GtkImage and a #GtkLabel instead. You should also consider
+ * using #GtkBuilder and the XML #GMenu description for creating menus, by
+ * following the [GMenu guide][https://developer.gnome.org/GMenu/]. You should
+ * consider using icons in menu items only sparingly, and for "objects" (or
+ * "nouns") elements only, like bookmarks, files, and links; "actions" (or
+ * "verbs") should not have icons.
  */
 
 


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