Re: replacement for GtkImageMenuItem

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

 



Hello,

On Sun, 23 Mar 2014 11:38:23 +0000
Emmanuele Bassi <ebassi@xxxxxxxxx> wrote:

> hi;
> 
> On 23 March 2014 09:25, Yann Leboulanger <asterix@xxxxxxxxxxx> wrote:
> 
> > GtkImageMenuItem is now deprecated, but I see no replacement of it.
> > So I see no way to have a menuitem with an image. What am I missing?
> 
> GtkMenuItem is a GtkBin container, so you can pack a GtkBox with an
> image and a label; this also has the benefit of always working
> regardless of tweaks like show/hide images in menus.
> 

I see no benefit in such thing, since I do not use images in menus. Is
it still possible to have images in menus while still having an ability
to hide them?

> if you're using GMenu to describe your menus then you can use
> g_menu_item_set_icon() to add an icon to the menu item:
> 
> https://developer.gnome.org/gio/unstable/GMenu.html#g-menu-item-set-icon
> 
> there's also the icon attribute in the XML. you should also read the
> API documentation, and the HIG section on menus:
> 
> https://wiki.gnome.org/Design/HIG/Menus
> 
> > I also saw that in your documents:
> >
> > Old:
> > item = gtk_image_menu_item_new_from_stock (GTK_STOCK_SAVE, NULL);
> >
> > New:
> > item = gtk_menu_item_new_with_mnemonic (_(“_Save”));
> >
> > I tried that (from python bindings):
> > item = Gtk.MenuItem.new_with_mnemonic(_("_Save"))
> >
> > And I see no image.
> 
> icons in menus are hidden by default, by the gtk-menu-images
> GtkSettings property. you can set the property to TRUE for your
> application using:
> 
> g_object_set (gtk_settings_get_default (), "gtk-menu-images",
> TRUE, NULL);
> 
> but gtk-menu-images is a deprecated tweak that will not be honoured by
> newly written widgets.
> 
> the proper way to ensure that you control the visibility of images in
> menus and buttons is to pack those images inside the widgets yourself.
> 
> ciao,
> Emmanuele.
> 


-- 
Defending the constitution is expensive!
Help Lavabit.com by donating to the Lavabit Legal Defense Fund
http://lavabit.com/ <support@xxxxxxxxxxx>
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list





[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux