[gimp/gtk3-port: 138/246] libgimpwidgets: port to GtkStyleContext and gtk_render_foo()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 138/246] libgimpwidgets: port to GtkStyleContext and gtk_render_foo()
- Date: Sun, 27 Feb 2011 15:56:22 +0000 (UTC)
commit 8e67df6355e8799d43dbccaff7a1de479bf7b980
Author: Michael Natterer <mitch gimp org>
Date: Thu Dec 9 23:10:01 2010 +0100
libgimpwidgets: port to GtkStyleContext and gtk_render_foo()
libgimpwidgets/gimpcellrenderercolor.c | 26 ++++++++++++++------------
1 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/libgimpwidgets/gimpcellrenderercolor.c b/libgimpwidgets/gimpcellrenderercolor.c
index 39ec6ad..32c929e 100644
--- a/libgimpwidgets/gimpcellrenderercolor.c
+++ b/libgimpwidgets/gimpcellrenderercolor.c
@@ -232,7 +232,7 @@ gimp_cell_renderer_color_render (GtkCellRenderer *cell,
const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
- GimpCellRendererColor *color = GIMP_CELL_RENDERER_COLOR (cell);
+ GimpCellRendererColor *renderer_color = GIMP_CELL_RENDERER_COLOR (cell);
GdkRectangle rect;
gint xpad;
gint ypad;
@@ -252,17 +252,18 @@ gimp_cell_renderer_color_render (GtkCellRenderer *cell,
if (rect.width > 2 && rect.height > 2)
{
- GtkStyle *style = gtk_widget_get_style (widget);
- GtkStateType state;
+ GtkStyleContext *context = gtk_widget_get_style_context (widget);
+ GtkStateFlags state = 0;
+ GdkRGBA color;
cairo_rectangle (cr,
rect.x + 1, rect.y + 1,
rect.width - 2, rect.height - 2);
- gimp_cairo_set_source_rgb (cr, &color->color);
+ gimp_cairo_set_source_rgb (cr, &renderer_color->color);
cairo_fill (cr);
- if (! color->opaque && color->color.a < 1.0)
+ if (! renderer_color->opaque && renderer_color->color.a < 1.0)
{
cairo_pattern_t *pattern;
@@ -279,7 +280,7 @@ gimp_cell_renderer_color_render (GtkCellRenderer *cell,
cairo_fill_preserve (cr);
- gimp_cairo_set_source_rgba (cr, &color->color);
+ gimp_cairo_set_source_rgba (cr, &renderer_color->color);
cairo_fill (cr);
}
@@ -291,17 +292,18 @@ gimp_cell_renderer_color_render (GtkCellRenderer *cell,
if (! gtk_cell_renderer_get_sensitive (cell) ||
! gtk_widget_is_sensitive (widget))
{
- state = GTK_STATE_INSENSITIVE;
+ state |= GTK_STATE_FLAG_INSENSITIVE;
}
- else
+
+ if (flags & GTK_CELL_RENDERER_SELECTED)
{
- state = (flags & GTK_CELL_RENDERER_SELECTED ?
- GTK_STATE_SELECTED : GTK_STATE_NORMAL);
+ state |= GTK_STATE_FLAG_SELECTED;
}
cairo_set_line_width (cr, 1);
- gdk_cairo_set_source_color (cr, &style->fg[state]);
- cairo_stroke_preserve (cr);
+ gtk_style_context_get_color (context, state, &color);
+ gdk_cairo_set_source_rgba (cr, &color);
+ cairo_stroke (cr);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]