Re: Migrating away from GtkStock stuff

2019-02-07 Thread Emmanuele Bassi via gtk-app-devel-list
On Thu, 7 Feb 2019 at 13:30, Gabriele Greco 
wrote:


> (test:77229): Gtk-WARNING **: 14:28:49.162: Could not find the icon
> 'help-about'. The 'hicolor' theme
> was not found either, perhaps you need to install it.
> You can get a copy from:
> http://icon-theme.freedesktop.org/releases
>
> (test:77229): Gtk-WARNING **: 14:28:49.162: Error loading theme icon
> 'help-about' for stock: Icon 'help-about' not present in theme Adwaita
>

GTK uses `help-about` internally, because it doesn't use stock icons.

You need an icon theme for the icons GTK uses, currently, though we're
thinking of shipping a cut down version of Adwaita inside GTK for that
reason: https://gitlab.gnome.org/GNOME/gtk/issues/1235

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Migrating away from GtkStock stuff

2019-02-07 Thread Gabriele Greco via gtk-app-devel-list
>
>
>> If you're using `edit-find` or `document-save` then you're using a named
> icon from the icon theme, not the stock identifier.
>
> For those, you'll have to ship an icon theme like Adwaita.
>

That's really strange, it seems there is something in my gtk stack that
converts GTK_STOCK_XXX to the icon theme equivalent, anyway they should
show since I've the Adwaita theme installed.

See the following example to see how gtk-about became help-about

#include 

int main(int argc, char *argv[]) {
gtk_init(, );

GtkWidget *w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_container_add(GTK_CONTAINER(w),
gtk_image_new_from_stock(GTK_STOCK_ABOUT, GTK_ICON_SIZE_LARGE_TOOLBAR));
gtk_widget_show_all(w);
gtk_main();
}


shelob-2 $ grep -r GTK_STOCK_ABOUT /usr/local/gtk/include/gtk-3.0/gtk
/usr/local/gtk/include/gtk-3.0/gtk/deprecated/gtkstock.h: * GTK_STOCK_ABOUT:
/usr/local/gtk/include/gtk-3.0/gtk/deprecated/gtkstock.h:#define
GTK_STOCK_ABOUT((GtkStock)"gtk-about")

shelob-2 $ g++ -o test test.c `pkg-config gtk+-3.0 --cflags --libs`
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior
is deprecated [-Wdeprecated]
test.c:8:34: warning: 'GtkStock' is deprecated [-Wdeprecated-declarations]
gtk_image_new_from_stock(GTK_STOCK_ABOUT,
GTK_ICON_SIZE_LARGE_TOOLBAR));
 ^
/usr/local/gtk/include/gtk-3.0/gtk/deprecated/gtkstock.h:123:38: note:
expanded from macro 'GTK_STOCK_ABOUT'
#define GTK_STOCK_ABOUT((GtkStock)"gtk-about")
 ^
/usr/local/gtk/include/gtk-3.0/gtk/deprecated/gtkstock.h:105:1: note:
'GtkStock' has been explicitly marked deprecated here
G_DEPRECATED
^
/usr/local/gtk/include/glib-2.0/glib/gmacros.h:432:37: note: expanded from
macro 'G_DEPRECATED'
#define G_DEPRECATED __attribute__((__deprecated__))
^
test.c:8:9: warning: 'gtk_image_new_from_stock' is deprecated
[-Wdeprecated-declarations]
gtk_image_new_from_stock(GTK_STOCK_ABOUT,
GTK_ICON_SIZE_LARGE_TOOLBAR));
^
/usr/local/gtk/include/gtk-3.0/gtk/gtkimage.h:121:1: note:
'gtk_image_new_from_stock' has been explicitly marked deprecated here
GDK_DEPRECATED_IN_3_10_FOR(gtk_image_new_from_icon_name)
^
/usr/local/gtk/include/gtk-3.0/gdk/gdkversionmacros.h:329:47: note:
expanded from macro 'GDK_DEPRECATED_IN_3_10_FOR'
# define GDK_DEPRECATED_IN_3_10_FOR(f)GDK_DEPRECATED_FOR(f)
  ^
/usr/local/gtk/include/gtk-3.0/gdk/gdkversionmacros.h:49:31: note: expanded
from macro 'GDK_DEPRECATED_FOR'
#define GDK_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GDK_EXTERN
  ^
/usr/local/gtk/include/glib-2.0/glib/gmacros.h:444:29: note: expanded from
macro 'G_DEPRECATED_FOR'
#define G_DEPRECATED_FOR(f) G_DEPRECATED
^
/usr/local/gtk/include/glib-2.0/glib/gmacros.h:432:37: note: expanded from
macro 'G_DEPRECATED'
#define G_DEPRECATED __attribute__((__deprecated__))
^
2 warnings generated.

shelob-2 $ ./test

(process:77229): Gtk-WARNING **: 14:28:48.629: Locale not supported by C
library.
Using the fallback 'C' locale.

(test:77229): Gtk-WARNING **: 14:28:49.162: Could not find the icon
'help-about'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
http://icon-theme.freedesktop.org/releases

(test:77229): Gtk-WARNING **: 14:28:49.162: Error loading theme icon
'help-about' for stock: Icon 'help-about' not present in theme Adwaita

 --
Ciao,
 Gabry

-- 


Le informazioni contenute nella presente comunicazione e i relativi 
allegati possono essere riservate e sono, comunque, destinate 
esclusivamente alle persone o alla Società sopraindicati e non sono da 
considerarsi comunicazioni personali, quindi eventuali risposte potranno 
essere conosciute da persone appartenenti all’azienda. La diffusione, 
distribuzione e/o copiatura del documento trasmesso da parte di qualsiasi 
soggetto diverso dal destinatario è proibita ai sensi dell’art. 616 c.p. I 
dati forniti verranno trattati ai sensi dell'art. 13 del Regolamento UE 
2016/679 (normativa sulla privacy). Se ha ricevuto questo messaggio per 
errore Ti preghiamo di distruggerlo e di informarci immediatamente 
contattandoci mandando una mail a priv...@wyscout.com 
. Copia integrale dell’informativa potrà essere 
visionata presso le nostre sedi. 

Any information herein included (even 
any attachments) shall be considered confidential and/or privileged 
material and meant to be only for the abovementioned persons and/or 
Company, therefore such communication is intended to be for the addressee 
only. Such information is not personal, that is why this e-mail and any 
replies may be known exclusively by people belonging to the company. It is 
expressively not allowed communicate, disclose and/or copy any 
documentation transmitted by a person other than the recipient, 

Re: Migrating away from GtkStock stuff

2019-02-07 Thread Emmanuele Bassi via gtk-app-devel-list
On Thu, 7 Feb 2019 at 11:52, Gabriele Greco via gtk-app-devel-list <
gtk-app-devel-list@gnome.org> wrote:

> Hi guys,
>
> I'm in the process of migrating a big code base from GTK 2.x to GTK 3.x,
> I've done most of the work, but I'm facing now some problems with GTK stock
> stuff.
>
> I used stock stuff a lot to reduce the localizable strings needed in my
> code and to reduce the number of images to ship.
>
> From what I've seen there are no more stock items in GTK 3 (3.24.2 at the
> moment), since they have been deprecated in 3.10.
>
>
That's not correct: GTK still ships the stock icons. You can find them in
the tree as `gtk/icons///`. The icons themselves are built
into the GTK shared library as GResources.

The labels are still there, but you're strongly encouraged to ship your own
strings, with your own mnemonics; GTK cannot know which mnemonics you or
your translators use, so there will inevitably be conflicts, which will
make your application look bad, or behave worse.


> It's more a removal than a deprecation since my code compiles but the
> program seems to fail to find at least the icons pointed by the stock item:
>
> (:75970): Gtk-WARNING **: 12:47:16.541: Error loading theme icon
> 'document-new' for stock: Icon 'document-new' not present in theme Adwaita
> (:75970): Gtk-WARNING **: 12:47:16.598: Error loading theme icon
> 'document-open' for stock: Icon 'document-open' not present in theme
> Adwaita
> (:75970): Gtk-WARNING **: 12:47:16.599: Error loading theme icon
> 'document-save' for stock: Icon 'document-save' not present in theme
> Adwaita
> (:75970): Gtk-WARNING **: 12:47:16.599: Error loading theme icon
> 'edit-find' for stock: Icon 'edit-find' not present in theme Adwaita
>
>
If you're using `edit-find` or `document-save` then you're using a named
icon from the icon theme, not the stock identifier.

For those, you'll have to ship an icon theme like Adwaita.

There is a stack overflow post that suggests how to handle the migration
> from a GtkStock item to a "named icon" or a "gtk localized label":
>
>
> https://stackoverflow.com/questions/36805505/gtk-stock-is-deprecated-whats-the-alternative
>
> ... but what about toolbar or buttons that given the theme may have icons,
> labels or both?
>

You are strongly encouraged to reduce the number of icons in your UI to
begin with; icons need to be extremely recognisable if you want to reduce
the mental load on users, and if you're showing both text and icons, users
will use the text, not the icon, to know what ai UI element does—if they
don't memorise the spatial location of the UI element, in which case
they'll use spatial memory instead of icon/text memory:

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

In any case, if you wish to move away from stock elements, the
recommendation is to move to icon theme names (GTK deprecation notes will
tell you what to use instead, if there is a replacement). If you don't want
to ship a whole icon theme, because of disk/download size constraints, or
build a list of icon assets you know you are using, and then you can either
take the Adwaita icon theme and remove everything you don't use, or create
the same file system layout as the icon theme but under your own
application's data directory:

https://wiki.gnome.org/DraftSpecs/ThemableAppSpecificIcons

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Migrating away from GtkStock stuff

2019-02-07 Thread Gabriele Greco via gtk-app-devel-list
Hi guys,

I'm in the process of migrating a big code base from GTK 2.x to GTK 3.x,
I've done most of the work, but I'm facing now some problems with GTK stock
stuff.

I used stock stuff a lot to reduce the localizable strings needed in my
code and to reduce the number of images to ship.

From what I've seen there are no more stock items in GTK 3 (3.24.2 at the
moment), since they have been deprecated in 3.10.

It's more a removal than a deprecation since my code compiles but the
program seems to fail to find at least the icons pointed by the stock item:

(:75970): Gtk-WARNING **: 12:47:16.541: Error loading theme icon
'document-new' for stock: Icon 'document-new' not present in theme Adwaita
(:75970): Gtk-WARNING **: 12:47:16.598: Error loading theme icon
'document-open' for stock: Icon 'document-open' not present in theme Adwaita
(:75970): Gtk-WARNING **: 12:47:16.599: Error loading theme icon
'document-save' for stock: Icon 'document-save' not present in theme Adwaita
(:75970): Gtk-WARNING **: 12:47:16.599: Error loading theme icon
'edit-find' for stock: Icon 'edit-find' not present in theme Adwaita

There is a stack overflow post that suggests how to handle the migration
from a GtkStock item to a "named icon" or a "gtk localized label":

https://stackoverflow.com/questions/36805505/gtk-stock-is-deprecated-whats-the-alternative

... but what about toolbar or buttons that given the theme may have icons,
labels or both?

-- 
*Bye,*
* Gabry*

-- 


Le informazioni contenute nella presente comunicazione e i relativi 
allegati possono essere riservate e sono, comunque, destinate 
esclusivamente alle persone o alla Società sopraindicati e non sono da 
considerarsi comunicazioni personali, quindi eventuali risposte potranno 
essere conosciute da persone appartenenti all’azienda. La diffusione, 
distribuzione e/o copiatura del documento trasmesso da parte di qualsiasi 
soggetto diverso dal destinatario è proibita ai sensi dell’art. 616 c.p. I 
dati forniti verranno trattati ai sensi dell'art. 13 del Regolamento UE 
2016/679 (normativa sulla privacy). Se ha ricevuto questo messaggio per 
errore Ti preghiamo di distruggerlo e di informarci immediatamente 
contattandoci mandando una mail a priv...@wyscout.com 
. Copia integrale dell’informativa potrà essere 
visionata presso le nostre sedi. 

Any information herein included (even 
any attachments) shall be considered confidential and/or privileged 
material and meant to be only for the abovementioned persons and/or 
Company, therefore such communication is intended to be for the addressee 
only. Such information is not personal, that is why this e-mail and any 
replies may be known exclusively by people belonging to the company. It is 
expressively not allowed communicate, disclose and/or copy any 
documentation transmitted by a person other than the recipient, according 
to the Italian Criminal Code, Section 616 and the Regulation EU 2016/679. 
Your provided data are processed in accordance with Regulation EU 2016/679 
(Data Protection Law), Section 13. A full copy of the relevant information 
notice is available at the company’s registered office upon request. If you 
received this in error, please destroy it and inform us immediately by 
sending an e-mail to the following e-mail address priv...@wyscout.com 
. A full copy of the relevant information 
notice is available at the company’s registered office upon request.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list