[evince] libview: Port EvViewPresentation to GtkStyleContext



commit afa18f6b0d2d1851d5b89aba42b2ab263c00710b
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Tue Dec 21 19:55:09 2010 +0100

    libview: Port EvViewPresentation to GtkStyleContext

 libview/ev-view-presentation.c |   37 ++++++++++++-------------------------
 1 files changed, 12 insertions(+), 25 deletions(-)
---
diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c
index 9697718..9cc74af 100644
--- a/libview/ev-view-presentation.c
+++ b/libview/ev-view-presentation.c
@@ -111,18 +111,19 @@ static void ev_view_presentation_set_cursor_for_location (EvViewPresentation *pv
 
 G_DEFINE_TYPE (EvViewPresentation, ev_view_presentation, GTK_TYPE_WIDGET)
 
+static GdkRGBA black = { 0., 0., 0., 1. };
+static GdkRGBA white = { 1., 1., 1., 1. };
+
 static void
 ev_view_presentation_set_normal (EvViewPresentation *pview)
 {
 	GtkWidget *widget = GTK_WIDGET (pview);
-	GtkStyle  *style;
 
 	if (pview->state == EV_PRESENTATION_NORMAL)
 		return;
 
 	pview->state = EV_PRESENTATION_NORMAL;
-	style = gtk_widget_get_style (widget);
-	gdk_window_set_background (gtk_widget_get_window (widget), &style->black);
+	gdk_window_set_background_rgba (gtk_widget_get_window (widget), &black);
 	gtk_widget_queue_draw (widget);
 }
 
@@ -130,14 +131,12 @@ static void
 ev_view_presentation_set_black (EvViewPresentation *pview)
 {
 	GtkWidget *widget = GTK_WIDGET (pview);
-	GtkStyle  *style;
 
 	if (pview->state == EV_PRESENTATION_BLACK)
 		return;
 
 	pview->state = EV_PRESENTATION_BLACK;
-	style = gtk_widget_get_style (widget);
-	gdk_window_set_background (gtk_widget_get_window (widget), &style->black);
+	gdk_window_set_background_rgba (gtk_widget_get_window (widget), &black);
 	gtk_widget_queue_draw (widget);
 }
 
@@ -145,14 +144,12 @@ static void
 ev_view_presentation_set_white (EvViewPresentation *pview)
 {
 	GtkWidget *widget = GTK_WIDGET (pview);
-	GtkStyle  *style;
 
 	if (pview->state == EV_PRESENTATION_WHITE)
 		return;
 
 	pview->state = EV_PRESENTATION_WHITE;
-	style = gtk_widget_get_style (widget);
-	gdk_window_set_background (gtk_widget_get_window (widget), &style->white);
+	gdk_window_set_background_rgba (gtk_widget_get_window (widget), &white);
 	gtk_widget_queue_draw (widget);
 }
 
@@ -992,15 +989,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);
@@ -1225,10 +1215,9 @@ init_presentation (GtkWidget *widget)
 static void
 ev_view_presentation_realize (GtkWidget *widget)
 {
-	GdkWindow    *window;
-	GtkStyle     *style;
-	GdkWindowAttr attributes;
-	GtkAllocation allocation;
+	GdkWindow     *window;
+	GdkWindowAttr  attributes;
+	GtkAllocation  allocation;
 
 	gtk_widget_set_realized (widget, TRUE);
 
@@ -1259,9 +1248,7 @@ ev_view_presentation_realize (GtkWidget *widget)
 	gdk_window_set_user_data (window, widget);
 	gtk_widget_set_window (widget, window);
 
-	gtk_widget_style_attach (widget);
-	style = gtk_widget_get_style (widget);
-	gdk_window_set_background (window, &style->black);
+        gdk_window_set_background_rgba (window, &black);
 
 	g_idle_add ((GSourceFunc)init_presentation, widget);
 }



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