After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 729980 - GtkIconTheme: Support looking up directional variants
GtkIconTheme: Support looking up directional variants
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on: 729999
Blocks:
 
 
Reported: 2014-05-12 03:58 UTC by Matthias Clasen
Modified: 2014-05-14 22:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkIconTheme: Support looking up directional variants (8.30 KB, patch)
2014-05-12 03:58 UTC, Matthias Clasen
none Details | Review

Description Matthias Clasen 2014-05-12 03:58:41 UTC
Add two new icon lookup flags, GTK_ICON_LOOKUP_DIR_LTR and _RTL,
which tell GtkIconTheme to look for icon variants which have a
-ltr or -rtl suffix. GtkIconHelper adds these lookup flags when
looking up icons.

Note that due to the way this overlaps with symbolic icon lookup,
directional variants of symbolic icons must be called
-symbolic-rtl, not -rtl-symbolic.
Comment 1 Matthias Clasen 2014-05-12 03:58:45 UTC
Created attachment 276353 [details] [review]
GtkIconTheme: Support looking up directional variants
Comment 2 Matthias Clasen 2014-05-12 11:55:15 UTC
<Company> mclasen: doesn't that prefer the 2nd icon's ltr version to the first icon's non-ltr version?
<mclasen> maybe ? all this copying is a little crazy and is making me dizzy...
<Company> I'd have written tests if I had a way to create my own icontheme.. :/
<Company> what you want for foo-bar with FORCE_SYMBOLIC and fallbacks is to try foo-bar-symbolic, foo-symbolic, foo-bar, foo I think
<Company> what you want for foo-bar with LTR is to try foo-bar-ltr, foo-bar, foo-ltr, foo
<Company> which is a different ordering
<Company> but yeah, that function needs to do a better job at ordering the icon names it's looking up
<mclasen> what order do you expect for foo-bar-symbolic-rtl ?
<Company> foo-bar-symbolic-rtl, foo-bar-symbolic, foo-symbolic-rtl, foo-symbolic, foo-barrtl, foo-bar, foo-rtl, foo
<Company> I think?
<Company> so the order is
<Company> (1) try non-rtl/ltr version
<Company> (2) try fallback
<Company> (3) try different style
<Company> the problem is that (2) is already given to choose_icon()
<Company> I think what i'd do in choose_icon is sth like this:
<Company> if (flags & LTR)
<Company>   {
<Company>     new_names = g_new (n_icon_names * 2 + 1);
<Company>   new_names[2 * i] = strconcat(names[i], "-rtl");
<Company>     new_names[i] = strdup(names[i]);
<Company>   choose_icon (new_names flags & ~LTR);
<Company>   }
<Company> (man my indenting sucks)
<Company> and I forgot the return; in there
<Company> that way we strdup icon names like 15 times with all of those flags set, but meh...
<mclasen> and one of rtl/ltr will always be set...
<mclasen> and symbolic almost always
<mclasen> thankfully, we're not showing icons in every button anymore
Comment 3 Matthias Clasen 2014-05-13 00:40:29 UTC
pushed to the wip/css-icons branch
Comment 4 Matthias Clasen 2014-05-14 22:56:29 UTC
merged to master