[evince/gtk-style-context: 8/8] Make build with GtkStyleContext



commit 25a6879d0ee8a050a9d7a450ea4a9810933bea51
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Nov 15 23:10:48 2010 -0500

    Make build with GtkStyleContext
    
    First cut at making things build with GtkStyleContext.

 libview/ev-loading-window.c    |   34 ++++++++++++++++------------------
 libview/ev-view-presentation.c |   11 ++---------
 libview/ev-view.c              |   12 +++++-------
 3 files changed, 23 insertions(+), 34 deletions(-)
---
diff --git a/libview/ev-loading-window.c b/libview/ev-loading-window.c
index 4d5eaaf..64473ea 100644
--- a/libview/ev-loading-window.c
+++ b/libview/ev-loading-window.c
@@ -71,8 +71,8 @@ ev_loading_window_init (EvLoadingWindow *window)
 	GtkWidget   *hbox;
 	GtkWidget   *spinner;
 	GtkWidget   *label;
-	GtkStyle    *style;
-	GdkColor    fg, bg;
+	GtkStyleContext *context;
+	GdkRGBA    fg, bg;
 	const gchar *loading_text = _("Loadingâ?¦");
 	const gchar *fg_color_name = "info_fg_color";
 	const gchar *bg_color_name = "info_bg_color";
@@ -100,24 +100,22 @@ ev_loading_window_init (EvLoadingWindow *window)
 	gtk_window_set_decorated (gtk_window, FALSE);
 	gtk_window_set_resizable (gtk_window, FALSE);
 
-	style = gtk_widget_get_style (widget);
-	if (!gtk_style_lookup_color (style, fg_color_name, &fg) ||
-	    !gtk_style_lookup_color (style, bg_color_name, &bg)) {
-		fg.pixel = 0;
-		fg.red = 0xb800;
-		fg.green = 0xad00;
-		fg.blue = 0x9d00;
-
-		bg.pixel = 0;
-		bg.red = 0xff00;
-		bg.green = 0xff00;
-		bg.blue = 0xbf00;
+	context = gtk_widget_get_style_context (widget);
+        if (!gtk_style_context_lookup_color (context, fg_color_name, &fg) ||
+            !gtk_style_context_lookup_color (context, bg_color_name, &bg)) {
+		fg.red = 0.7;
+		fg.green = 0.67;
+		fg.blue = 0.63;
+                fg.alpha = 1.0;
+
+		bg.red = 0.99;
+		bg.green = 0.99;
+		bg.blue = 0.71;
+                bg.alpha = 1.0;
 	}
 
-	if (!gdk_color_equal (&bg, &style->bg[GTK_STATE_NORMAL]))
-		gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, &bg);
-	if (!gdk_color_equal (&fg, &style->fg[GTK_STATE_NORMAL]))
-		gtk_widget_modify_fg (widget, GTK_STATE_NORMAL, &fg);
+        gtk_widget_override_background_color (widget, GTK_STATE_NORMAL, &bg);
+        gtk_widget_override_color (widget, GTK_STATE_NORMAL, &fg);
 }
 
 static GObject *
diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c
index 9697718..a9c4ddc 100644
--- a/libview/ev-view-presentation.c
+++ b/libview/ev-view-presentation.c
@@ -992,15 +992,8 @@ ev_view_presentation_draw_end_page (EvViewPresentation *pview,
 	area.width = allocation.width;
 	area.height = allocation.height;
 
-        gtk_paint_layout (gtk_widget_get_style (widget),
-                          cr,
-                          gtk_widget_get_state (widget),
-                          FALSE,
-                          widget,
-                          NULL,
-                          15,
-                          15,
-                          layout);
+        gtk_render_layout (gtk_widget_get_style_context (widget),
+                           cr, 15, 15, layout);
 
 	pango_font_description_free (font_desc);
 	g_object_unref (layout);
diff --git a/libview/ev-view.c b/libview/ev-view.c
index bdf738f..e938ca0 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -4290,13 +4290,11 @@ focus_annotation (EvView       *view,
 
 	doc_rect_to_view_rect (view, page, &mapping->area, &rect);
 
-        gtk_paint_focus (gtk_widget_get_style (widget),
-                         cr,
-                         gtk_widget_get_state (widget),
-                         widget, NULL,
-                         rect.x - view->scroll_x,
-                         rect.y - view->scroll_y,
-                         rect.width + 1, rect.height + 1);
+        gtk_render_focus (gtk_widget_get_style_context (widget),
+                          cr,
+                          rect.x - view->scroll_x,
+                          rect.y - view->scroll_y,
+                          rect.width + 1, rect.height + 1);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]