Re: replacement for GtkImageMenuItem



On 03/23/2014 02:45 PM, Emmanuele Bassi wrote:
there is no need for you to become adversarial and aggressive.

Arg that was not my intention at all.

considering that every GTK application is basically a collection of
boxes inside boxes, adding a box inside a menu item is not a huge
change in terms of semantics. it's even hardly comparable to pushing
pixels.

Sure, but the goal of a GUI toolkit is to simplify things, and image
menuitems sounds common enough to have this implemented, as it was in
GTK2. And adding this GtkBox in GtkMenuItem is not possible from Glade.
I have about 100 GtkImageMenuItem in my ui files, having to add 100 time
the GtkBox + iconisn't very nice :/

on top of that, you *can* still use the deprecated API. deprecated
just means that it won't be available in the next GTK+ major release,
which at this point is neither planned nor in progress.

Sure, but I don't want to re-do my whole code on each GTK release. I
prefer to folloow the GTK logic.

What I mean is that: is the idea to not have images at all in GTK? That
sounds a big go backward to me, no?

neither.

there are various reasons to move away from images inside menu items,
except for something fairly specific like "noun" menu items (e.g.
bookmarks to web pages, or files) instead of putting an icon
everywhere. there are various scientific studies that lend weight to
the fact that users do not actually use images to recognize items, and
that words hold a better usability. a quick summary with links can be
found here:

http://uxmyths.com/post/715009009/myth-icons-enhance-usability

Ok so the idea is to remove images from menuitems. But GTK3 apps still
have images. Maybe this is the idea on long therm?

again, the Human Interface Guidelines for menus I linked in my email
explains why and where you should use images in menu items.

I read it but didn't found any mention to images.

I think you're grossly overestimating what GtkImageMenuItem does: all
it does is just placing two items inside an horizontal container.

Ok, never read the details.

How can I handle images from glade?

you should be able to modify menus from Glade. you should even be able
to use templates to create menu item subclasses that have an image
packed as you wish.

modify menu yes, but I can't place a GtkBox in a menuitem.
I don't know what templates are, but you see how hard it is to have just
a ImageMenuItem? But if the goal is to completly remove iamges in
menuitems, that's understandable.

I'm not sure if Glade supports the menu definition using GAction and
GMenu, yet; I'm sure if it doesn't, then it's planned and in progress.

Indeed everything I can find is that it doesn't support it.

nothing wrong with that. you have to understand, though, that GTK+
also caters to application developers and designers that do *not* want
that to happen for a variety of reasons, all as valid as your own.

that's the main drive that led to the deprecation of the
gtk-menu-images and gtk-button-images settings: it's possible for you
to allow users to change these settings, but if the setting is
toolkit-wide then it becomes impossible for them to achieve what
*they* want.

Why can't the toolkit handle the gtk-menu-images option? Then app
developpers can override that property if they want?

if you want your users to change the way your application behaves, and
possibly how it looks, just by toggling a setting then yes: you have
to catch a notification on the property change, and update the
visibility of the GtkImage you packed inside the menu item. you can
easily do this with your own GtkMenuItem subclass. this is what
GtkImageMenuItem does.

Ok. Once again, strange that the toolkit removes a feature that has now
to be implemented in all applications. There are probably good reasons,
but from an app developper point of view that is seen as "GTK don't want
to do the job itself, so do it yourself"

if you're not running an XSETTINGS daemon that proxies settings to the
toolkits, then you'll have to use a settings.ini file inside
$XDG_CONFIG_HOME/gtk-3.0. I honestly don't remember if XFCE has that.

if it does not work, you should ask the XFCE developers.

I set gtk-menu-images to true in settings.ini, still no icons for close
button in about dialog. Note that I have icons in menuitems in evince
for example. Only the close button in about dialog don't. Credits button
has an icon.


To conclude, my options are:
 - remove images from menuitems as GTK is suggested me to do.
 - If I want to keep images, I can:
   - use deprecated code
   - switch to GMenu (and write the GUI part in code or write XML file
by hand)
   - add GtkBox in menuitems (I have to do it from my code, or document
myself and do a template to create a menuitem subclass as you suggested)


Thanks for your answers
-- 
Yann



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