]> www.fi.muni.cz Git - evince.git/commitdiff
libdocument: Port To GtkStyleContext
authorCarlos Garcia Campos <carlosgc@gnome.org>
Wed, 22 Dec 2010 16:02:15 +0000 (17:02 +0100)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Thu, 23 Dec 2010 18:13:26 +0000 (19:13 +0100)
libdocument/ev-document-misc.c

index f1a309571e9f101b1ce3ffc6cb17023777eeec4b..01676b5306c2faca791858266e9cc6e379c4bb6f 100644 (file)
@@ -140,10 +140,22 @@ ev_document_misc_paint_one_page (cairo_t      *cr,
                                 gboolean      highlight,
                                 gboolean      inverted_colors)
 {
-       GtkStyle    *style = gtk_widget_get_style (widget);
-       GtkStateType state = gtk_widget_get_state (widget);
-
-       gdk_cairo_set_source_color (cr, highlight ? &style->text[state] : &style->dark[state]);
+       GtkStyleContext *context = gtk_widget_get_style_context (widget);
+       GtkStateFlags state = gtk_widget_get_state_flags (widget);
+        GdkRGBA fg, bg, shade_bg;
+        GtkSymbolicColor *c1, *c2;
+
+        gtk_style_context_get_background_color (context, state, &bg);
+        gtk_style_context_get_color (context, state, &fg);
+
+        // FIXME: should we cache the shade_bg?
+        c1 = gtk_symbolic_color_new_literal (&bg);
+        c2 = gtk_symbolic_color_new_shade (c1, 0.7);
+        gtk_symbolic_color_resolve (c2, NULL, &shade_bg);
+        gtk_symbolic_color_unref (c1);
+        gtk_symbolic_color_unref (c2);
+
+       gdk_cairo_set_source_rgba (cr, highlight ? &fg : &shade_bg);
        gdk_cairo_rectangle (cr, area);
        cairo_fill (cr);
 
@@ -158,7 +170,7 @@ ev_document_misc_paint_one_page (cairo_t      *cr,
                         area->height - (border->top + border->bottom));
        cairo_fill (cr);
 
-       gdk_cairo_set_source_color (cr, &style->mid[state]);
+       gdk_cairo_set_source_rgba (cr, &bg);
        cairo_rectangle (cr,
                         area->x,
                         area->y + area->height - (border->bottom - border->top),