]> www.fi.muni.cz Git - evince.git/commitdiff
libview: Port EvViewPresentation to GtkStyleContext
authorCarlos Garcia Campos <carlosgc@gnome.org>
Tue, 21 Dec 2010 18:55:09 +0000 (19:55 +0100)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Thu, 23 Dec 2010 18:13:26 +0000 (19:13 +0100)
libview/ev-view-presentation.c

index 96977184c5e0f01ab55fa4b043f146ff9b27cbff..9cc74af710b1c1b446c60250cf04ceb83eb87985 100644 (file)
@@ -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);
 }