Commit Graph

303 Commits

Author SHA1 Message Date
Matthias Clasen
48a41b0119 Reduce symbolic icon warnings to a debug message
These icons are out there in the wild, and the warning causes
distcheck to fail. So, reduce it to a debug message.
2015-01-31 14:32:17 -05:00
Kjell Ahlstedt
5d3aa54a8a docs: Explain 'icon theme context' better in gtkicontheme.c
Add links from gtk_icon_theme_list_contexts() to
gtk_icon_theme_list_icons(), and from there to the Icon Theme
Specification and the Icon Naming Specification.

https://bugzilla.gnome.org/show_bug.cgi?id=461249
2014-12-07 23:35:31 -05:00
Matthias Clasen
95e8ae6e75 GtkIconTheme: Improve an error message
Mention the name of the theme when an icon lookup fails.
https://bugzilla.gnome.org/show_bug.cgi?id=687963
2014-11-03 00:25:14 -05:00
Matthias Clasen
964c202c38 GtkIconTheme: Repair symbolic fallback with rtl/ltr
For symbolic icons, we prefer symbolics in inherited themes over
generic icons in the theme itself. So far this was implemented
by looking at icon_name[0] and looking that up in inherited themes
if it is symbolic. But with automatic rtl/ltr handling, the first
icon  name will always have an -rtl or -ltr suffix, and an icon
with that suffix is not going to exist in most cases. To fix this,
look for shorter icon names too, as long as they are still symbolic.

https://bugzilla.gnome.org/show_bug.cgi?id=737000
2014-09-21 14:49:22 -04:00
Matthias Clasen
1b858e4212 Trivial: clarify a comment
Using 'highcolor' here seems confusing, since there is a theme
by that name. Just say full-color.
2014-09-21 14:29:36 -04:00
Matthias Clasen
1629903943 GtkIconTheme: Make suffix_from_name NULL-safe
This can happen sometimes with GFileIcons that are
not representable as a local path. Better not to crash
in this case.
2014-09-05 13:15:14 -04:00
Alexander Larsson
afeb50009d Change way alpha is used when recoloring symbolics
If the foreground color has an alpha != 1 we used to just pass that into
the svg. This is useful to e.g. render an insensitive icon. However,
that is not an ideal model for symbolics. For instance, if the icon uses
overlapping areas when drawing, expecting these to be opaque then the
transparent color will result in a different alpha value for the overlapping
area. Also, non-foreground symbolic colors are still rendered opaque, and
the recoloring of pngs can't handle transparent colors.

So, instead we extract any alpha from the foreground, render using the
opaque colors and then apply the foreground alpha to the entire result.
This means we get an even transparency, even for other colors, and we
can apply alpha for the pngs too.

https://bugzilla.gnome.org/show_bug.cgi?id=734668
2014-08-12 15:51:36 +02:00
Alexander Larsson
1d68801ade icon-theme: Support recolorable .symbolic.png files
If an icon theme has a file called "foo-symbolic.symbolic.png" which
was converted from svg using gtk-encode-symbolic-svg we will read
it in an recolor, allowing symbolic icons without using librsvg.

https://bugzilla.gnome.org/show_bug.cgi?id=730450
2014-08-03 02:20:18 +02:00
Matthias Clasen
f3ef3165df GtkIconTheme: Make spinners scale in hi-dpi
The Adwaita icon theme ships spinners in a scalable directory
with MaxSize=32 and Scale=1. One way to make them scale up in
hi-dpi would be to add an @2 directory with MaxSize=32 and Scale=2,
but that directory would also be consulted in non hi-dpi situations
and give us an effective spinner max size of 64.

Instead, treat svg icons implicitly as hi-dpi, and scale them
up to MaxSize * 2 when in hi-dpi.
2014-07-17 00:59:34 -04:00
Руслан Ижбулатов
e3d725ed8c GktIconTheme: Be even more careful with paths
This is a followup for 5a252f13a8

https://bugzilla.gnome.org/show_bug.cgi?id=733189
2014-07-15 19:02:41 +00:00
Matthias Clasen
5a252f13a8 GktIconTheme: Be more careful with paths
Slapping file:// in front of a path does not guarantee a working
uri (e.g. if you are on windows and the path looks like F:\\...).
Therefore, go back to using g_file_new_for_path if we don't have
to deal with a resource.
2014-07-14 18:44:00 -04:00
Matthias Clasen
6abcda8391 Use a define for the default icon theme name
We're using this name in two places, so match what we are doing
for the default theme name, and use a macro.
2014-07-09 21:18:18 -04:00
Matthias Clasen
eee7057421 GtkIconTheme: Rename a macro
We use DEFAULT_THEME_NAME in gtksettings.c as well, and this
can be a confusing when grepping, so rename this to
FALLBACK_ICON_THEME.
2014-07-09 21:12:08 -04:00
Stefano Facchini
cd71a23ee2 icontheme: Use correct URI for icons in resource paths
Fix based on a patch by Stefano Faccini,
https://bugzilla.gnome.org/show_bug.cgi?id=732894
2014-07-09 11:01:40 -04:00
Matthias Clasen
5a548106b0 Deprecate gtk_icon_theme_add_builtin_icon
Builtin icons are deprecated in favor of loading icons
from resource paths.
2014-06-30 17:17:49 -04:00
Matthias Clasen
e9ac1bb476 Make gtk_icon_theme_add_resource_path public API
This makes it possible to look up icons in resources using
the icon theme api, and should be used as a replacement
for installing icons below $pkgdatadir/icons and adding
that location to the search path.
2014-06-30 17:13:04 -04:00
Matthias Clasen
f6da4efd47 GtkIconTheme: Allow unthemed icons from resource paths
This makes it pretty straightforward to add individual icons
that don't need to be present in multiple sizes.
2014-06-30 17:02:41 -04:00
Matthias Clasen
c2a22feb27 Drop an extra dir from builtin icons
Make icon lookup from resources work without the extra hicolor
component in the path. It is redundant, since we always treat
builtin icons as part of hicolor anyway.
2014-06-30 16:23:28 -04:00
Matthias Clasen
c28d938a24 GtkIconTheme: Only look at resources for hicolor
We want to treat icons coming from resources as builtins that
are looked at as part of Hicolor.
2014-06-30 16:03:03 -04:00
Matthias Clasen
f7fbeb40c7 GtkIconTheme: Drop an unused parameter
We're always passing FALSE for scale_only, so why bother.
2014-06-30 16:00:05 -04:00
Matthias Clasen
bec3aa54e4 Treat unthemed icons the same as force_size for scaling
This is closer to what we were doing in the past.
2014-06-30 15:57:16 -04:00
Matthias Clasen
3d0dac0aef GtkIconTheme: Copy all fields in icon_info_dup
This functionality is only exercised by gnome-shell, currently.
Therefore, forgetting to copy a field here means an instant
gnome-shell crash :-(. More tests needed.
2014-06-23 12:20:59 -04:00
Matthias Clasen
30982b6d4e GtkIconTheme: Be more careful when warning
It sucks when printing a warning causes gnome-shell to crash,
so be more careful about icon names being NULL here.
2014-06-23 12:13:22 -04:00
Matthias Clasen
12a40cf8a6 GtkIconTheme: keep misplaced symbolics working
Recent changes made it a breaking mistake to install symbolic icons
of the wrong size into a theme directory, or into the legacy unthemed
icon location.

Since this change affects many apps, do the extra work to keep these
icons working, but emit warnings, in the hope that this will lead to
cleaning up the mess over time.
2014-06-23 08:18:42 -04:00
Matthias Clasen
fe92c4478e Move some comments around 2014-06-22 22:04:00 -04:00
Matthias Clasen
a44f01c573 Some documentation rewording 2014-06-22 16:46:11 -04:00
Matthias Clasen
6cc32c24be GtkIconTheme: Drop an unused variable
We no longer need a separate field for symbolic icon size,
now that we are using the directory size.
2014-06-22 11:52:11 -04:00
Matthias Clasen
b96058c3b7 GtkIconTheme: Load symbolic icons at the same size
Reuse the scale information that we have from loading icons
normally, when loading a symbolic icon, so that we apply the
same size constraints.

This commit assumes that svgs have the nominal size of the
directory they are in, which will be true for all current
symbolic icons.
2014-06-22 11:52:11 -04:00
Matthias Clasen
acb276c644 GtkIconInfo: Small struct packing improvement
This makes the GtkIconInfo struct a bit smaller.
2014-06-22 11:52:11 -04:00
Matthias Clasen
f2b98f45db GtkIconInfo: Drop an unused field
The GtkIconInfo threshold field was never used, so lets not
carry it around.
2014-06-22 11:52:10 -04:00
Matthias Clasen
a10412f49e GtkIconTheme: Respect limits in theme dirs
Previously, we were taking thresholds and min/max sizes into
account when choosing the best theme dir, but when it came
to loading the icon, we always scaled icons from scalable
directories all the way, ignoring the min/max size limits.

This commit changes things around so that we now load icons
in Threshold directories at their nominal size, and scale
icons in Scalable directories only up to the specified limits.

To override this and keep the previous behaviour of scaling
all the way to the desired size, use the GTK_ICON_THEME_FORCE_SIZE
flag.
2014-06-22 11:52:10 -04:00
Matthias Clasen
240daf55a1 GtkIconTheme: Drop an unused function 2014-06-20 20:40:52 -04:00
Matthias Clasen
2472cf22db GtkIconTheme: Small cleanup
Make the default symbolic colors a little more readable in the code.
2014-06-20 20:40:52 -04:00
Matthias Clasen
669bc909d8 GtkIconTheme: Trivial cleanup
Drop the _-prefix from a static function.
We've agreed to no stop using those prefixes.
2014-06-20 20:40:51 -04:00
Matthias Clasen
5ddacf094e GtkIconTheme: Don't create empty IconThemeDir structs
Starting gtk3-demo currently creates ~1200 of these, most
of them for nonexisting directories. Lets try to avoid that.
2014-06-20 12:15:25 -04:00
Matthias Clasen
4f1ff179bb Revert "Document gtk_icon_theme_add_resource_path"
This reverts commit 988b6b483d.
2014-06-20 08:46:42 -04:00
Matthias Clasen
a31e8369f8 Revert "Deprecate gtk_icon_theme_add_builtin_icon"
This reverts commit 923eeda2d3.
2014-06-20 08:46:24 -04:00
Matthias Clasen
923eeda2d3 Deprecate gtk_icon_theme_add_builtin_icon 2014-06-20 01:17:47 -04:00
Matthias Clasen
988b6b483d Document gtk_icon_theme_add_resource_path 2014-06-20 01:17:47 -04:00
Matthias Clasen
49bcaf844c GtkIconTheme: Include legacy stock icons from resources
Add /org/gtk/libgtk/icons as a resource path, and ensure
that we always parse an index.theme file for hicolor which
makes the builtin icons available as part of the hicolor theme.
2014-06-20 01:17:46 -04:00
Matthias Clasen
968ea4186d GtkIconTheme: Allow loading icons from resources
We add a new API, gtk_icon_theme_add_resource_path, which
can be used to add resource path as a base location for
icon theme content, similar to gtk_icon_theme_append_search_path.
2014-06-20 01:17:46 -04:00
Matthias Clasen
13c354db8d GtkIconTheme: Drop the all_icons hash table
It is not used anywhere anymore.
2014-06-20 01:17:46 -04:00
Matthias Clasen
11ec8f7285 GtkIconTheme: Stop using the all_icons hash table
This hash table was used in gtk_icon_theme_has_icon; we can
implement that function just as well without it and save some
memory.
2014-06-20 01:17:45 -04:00
Matthias Clasen
6549031030 Formatting fixes 2014-06-20 01:17:45 -04:00
Matthias Clasen
aa44c0ca53 GtkIconTheme: Drop the code for parsing .icon files
Modern icon themes don't ship .icon files anyway.
2014-06-20 01:17:45 -04:00
Matthias Clasen
84bc9bba42 GtkIconTheme: Deprecate functionality related to .icon files
This functionality is not used at all in modern icon themes.
2014-06-20 01:17:45 -04:00
Matthias Clasen
36be12578c Drop the builtin icon cache
We don't need it anymore, now that the non-standard stock icons
are using resources.
2014-06-20 01:17:44 -04:00
Matthias Clasen
c9e848b659 GtkIconTheme: Fix svg loading with FORCE_SIZE
Paradoxically, we were loading svgs at the nominal size when
FORCE_SIZE is specified, while scaling them exactly when it
isn't.
	../build/win32/vs10/gtk.vcxproj
2014-06-18 19:09:37 -04:00
Alexander Larsson
3574a809fa icon theme: Fix crash for builtin icons
This pushes the initialization of is_svg to an earlier point
when the GtkIconInfo is created. This is needed because an icon
info doesn't necessarily always have a filename that we can later
extract the suffix from. For instance, builtin icons have NULL
filename.

https://bugzilla.gnome.org/show_bug.cgi?id=721895
2014-06-17 13:54:13 -04:00
Jasper St. Pierre
c2bf7a887c gtkicontheme: Fix a missing case where we forget to set is_svg
When duplicating the icon_info, we forgot to set is_svg. This meant that
any application that used gtk_icon_info_load_icon_async wouldn't have
is_svg set properly.

This fixes blurry icons in the gnome-shell app picker.
2014-06-16 10:47:34 -04:00