summaryrefslogtreecommitdiff
path: root/eel
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2010-12-06 15:35:34 +0100
committerCosimo Cecchi <cosimoc@gnome.org>2010-12-06 15:35:34 +0100
commit0a3aff84fececf1cfce0969ac173a736d2014130 (patch)
treecfcbc7e74017461d9d8aecd1395f907ec5d22d3a /eel
parentf0691e71c58bba402d896f0a236e4bd10b6e5760 (diff)
downloadnautilus-0a3aff84fececf1cfce0969ac173a736d2014130.tar.gz
eel-canvas: port to GtkStyleContext
Diffstat (limited to 'eel')
-rw-r--r--eel/eel-canvas.c41
-rw-r--r--eel/eel-canvas.h7
2 files changed, 5 insertions, 43 deletions
diff --git a/eel/eel-canvas.c b/eel/eel-canvas.c
index 519963286..b497a851d 100644
--- a/eel/eel-canvas.c
+++ b/eel/eel-canvas.c
@@ -2953,13 +2953,17 @@ eel_canvas_draw_background (EelCanvas *canvas,
cairo_t *cr)
{
cairo_rectangle_int_t rect;
+ GtkStyleContext *style_context;
+ GdkRGBA color;
if (!gdk_cairo_get_clip_rectangle (cr, &rect))
return;
cairo_save (cr);
/* By default, we use the style background. */
- gdk_cairo_set_source_color (cr, &gtk_widget_get_style (GTK_WIDGET (canvas))->bg[GTK_STATE_NORMAL]);
+ style_context = gtk_widget_get_style_context (GTK_WIDGET (canvas));
+ gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_ACTIVE, &color);
+ gdk_cairo_set_source_rgba (cr, &color);
gdk_cairo_rectangle (cr, &rect);
cairo_fill (cr);
cairo_restore (cr);
@@ -3543,41 +3547,6 @@ eel_canvas_world_to_window (EelCanvas *canvas, double worldx, double worldy,
*winy = (canvas->pixels_per_unit)*(worldy - canvas->scroll_y1) + canvas->zoom_yofs;
}
-
-
-/**
- * eel_canvas_get_color:
- * @canvas: A canvas.
- * @spec: X color specification, or NULL for "transparent".
- * @color: Returns the allocated color.
- *
- * Allocates a color based on the specified X color specification. As a
- * convenience to item implementations, it returns TRUE if the color was
- * allocated, or FALSE if the specification was NULL. A NULL color
- * specification is considered as "transparent" by the canvas.
- *
- * Return value: TRUE if @spec is non-NULL and the color is allocated. If @spec
- * is NULL, then returns FALSE.
- **/
-int
-eel_canvas_get_color (EelCanvas *canvas, const char *spec, GdkColor *color)
-{
- g_return_val_if_fail (EEL_IS_CANVAS (canvas), FALSE);
- g_return_val_if_fail (color != NULL, FALSE);
-
- if (!spec) {
- color->pixel = 0;
- color->red = 0;
- color->green = 0;
- color->blue = 0;
- return FALSE;
- }
-
- gdk_color_parse (spec, color);
-
- return TRUE;
-}
-
static gboolean
boolean_handled_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
diff --git a/eel/eel-canvas.h b/eel/eel-canvas.h
index 3c7d8d84f..02b3b4d9a 100644
--- a/eel/eel-canvas.h
+++ b/eel/eel-canvas.h
@@ -512,13 +512,6 @@ void eel_canvas_window_to_world (EelCanvas *canvas,
void eel_canvas_world_to_window (EelCanvas *canvas,
double worldx, double worldy, double *winx, double *winy);
-/* Takes a string specification for a color and allocates it into the specified
- * GdkColor. If the string is null, then it returns FALSE. Otherwise, it
- * returns TRUE.
- */
-int eel_canvas_get_color (EelCanvas *canvas, const char *spec, GdkColor *color);
-
-
G_END_DECLS
#endif