Commit Graph

175 Commits

Author SHA1 Message Date
Alexander Larsson
92e904a257 Cache GtkIconInfo
In order to avoid loading and keeping around the same icon multiple times
we keep a cache of all outstanding GtkIconInfo objects for a given theme.

Additionally we return to the app not the normal pixbuf from the info,
but rather a proxy copy of it sharing the same data, but no extra
reference. This allows us to track when the app is no longer using
the pixbuf, and we can thus ensure that the GtkIconInfo in the cache
stays around for at least as long as the pixbuf is alive.

When the app unrefs the pixbuf we put the Info on a short LRU list
to keep it alive a bit longer, in case the app needs it in a short
while.

https://bugzilla.gnome.org/show_bug.cgi?id=689081
2012-11-30 11:33:26 +01:00
Stef Walter
c8de9abe98 icon-theme: Add some preconditions for NULL arguments
Related to this crash: https://bugzilla.gnome.org/show_bug.cgi?id=687967

https://bugzilla.gnome.org/show_bug.cgi?id=687977
2012-11-09 11:59:09 +01:00
Cosimo Cecchi
86ecf54139 icon-theme: support loading symbolic GFileIcons from generic URIs
Right now we support loading and recoloring symbolic GFileIcons, but
only if the underlying GFile has a local path. This breaks when the
GFileIcon is loaded from a GResource, which is a reasonable option for an
application that wants to ship a custom symbolic icon.

This patch changes GtkIconInfo to store a GFile together with the file
path, and changes the symbolic icon lookup code to use the GFile URI,
which transparently makes the code work also for GResources.

https://bugzilla.gnome.org/show_bug.cgi?id=687059
2012-10-31 11:53:50 -04:00
Carlos Garnacho
ebdd60c63b icontheme: Don't assume a symbolic icon size of 16x16
If the symbolic icon has other size than 16x16, the embedder
SVG that overrides colors would still force that size, resulting
in clipping instead of resizing. So fetch the original pixbuf
size the first time a symbolic icon is requested for a GtkIconInfo,
and use that size for the embedder SVG so it can be scaled properly
afterwards.

https://bugzilla.gnome.org/show_bug.cgi?id=677567
2012-07-13 14:44:05 +02:00
Jasper St. Pierre
d9a602f590 icon-theme: Allow symbolic GFileIcons
gtk_icon_info_load_symbolic checks for the existance of a filename parameter
so it can include it along with the stylesheet. We don't set the filename
parameter when creating the info for a GFileIcon, for some reason.

https://bugzilla.gnome.org/show_bug.cgi?id=676356
2012-06-01 09:17:00 -04:00
Benjamin Otte
23907e1d53 build: Remove now-unused GTK_DISABLE_DEPRECATED undefs 2012-05-01 03:13:01 +02:00
William Jon McCann
f10176e49f Prefer xdg data directory to legacy .icons directory
https://bugzilla.gnome.org/show_bug.cgi?id=646631
2012-04-30 06:42:34 -04:00
Cosimo Cecchi
271adacfad icontheme: search first in all themes if the requested icon is symbolic
Symbolic icons use a "-symbolic" suffix to distinguish themselves from
highcolor variants. Note that the dash character here has a different
meaning than the specificity level defined in the icon-naming-spec [1],
as it identifies a property of the icon itself.

Since they might be provided by a parent theme (e.g. the HighContrast theme
relies on the gnome icon theme for them), when we are looking up one we
should first escape the generic icon inheritance mechanism defined in the
icon-naming-spec [1], and privilege a symbolic icon, if it exists in a
parent theme, before applying the inheritance evaluation.

This fixes symbolic icons not working properly when used in the
HighContrast theme with the GTK_ICON_LOOKUP_GENERIC_FALLBACK flag set.

[1]
http://standards.freedesktop.org/icon-naming-spec/latest/ar01s03.html

https://bugzilla.gnome.org/show_bug.cgi?id=674806
2012-04-26 13:52:01 -04:00
Matthias Clasen
050cba6a31 Fix malformed doc comments
Most of these are forgotten :'s and similar details
which gtk-doc now warns about.
2012-04-12 21:12:16 -04:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Javier Jardón
d005b01319 gtk/*: Use g_list_free_full() convenience function 2012-01-05 04:22:43 +01:00
Benjamin Otte
adcd136f1e icontheme: Get rid of deprecation warnings
Before including deprecated headers, disable deprecation warnings.
2011-11-08 21:14:05 +01:00
Matthias Clasen
feece3c0bb Move gtkstyle and gtkrc to deprecated/
This required a somewhat more substantial include reshuffling.
Some typedefs have been moved to gtkiconfactory.h and to
gtksettings.h.
2011-11-02 01:15:21 -04:00
Chun-wei Fan
eb8c2dfae2 Bug 660730: Use GStatBuf for portability
Thanks to Kean Johnston for pointing this out.

There are a few places in GTK that use "struct stat",
and then g_stat(), rather than using GStatBuf.This breaks things on
Windows. Since the size of struct stat can vary depending on other
flags specified, this has the potential to cause overwrites and is
trivial to fix.

Based on patch submitted by Kean Johnston
2011-10-03 23:25:33 +08:00
Javier Jardón
bf0d8402f5 gtk: Use const instead G_CONST_RETURN 2011-06-10 13:07:54 +01:00
Matthias Clasen
5abadc6d95 GtkIconTheme: a small optimization
John Lindgren points out in bug 650202 that using judicious
use of g_key_file_has_key() can save some cycles in application
startup.
2011-05-31 20:29:53 -04:00
Colin Walters
703af0fb48 gtkicontheme: More explicitly note ownership transfers of duplicated string
I was hunting a memory leak and couldn't find it; at least I'm
pretty sure all of these are OK.  But document things better
for the future.

Also use g_hash_table_replace in one more case for consistency.

https://bugzilla.gnome.org/show_bug.cgi?id=649457
2011-05-05 16:02:10 -04:00
Colin Walters
9d84e6cda7 Drop the last remaining translated g_warning/g_error calls
http://mail.gnome.org/archives/desktop-devel-list/2011-March/msg00069.html

https://bugzilla.gnome.org/show_bug.cgi?id=648943
2011-04-29 10:33:50 -04:00
Javier Jardón
0dd93537b3 Move documentation to inline comments: GtkIconTheme 2011-04-15 01:41:13 +01:00
Matthias Clasen
800fff748b GtkIconThemePrivate: Improve struct packing 2011-04-12 12:33:04 -04:00
Benjamin Otte
0bd0854d4d icontheme: constify arguments to gtk_icon_theme_load_symbolic() 2011-02-11 23:21:11 +01:00
Matthias Clasen
394ae46ec0 Add some missing symbols to the docs 2011-02-08 23:21:39 -05:00
Benjamin Otte
fac914d70c API: gtk: Remove client_event vfunc from GtkWidget
Also remove the (de-facto unused) implementation from GtkWindow that was
only used for sockets/plugs.
2011-02-01 06:33:01 +01:00
Matthias Clasen
5b7add024d Adapt gtk_icon_info_load_symbolic to librsvg limitations too
Pointed out by Owen Taylor.
2011-01-20 19:01:57 -05:00
Pavel Holejsovsky
2fb1c06402 [GI] Add missing (out) and (array) annotations 2011-01-20 13:57:20 +01:00
Pavel Holejsovsky
3c8fc21e9b [GI] Fixes of existing incorrect annotations 2011-01-20 13:56:06 +01:00
Pavel Holejsovsky
a1c297a310 [GI] Cosmetic cleanups of annotations and doc comments
This change does not introduce any functionality change, mostly
cosmtic cleanups, like re-linebreak when introduced annotations messed
up indentation or whitespace errors fixes.
2011-01-18 17:31:59 +01:00
Pavel Holejsovsky
fe372ddf5e [GI] Add missing (allow-none) annotations 2011-01-18 17:30:43 +01:00
Pavel Holejsovsky
6d5cdad56e [GI] Annotate strings holding file paths as (type filename) 2011-01-18 17:29:40 +01:00
Matthias Clasen
9f895aa3ad Make symbolic icons work again
Work around https://bugzilla.gnome.org/show_bug.cgi?id=639750
2011-01-17 09:57:35 -05:00
Matthias Clasen
df78c9ee66 Add some doc details
Mention symbolic color names in gtk_icon_info_load_symbolic_for_context()
2011-01-13 21:38:08 -05:00
Matthias Clasen
7799fbf239 Add GtkNumerableIcon
This is a subclass of GEmblemedIcon that can show a number or
short string as an emblem, overlayed on top of another emblem.

Written by Cosimo Cecchi
https://bugzilla.gnome.org/show_bug.cgi?id=637169
2011-01-05 16:33:15 -05:00
Matthias Clasen
3412d7a23a Don't access GdkScreen fields 2010-12-21 12:06:56 -05:00
Matthias Clasen
55a0f8700f Another doc format problem 2010-12-17 14:51:53 -05:00
Carlos Garcia Campos
3b3307b946 Use gtk_style_context_reset_widgets() instead of gtk_rc_reset_styles() 2010-12-04 15:39:56 +01:00
Carlos Garnacho
901af8fec8 Fix compiler warnings. 2010-12-04 15:39:52 +01:00
Matthias Clasen
bbca96044e Fix memory handling when dealing with colors 2010-12-04 15:39:45 +01:00
Matthias Clasen
53c2114356 Deprecate gtk_icon_info_load_symbolic_for_style
We might end removing it altogether since it is a bit silly to have
Since: 3.0
Deprecated: 3.0
2010-12-04 15:39:45 +01:00
Matthias Clasen
f90881271f Add a GtkStyleContext-variant of symbolic icon loading 2010-12-04 15:39:42 +01:00
Cosimo Cecchi
a994a9f945 icon-theme: always force icon sizes for emblems
https://bugzilla.gnome.org/show_bug.cgi?id=634060
2010-11-05 16:28:32 +01:00
Cosimo Cecchi
5071aa72ad icon-theme: support pixbufs implementing the GIcon interface
https://bugzilla.gnome.org/show_bug.cgi?id=634060
2010-11-05 16:28:32 +01:00
Bastien Nocera
94c8390ad7 gtk: Fix crasher when loading symbolic icons
If the style didn't include symbolic colors for either success,
warning or error, gtk_icon_info_load_symbolic_for_style() would crash.

Instead, make sure we don't try to use the colors if they're not
available, and fallback on default colors inside
_gtk_icon_info_load_symbolic_internal().
2010-10-27 17:52:30 +01:00
Carlos Garnacho
e351a48d6a Make gtk_icon_info_load_symbolic() Take GdkRGBA colors. 2010-10-22 20:14:56 +02:00
Colin Walters
ad474edda8 introspection: Fix some annotation syntax 2010-09-29 10:45:04 -04:00
Matthias Clasen
f53ad33994 Remove GtkObject completely 2010-09-26 22:18:19 -04:00
Matthias Clasen
e0aa12eb0a Tons of transfer annotations 2010-09-21 00:18:11 -04:00
Tor Lillqvist
4491bdbb9d Drop Win32 DLL ABI compatibility cruft
No need for that any longer as we are changing DLL name.
2010-08-30 14:57:48 +03:00
Christian Persch
ffa07ee21e Use G_DEFINE_BOXED_TYPE
Bug #627214.
2010-08-18 15:34:47 +02:00
Javier Jardón
f66ebd8e59 GtkIconTheme: unseal private pointer 2010-07-13 19:40:48 +02:00
Javier Jardón
0a07e9733b gtk/: fully remove gtkalias hacks
https://bugzilla.gnome.org/show_bug.cgi?id=623845
2010-07-10 02:51:26 +02:00