Re: Stock items (button images / menu images etc)






From: Emmanuele Bassi <ebassi gmail com>
To: David Buchan <pdbuchan yahoo com>
Cc: gtk-list list <gtk-list gnome org>
Sent: Friday, December 13, 2013 11:34 AM
Subject: Re: Stock items (button images / menu images etc)

hi;

On 13 December 2013 16:16, David Buchan <pdbuchan yahoo com> wrote:

> If I understand correctly, I should replace:
>
> GtkWidget *image;
>
> image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR,
> GTK_ICON_SIZE_DIALOG);
>
> with
> GtkWidget *image;
>
> image = gtk_image_new_from_icon_name ("dialog-error", GTK_ICON_SIZE_DIALOG);
>
> Would that be correct?

if you're using GTK+ 3.x, then yes: that's the correct migration.

all (new|set)_from_stock() should be replaced with (new|set)_from_icon_name().

in general, you should also question the icons usage: overloading the
UI with visual cues ends up distracting the user, and in general the
written word is more apt to describe actions than a bare icon, unless
the icon is unequivocally tied to a specific action (e.g. standard
images).

ciao,
Emmanuele.

> hi;
>
> On 13 December 2013 08:15, John Emmas <john creativepost co uk> wrote:
>> On 12 Dec 2013, at 20:31, Luis Matos wrote:
>>
>>> Just a rain check,
>>>
>>> In the future, images are not shipped in file (file.svg/file.png) but
>>> still included in gtk (library)? Or not shipped at all?
>
> GTK 3.x still ships icons for GtkStock identifiers, and will continue
> to do so until GtkStock is removed, in the next API/ABI break.
>
> it is strongly recommended *not* to use stock icons, but to use named
> icons from the icon theme instead: those icons are actively
> maintained, they have proper names, and allow fallback through
> specificity, e.g. if the application requests the icon named
> `foo-bar-baz` and it is not found, `foo-bar` and `foo` will also be
> checked. the icon naming specification is a freedesktop.org
> specification available here:
> http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
>
>> Two more questions if I may....
>>
>> 1)  What are the ".svg" files?  I noticed them during my testing but I
>> didn't manage to figure out what they're used for.
>
> SVG is scalable vector graphics, a vector graphics file format:
>
http://en.wikipedia.org/wiki/Scalable_Vector_Graphics
>
> inside icon themes SVG is used for scalable icons and, more recently,
> for symbolic icons that are meant to be colourised parametrically
> (e.g. signal strength and battery charge indicators).
>
>> 2)  Why deprecate images for buttons and menus anyway?  They seem to be
>> widely supported by OS's and other programs / frameworks.  What's the
>> rationale for deprecating them in gtk+?
>
> images and buttons inside menus have not been deprecated: you can
> still pack GtkImage widgets in buttons and menus, since both are
> GtkContainers. it's pretty easy to do both programmatically and
> through GtkBuilder (especially with the new builder templates).
>
> what has been deprecated (in GTK 3.x) are:
>
>  • stock icons, because they don't conform to the icon naming
> specification, and because they conflate both labels and images in
> weird ways. the thread on gtk-devel-list is available here:
> https://mail.gnome.org/archives/gtk-devel-list/2013-July/msg00000.html
>  • the gtk-button-images and gtk-menu-images GtkSettings, because
> they clobber the desired UI of the application developers and
> designers through a toolkit-wide setting.
>
> as per usual with the G* stack, deprecation does not mean removal
> until the next ABI break. in this case, GTK+ 4.0, which is currently
> not planned to happen soon, and in any case will be (like any other
> ABI/API break) parallel installable.
>
> ciao,
> Emmanuele.
>
> --
=========================

Thanks Emmanuele.

In my case, I'm putting the icon in a dialog with a message instructing the user on exactly what's wrong. Having said that, perhaps the icon is just redundant. I never thought about it before.

Anyway, thanks again.

Dave


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