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/<size>/<category>/`. 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: > > (<unknown>:75970): Gtk-WARNING **: 12:47:16.541: Error loading theme icon > 'document-new' for stock: Icon 'document-new' not present in theme Adwaita > (<unknown>:75970): Gtk-WARNING **: 12:47:16.598: Error loading theme icon > 'document-open' for stock: Icon 'document-open' not present in theme > Adwaita > (<unknown>:75970): Gtk-WARNING **: 12:47:16.599: Error loading theme icon > 'document-save' for stock: Icon 'document-save' not present in theme > Adwaita > (<unknown>: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