[nautilus: 2/18] eel-canvas: port to GtkStyleContext
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus: 2/18] eel-canvas: port to GtkStyleContext
- Date: Mon, 6 Dec 2010 14:57:09 +0000 (UTC)
commit 0a3aff84fececf1cfce0969ac173a736d2014130
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Dec 6 15:35:34 2010 +0100
eel-canvas: port to GtkStyleContext
eel/eel-canvas.c | 41 +++++------------------------------------
eel/eel-canvas.h | 7 -------
2 files changed, 5 insertions(+), 43 deletions(-)
---
diff --git a/eel/eel-canvas.c b/eel/eel-canvas.c
index 5199632..b497a85 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, >k_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 3c7d8d8..02b3b4d 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]