Commit Graph

125 Commits

Author SHA1 Message Date
Benjamin Otte
fa8ca5fd13 iconhelper: Simplify code
In the GTK_IMAGE_ICON_NAME case, instead of keeping around the icon_name,
create a GThemedIcon and use that. This way, we can reuse the code paths
for the GTK_IMAGE_GICON case.
2014-05-11 03:23:54 +02:00
Cosimo Cecchi
b0a0b7ebe7 iconhelper: always ensure a stated pixbuf
Even when we are set a pixbuf itself.

https://bugzilla.gnome.org/show_bug.cgi?id=726271
2014-04-13 22:26:18 -07:00
Bastien Nocera
744b790fdb iconhelper: Fix leak when rendering to cairo surface
https://bugzilla.gnome.org/show_bug.cgi?id=709264
2013-10-02 17:21:48 +02:00
Bastien Nocera
e53bb1bf1b iconhelper: Use g_clear_* helpers
https://bugzilla.gnome.org/show_bug.cgi?id=709264
2013-10-02 17:21:48 +02:00
Cosimo Cecchi
417d6666e5 iconhelper: refactor some code into a single function
https://bugzilla.gnome.org/show_bug.cgi?id=705443
2013-08-20 02:50:40 +02:00
Cosimo Cecchi
ab88110b51 iconhelper: clear the surface on invalidation
This was missed during the pixbuf->surface conversion, so when the state
changed we were not recreating a new surface for it.
2013-08-03 18:08:33 +02:00
Kjell Ahlstedt
4d86472b92 Continue the deprecation of GtkIconSet
Deprecate gtk_icon_set_render_icon_surface() and gtk_image_get_icon_set(),
which take parameters of the deprecated GtkIconSet.

https://bugzilla.gnome.org/show_bug.cgi?id=703616
2013-07-09 06:54:27 -04:00
Kjell Ahlstedt
16c08ae135 Fix some inconsistent deprecations
Some functions had only a deprecation comment in the .c file, or only a
deprecation annotation in the .h file. Add the missing parts.

https://bugzilla.gnome.org/show_bug.cgi?id=703616
2013-07-09 06:54:26 -04:00
Emmanuele Bassi
0899ef7cc9 gtk: Use new macros for defining private data
https://bugzilla.gnome.org/show_bug.cgi?id=702996
2013-07-09 09:30:02 +01:00
Matthias Clasen
4eac681eba Avoid deprecation warning
There was one overlooked use of GTK_STOCK_MISSING_IMAGE.
2013-07-03 19:52:11 -04:00
Alexander Larsson
031e1a98a0 GtkIconHelper: Convert to using cairo surfaces as base and support scales
We render the source into a cairo_surface_t so that we can render it
with cairo directly, rather than having to convert it from a pixbuf
every time. We also specify the target window when creating the cairo
surface so that rendering can be faster.

Using cairo surfaces also allows us to seamlessly support window scales.

We also add a GTK_IMAGE_SURFACE source type.
2013-07-03 14:39:26 +02:00
Alexander Larsson
5d8fd4ee24 GtkIconHelper: Add set_window()
This is a hint on where the icon will be drawn. It
will allow us to pre-allocate cairo surfaces for the right
target.
2013-07-03 14:39:25 +02:00
William Jon McCann
aef9dca9d5 Deprecate GtkIconFactory, GtkIconSet, GtkIconSource
We want to use GtkIconTheme instead. It is worth noting that
the parts that remain undeprecated are GtkIconSize and gtk_icon_size_lookup.
2013-06-26 20:02:27 -04:00
William Jon McCann
02c793f24a Start migrating internals away from GtkStock 2013-06-24 22:20:49 -04:00
Jasper St. Pierre
367364a8e1 Fix deprecations for GtkIconInfo 2013-02-15 19:48:56 -05:00
Sébastien Wilmet
2c3b9a89a9 iconhelper: small code simplification
https://bugzilla.gnome.org/show_bug.cgi?id=687025
2013-01-17 16:21:18 +01:00
Murray Cumming
7114e63cee iconhelper: treat the empty string as a NULL stock-id
https://bugzilla.gnome.org/show_bug.cgi?id=687025
2013-01-04 17:21:11 +01:00
Alexander Larsson
444a92d6d8 IconHelper: Avoid warnings for non-existing stock ids
There are some registred stock ids like gtk-discards that have no icons,
and you could also pass a non-registred stock id. Both of these means
gtk_style_context_lookup_icon_set returns NULL, which causes
a critical in gtk_icon_set_render_icon_pixbuf.

We avoid this by just making these render as EMPTY.
2012-12-13 10:11:00 +01:00
Carlos Garnacho
b5d45a9edc Add API to force a GtkIconHelper pixbuf rescaling
This API is handy in entries and status icons, where the size is
limited and independent of the pixbuf size
2012-07-13 16:56:37 +02:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Cosimo Cecchi
f0714338b3 iconhelper: treat the empty string as a NULL icon name
Treat the empty string as if it was a NULL icon name instead of
rendering GTK_STOCK_MISSING_IMAGE.
This used to be the previous behavior of GtkCellRendererPixbuf and
applications might still rely on it.
2011-12-15 20:01:35 +01:00
Cosimo Cecchi
864c5610f8 icon-helper: remove useless checks
When we change storage type, we always clear the rest of the object, so
these checks do not add any safety.
2011-11-30 19:04:17 -05:00
Cosimo Cecchi
d300ddc5e4 icon-helper: don't warn out when the icon size is GTK_ICON_SIZE_INVALID
We can call ensure_icon_size() for an empty image; don't warn out in
that case, but just return a zero width.
2011-11-30 18:32:01 -05:00
Cosimo Cecchi
e37c55aa3e icon-helper: don't reset pixel_size when clearing the helper
Don't reset the pixel size when clearing the helper; pixel-size is e.g a
property of GtkImage, which is stable unless explicitly set.
2011-11-30 18:15:05 -05:00
Cosimo Cecchi
b5d8d2c4a8 icon-helper: add GtkIconHelper private object
GtkIconHelper is a helper object to easily obtain a pixbuf from
different icon sources (e.g. a GIcon, an icon name, a stock id, ...).

Code is ported from GtkImage, which will be adapted in the next commit.
2011-11-30 16:39:59 -05:00