[gtk-theme-engine-clearlooks] Clearlooks: Implement render_icon_pixbuf()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-theme-engine-clearlooks] Clearlooks: Implement render_icon_pixbuf()
- Date: Mon, 6 Dec 2010 21:20:41 +0000 (UTC)
commit dbb6f1dd73121ee9f85f88321f631f4facb6f9be
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Nov 16 00:36:22 2010 +0100
Clearlooks: Implement render_icon_pixbuf()
src/clearlooks_engine.c | 48 ++++++++++++++--------------------------------
1 files changed, 15 insertions(+), 33 deletions(-)
---
diff --git a/src/clearlooks_engine.c b/src/clearlooks_engine.c
index f333af7..3a18e05 100644
--- a/src/clearlooks_engine.c
+++ b/src/clearlooks_engine.c
@@ -1602,6 +1602,7 @@ clearlooks_style_unrealize (GtkStyle * style)
{
GTK_STYLE_CLASS (clearlooks_style_parent_class)->unrealize (style);
}
+#endif
static GdkPixbuf *
set_transparency (const GdkPixbuf *pixbuf, gdouble alpha_percent)
@@ -1657,6 +1658,7 @@ scale_or_ref (GdkPixbuf *src,
}
}
+#if 0
static void
clearlooks_style_draw_layout (GtkStyle * style,
cairo_t *cr,
@@ -1711,15 +1713,12 @@ clearlooks_style_draw_layout (GtkStyle * style,
pango_cairo_show_layout (cr, layout);
}
+#endif /* if 0 */
static GdkPixbuf *
-clearlooks_style_draw_render_icon (GtkStyle *style,
- const GtkIconSource *source,
- GtkTextDirection direction,
- GtkStateType state,
- GtkIconSize size,
- GtkWidget *widget,
- const char *detail)
+clearlooks_engine_render_icon_pixbuf (GtkThemingEngine *engine,
+ const GtkIconSource *source,
+ GtkIconSize size)
{
int width = 1;
int height = 1;
@@ -1728,33 +1727,15 @@ clearlooks_style_draw_render_icon (GtkStyle *style,
GdkPixbuf *base_pixbuf;
GdkScreen *screen;
GtkSettings *settings;
-
- /* Oddly, style can be NULL in this function, because
- * GtkIconSet can be used without a style and if so
- * it uses this function.
- */
+ GtkStateFlags state;
base_pixbuf = gtk_icon_source_get_pixbuf (source);
+ screen = gtk_theming_engine_get_screen (engine);
+ settings = gtk_settings_get_for_screen (screen);
+ state = gtk_theming_engine_get_state (engine);
g_return_val_if_fail (base_pixbuf != NULL, NULL);
- if (widget && gtk_widget_has_screen (widget))
- {
- screen = gtk_widget_get_screen (widget);
- settings = gtk_settings_get_for_screen (screen);
- }
- else if (style->visual)
- {
- screen = gdk_visual_get_screen (style->visual);
- settings = gtk_settings_get_for_screen (screen);
- }
- else
- {
- settings = gtk_settings_get_default ();
- GTK_NOTE (MULTIHEAD,
- g_warning ("Using the default screen for gtk_default_render_icon()"));
- }
-
if (size != (GtkIconSize) -1 && !gtk_icon_size_lookup_for_settings (settings, size, &width, &height))
{
g_warning (G_STRLOC ": invalid icon size '%d'", size);
@@ -1772,14 +1753,14 @@ clearlooks_style_draw_render_icon (GtkStyle *style,
/* If the state was wildcarded, then generate a state. */
if (gtk_icon_source_get_state_wildcarded (source))
{
- if (state == GTK_STATE_INSENSITIVE)
+ if (state & GTK_STATE_FLAG_INSENSITIVE)
{
stated = set_transparency (scaled, 0.3);
gdk_pixbuf_saturate_and_pixelate (stated, stated, 0.1, FALSE);
g_object_unref (scaled);
}
- else if (state == GTK_STATE_PRELIGHT)
+ else if (state & GTK_STATE_FLAG_PRELIGHT)
{
stated = gdk_pixbuf_copy (scaled);
@@ -1798,8 +1779,6 @@ clearlooks_style_draw_render_icon (GtkStyle *style,
return stated;
}
-#endif /* if 0 */
-
void
clearlooks_engine_register_types (GTypeModule *module)
{
@@ -1814,6 +1793,9 @@ clearlooks_engine_init (ClearlooksEngine *engine)
static void
clearlooks_engine_class_init (ClearlooksEngineClass * klass)
{
+ GtkThemingEngineClass *engine_class = GTK_THEMING_ENGINE_CLASS (klass);
+
+ engine_class->render_icon_pixbuf = clearlooks_engine_render_icon_pixbuf;
#if 0
GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]