]> www.fi.muni.cz Git - evince.git/commitdiff
[libview] Fix most of the GSEAL build issues
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sat, 8 May 2010 15:54:54 +0000 (17:54 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Mon, 10 May 2010 13:05:26 +0000 (15:05 +0200)
Still pending GTK_WINDOW (toplevel)->group in ev-view-presentation

configure.ac
libview/ev-annotation-window.c
libview/ev-pixbuf-cache.c
libview/ev-view-accessible.c
libview/ev-view-presentation.c
libview/ev-view.c

index 76c91d5bef3433540dd7fb5c6b0648272d0c134a..14a2a7c5d926722de0d6a060d2520a08b7d743b8 100644 (file)
@@ -123,7 +123,7 @@ AM_CONDITIONAL([PLATFORM_WIN32],[test "$with_platform" = "win32"])
 
 dnl Specify required versions of dependencies
 DBUS_GLIB_REQUIRED=0.70
-GTK_REQUIRED=2.20.0
+GTK_REQUIRED=2.21.0
 GLIB_REQUIRED=2.25.3
 KEYRING_REQUIRED=2.22.0
 GCONF_REQUIRED=2.31.2
index a9acfb08719e4cf9b6ebd7438e0dd18e0dceb5bf..ae7e2bf6f8fd55728ce43b1ad3eda7ea9ca21b24 100644 (file)
@@ -84,22 +84,14 @@ send_focus_change (GtkWidget *widget,
 {
        GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE);
 
-       g_object_ref (widget);
-
-       if (in)
-               GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
-       else
-               GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
-
        fevent->focus_change.type = GDK_FOCUS_CHANGE;
-       fevent->focus_change.window = g_object_ref (widget->window);
+       fevent->focus_change.window = gtk_widget_get_window (widget);
        fevent->focus_change.in = in;
+       if (fevent->focus_change.window)
+               g_object_ref (fevent->focus_change.window);
 
-       gtk_widget_event (widget, fevent);
+       gtk_widget_send_focus_change (widget, fevent);
 
-       g_object_notify (G_OBJECT (widget), "has-focus");
-
-       g_object_unref (widget);
        gdk_event_free (fevent);
 }
 
@@ -246,7 +238,9 @@ static void
 ev_annotation_window_set_resize_cursor (GtkWidget          *widget,
                                        EvAnnotationWindow *window)
 {
-       if (!widget->window)
+       GdkWindow *gdk_window = gtk_widget_get_window (widget);
+
+       if (!gdk_window)
                return;
 
        if (gtk_widget_is_sensitive (widget)) {
@@ -257,10 +251,10 @@ ev_annotation_window_set_resize_cursor (GtkWidget          *widget,
                                                     widget == window->resize_sw ?
                                                     GDK_BOTTOM_LEFT_CORNER :
                                                     GDK_BOTTOM_RIGHT_CORNER);
-               gdk_window_set_cursor (widget->window, cursor);
+               gdk_window_set_cursor (gdk_window, cursor);
                gdk_cursor_unref (cursor);
        } else {
-               gdk_window_set_cursor (widget->window, NULL);
+               gdk_window_set_cursor (gdk_window, NULL);
        }
 }
 
@@ -288,7 +282,7 @@ ev_annotation_window_init (EvAnnotationWindow *window)
        GtkWidget *icon;
        GtkWidget *swindow;
 
-       GTK_WIDGET_SET_FLAGS (window, GTK_CAN_FOCUS);
+       gtk_widget_set_can_focus (GTK_WIDGET (window), TRUE);
 
        vbox = gtk_vbox_new (FALSE, 0);
 
index 3827fdbf098a485c790748149dc87e65c2ace02a..8658711f793273dd37bdfcde9c7556cc9138d383 100644 (file)
@@ -479,13 +479,15 @@ ev_pixbuf_cache_clear_job_sizes (EvPixbufCache *pixbuf_cache,
 static void
 get_selection_colors (GtkWidget *widget, GdkColor **text, GdkColor **base)
 {
-    if (gtk_widget_has_focus (widget)) {
-       *text = &widget->style->text [GTK_STATE_SELECTED];
-       *base = &widget->style->base [GTK_STATE_SELECTED];
-    } else {
-       *text = &widget->style->text [GTK_STATE_ACTIVE];
-       *base = &widget->style->base [GTK_STATE_ACTIVE];
-    }
+       GtkStyle *style = gtk_widget_get_style (widget);
+
+       if (gtk_widget_has_focus (widget)) {
+               *text = &style->text [GTK_STATE_SELECTED];
+               *base = &style->base [GTK_STATE_SELECTED];
+       } else {
+               *text = &style->text [GTK_STATE_ACTIVE];
+               *base = &style->base [GTK_STATE_ACTIVE];
+       }
 }
 
 static void
index 850b4ec75d40de275ed91d82dbc99d2606ad2f18..ab023a9570970e83a6a86220178bd19380c9bf49 100644 (file)
@@ -89,7 +89,7 @@ ev_view_accessible_get_text (AtkText *text,
 {
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return NULL;
@@ -103,7 +103,7 @@ ev_view_accessible_get_character_at_offset (AtkText *text,
 {
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return '\0';
@@ -120,7 +120,7 @@ ev_view_accessible_get_text_before_offset (AtkText      *text,
 {
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return NULL;
@@ -137,7 +137,7 @@ ev_view_accessible_get_text_at_offset (AtkText          *text,
 {
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return NULL;
@@ -154,7 +154,7 @@ ev_view_accessible_get_text_after_offset  (AtkText      *text,
 {
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return NULL;
@@ -167,7 +167,7 @@ ev_view_accessible_get_character_count (AtkText *text)
 {
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return 0;
@@ -180,7 +180,7 @@ ev_view_accessible_get_caret_offset (AtkText *text)
 {
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return 0;
@@ -193,7 +193,7 @@ ev_view_accessible_set_caret_offset (AtkText *text, gint offset)
 {
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return FALSE;
@@ -209,7 +209,7 @@ ev_view_accessible_get_run_attributes (AtkText *text,
 {
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return NULL;
@@ -222,7 +222,7 @@ ev_view_accessible_get_default_attributes (AtkText *text)
 {
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return NULL;
@@ -241,7 +241,7 @@ ev_view_accessible_get_character_extents (AtkText *text,
 {
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return;
@@ -257,7 +257,7 @@ ev_view_accessible_get_offset_at_point (AtkText *text,
 { 
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return -1;
@@ -270,7 +270,7 @@ ev_view_accessible_get_n_selections (AtkText              *text)
 {
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return -1;
@@ -286,7 +286,7 @@ ev_view_accessible_get_selection (AtkText *text,
 {
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return NULL;
@@ -301,7 +301,7 @@ ev_view_accessible_add_selection (AtkText *text,
 {
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return FALSE;
@@ -315,7 +315,7 @@ ev_view_accessible_remove_selection (AtkText *text,
 {
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return FALSE;
@@ -331,7 +331,7 @@ ev_view_accessible_set_selection (AtkText *text,
 {
   GtkWidget *widget;
 
-  widget = GTK_ACCESSIBLE (text)->widget;
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
   if (widget == NULL)
     /* State is defunct */
     return FALSE;
@@ -369,7 +369,7 @@ ev_view_accessible_idle_do_action (gpointer data)
 {
        EvViewAccessiblePriv* priv = EV_VIEW_ACCESSIBLE_GET_PRIVATE (data);
        
-       ev_view_scroll (EV_VIEW (GTK_ACCESSIBLE (data)->widget), 
+       ev_view_scroll (EV_VIEW (gtk_accessible_get_widget (GTK_ACCESSIBLE (data))),
                        priv->idle_scroll,
                        FALSE);
        priv->action_idle_handler = 0;
@@ -382,7 +382,7 @@ ev_view_accessible_action_do_action (AtkAction *action,
 {
        EvViewAccessiblePriv* priv = EV_VIEW_ACCESSIBLE_GET_PRIVATE (action);
        
-       if (GTK_ACCESSIBLE (action)->widget == NULL)
+       if (gtk_accessible_get_widget (GTK_ACCESSIBLE (action)) == NULL)
                return FALSE;
 
        if (priv->action_idle_handler)
index 5df5cfaf5fe3b9ccd69fce5f64d55ee155c629fb..c0234a82d6565ee88318a31a928f538f89dabcfb 100644 (file)
@@ -116,12 +116,14 @@ 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;
-       gdk_window_set_background (widget->window, &widget->style->black);
+       style = gtk_widget_get_style (widget);
+       gdk_window_set_background (gtk_widget_get_window (widget), &style->black);
        gtk_widget_queue_draw (widget);
 }
 
@@ -129,12 +131,14 @@ 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;
-       gdk_window_set_background (widget->window, &widget->style->black);
+       style = gtk_widget_get_style (widget);
+       gdk_window_set_background (gtk_widget_get_window (widget), &style->black);
        gtk_widget_queue_draw (widget);
 }
 
@@ -142,12 +146,14 @@ 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;
-       gdk_window_set_background (widget->window, &widget->style->white);
+       style = gtk_widget_get_style (widget);
+       gdk_window_set_background (gtk_widget_get_window (widget), &style->white);
        gtk_widget_queue_draw (widget);
 }
 
@@ -188,10 +194,11 @@ static void
 ev_view_presentation_get_page_area (EvViewPresentation *pview,
                                    GdkRectangle       *area)
 {
-       GtkWidget *widget = GTK_WIDGET (pview);
-       gdouble    doc_width, doc_height;
-       gint       view_width, view_height;
-       gdouble    scale;
+       GtkWidget    *widget = GTK_WIDGET (pview);
+       GtkAllocation allocation;
+       gdouble       doc_width, doc_height;
+       gint          view_width, view_height;
+       gdouble       scale;
 
        ev_document_get_page_size (pview->document,
                                   pview->current_page,
@@ -206,8 +213,10 @@ ev_view_presentation_get_page_area (EvViewPresentation *pview,
                view_height = (gint)((doc_height * scale) + 0.5);
        }
 
-       area->x = (MAX (0, widget->allocation.width - view_width)) / 2;
-       area->y = (MAX (0, widget->allocation.height - view_height)) / 2;
+       gtk_widget_get_allocation (widget, &allocation);
+
+       area->x = (MAX (0, allocation.width - view_width)) / 2;
+       area->y = (MAX (0, allocation.height - view_height)) / 2;
        area->width = view_width;
        area->height = view_height;
 }
@@ -535,22 +544,14 @@ send_focus_change (GtkWidget *widget,
 {
        GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE);
 
-       g_object_ref (widget);
-
-       if (in)
-               GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
-       else
-               GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
-
        fevent->focus_change.type = GDK_FOCUS_CHANGE;
-       fevent->focus_change.window = g_object_ref (widget->window);
+       fevent->focus_change.window = gtk_widget_get_window (widget);
        fevent->focus_change.in = in;
+       if (fevent->focus_change.window)
+               g_object_ref (fevent->focus_change.window);
 
-       gtk_widget_event (widget, fevent);
-
-       g_object_notify (G_OBJECT (widget), "has-focus");
+       gtk_widget_send_focus_change (widget, fevent);
 
-       g_object_unref (widget);
        gdk_event_free (fevent);
 }
 
@@ -711,7 +712,9 @@ ev_view_presentation_goto_window_send_key_event (EvViewPresentation *pview,
 
        new_event = (GdkEventKey *) gdk_event_copy (event);
        g_object_unref (new_event->window);
-       new_event->window = g_object_ref (pview->goto_window->window);
+       new_event->window = gtk_widget_get_window (pview->goto_window);
+       if (new_event->window)
+               g_object_ref (new_event->window);
        gtk_widget_realize (pview->goto_window);
 
        gtk_widget_event (pview->goto_window, (GdkEvent *)new_event);
@@ -842,7 +845,7 @@ ev_view_presentation_set_cursor (EvViewPresentation *pview,
        pview->cursor = view_cursor;
 
        cursor = ev_view_cursor_new (gtk_widget_get_display (widget), view_cursor);
-       gdk_window_set_cursor (widget->window, cursor);
+       gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
        gdk_flush ();
        if (cursor)
                gdk_cursor_unref (cursor);
@@ -955,15 +958,6 @@ ev_view_presentation_size_request (GtkWidget      *widget,
        requisition->height = 0;
 }
 
-static void
-ev_view_presentation_size_allocate (GtkWidget     *widget,
-                                   GtkAllocation *allocation)
-{
-       GTK_WIDGET_CLASS (ev_view_presentation_parent_class)->size_allocate (widget, allocation);
-
-       widget->allocation = *allocation;
-}
-
 static void
 ev_view_presentation_draw_end_page (EvViewPresentation *pview)
 {
@@ -971,6 +965,7 @@ ev_view_presentation_draw_end_page (EvViewPresentation *pview)
        PangoLayout *layout;
        PangoFontDescription *font_desc;
        gchar *markup;
+       GtkAllocation allocation;
        GdkRectangle area = {0};
        const gchar *text = _("End of presentation. Click to exit.");
 
@@ -986,11 +981,12 @@ ev_view_presentation_draw_end_page (EvViewPresentation *pview)
        pango_font_description_set_size (font_desc, 16 * PANGO_SCALE);
        pango_layout_set_font_description (layout, font_desc);
 
-       area.width = widget->allocation.width;
-       area.height = widget->allocation.height;
+       gtk_widget_get_allocation (widget, &allocation);
+       area.width = allocation.width;
+       area.height = allocation.height;
 
-       gtk_paint_layout (widget->style,
-                         widget->window,
+       gtk_paint_layout (gtk_widget_get_style (widget),
+                         gtk_widget_get_window (widget),
                          gtk_widget_get_state (widget),
                          FALSE,
                          &area,
@@ -1029,7 +1025,7 @@ ev_view_presentation_expose_event (GtkWidget      *widget,
                if (ev_transition_animation_ready (pview->animation)) {
                        ev_view_presentation_get_page_area (pview, &page_area);
 
-                       cr = gdk_cairo_create (widget->window);
+                       cr = gdk_cairo_create (gtk_widget_get_window (widget));
 
                        /* normalize to x=0, y=0 */
                        cairo_translate (cr, page_area.x, page_area.y);
@@ -1056,7 +1052,7 @@ ev_view_presentation_expose_event (GtkWidget      *widget,
 
        ev_view_presentation_get_page_area (pview, &page_area);
        if (gdk_rectangle_intersect (&page_area, &(event->area), &overlap)) {
-               cr = gdk_cairo_create (widget->window);
+               cr = gdk_cairo_create (gtk_widget_get_window (widget));
 
                /* Try to fix rounding errors. See bug #438760 */
                if (overlap.width == page_area.width)
@@ -1204,7 +1200,7 @@ init_presentation (GtkWidget *widget)
        GdkRectangle        monitor;
        gint                monitor_num;
 
-       monitor_num = gdk_screen_get_monitor_at_window (screen, widget->window);
+       monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget));
        gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
        pview->monitor_width = monitor.width;
        pview->monitor_height = monitor.height;
@@ -1218,19 +1214,23 @@ init_presentation (GtkWidget *widget)
 static void
 ev_view_presentation_realize (GtkWidget *widget)
 {
+       GdkWindow    *window;
+       GtkStyle     *style;
        GdkWindowAttr attributes;
+       GtkAllocation allocation;
 
-       GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+       gtk_widget_set_realized (widget, TRUE);
 
        attributes.window_type = GDK_WINDOW_CHILD;
        attributes.wclass = GDK_INPUT_OUTPUT;
        attributes.visual = gtk_widget_get_visual (widget);
        attributes.colormap = gtk_widget_get_colormap (widget);
 
-       attributes.x = widget->allocation.x;
-       attributes.y = widget->allocation.y;
-       attributes.width = widget->allocation.width;
-       attributes.height = widget->allocation.height;
+       gtk_widget_get_allocation (widget, &allocation);
+       attributes.x = allocation.x;
+       attributes.y = allocation.y;
+       attributes.width = allocation.width;
+       attributes.height = allocation.height;
        attributes.event_mask = GDK_EXPOSURE_MASK |
                GDK_BUTTON_PRESS_MASK |
                GDK_BUTTON_RELEASE_MASK |
@@ -1241,15 +1241,18 @@ ev_view_presentation_realize (GtkWidget *widget)
                GDK_ENTER_NOTIFY_MASK |
                GDK_LEAVE_NOTIFY_MASK;
 
-       widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
-                                        &attributes,
-                                        GDK_WA_X | GDK_WA_Y |
-                                        GDK_WA_COLORMAP |
-                                        GDK_WA_VISUAL);
-       gdk_window_set_user_data (widget->window, widget);
-       widget->style = gtk_style_attach (widget->style, widget->window);
+       window = gdk_window_new (gtk_widget_get_parent_window (widget),
+                                &attributes,
+                                GDK_WA_X | GDK_WA_Y |
+                                GDK_WA_COLORMAP |
+                                GDK_WA_VISUAL);
+
+       gdk_window_set_user_data (window, widget);
+       gtk_widget_set_window (widget, window);
 
-       gdk_window_set_background (widget->window, &widget->style->black);
+       gtk_widget_style_attach (widget);
+       style = gtk_widget_get_style (widget);
+       gdk_window_set_background (window, &style->black);
 
        g_idle_add ((GSourceFunc)init_presentation, widget);
 }
@@ -1370,7 +1373,6 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass)
 
        klass->change_page = ev_view_presentation_change_page;
 
-       widget_class->size_allocate = ev_view_presentation_size_allocate;
        widget_class->size_request = ev_view_presentation_size_request;
        widget_class->realize = ev_view_presentation_realize;
        widget_class->expose_event = ev_view_presentation_expose_event;
@@ -1471,7 +1473,7 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass)
 static void
 ev_view_presentation_init (EvViewPresentation *pview)
 {
-       GTK_WIDGET_SET_FLAGS (pview, GTK_CAN_FOCUS);
+       gtk_widget_set_can_focus (GTK_WIDGET (pview), TRUE);
 }
 
 GtkWidget *
index 69f4bdd0eb6212ef9e56d23e23be4904b119729b..b5c7e530e357304b0fcf3c53b8fefb6fd47afa7b 100644 (file)
@@ -458,19 +458,22 @@ ev_view_get_scrollbar_size (EvView        *view,
        GtkWidget *widget = GTK_WIDGET (view);
        GtkWidget *sb;
        GtkWidget *swindow = gtk_widget_get_parent (GTK_WIDGET (view));
+       GtkAllocation allocation;
        GtkRequisition req;
        gint spacing;
 
        if (!GTK_IS_SCROLLED_WINDOW (swindow))
                return 0;
 
+       gtk_widget_get_allocation (widget, &allocation);
+
        if (orientation == GTK_ORIENTATION_VERTICAL) {
-               if (widget->allocation.height >= view->requisition.height)
+               if (allocation.height >= view->requisition.height)
                        sb = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (swindow));
                else
                        return 0;
        } else {
-               if (widget->allocation.width >= view->requisition.width)
+               if (allocation.width >= view->requisition.width)
                        sb = gtk_scrolled_window_get_hscrollbar (GTK_SCROLLED_WINDOW (swindow));
                else
                        return 0;
@@ -488,28 +491,33 @@ scroll_to_point (EvView        *view,
                 gdouble        y,
                 GtkOrientation orientation)
 {
+       gdouble page_size;
+       gdouble upper, lower;
+
        if (orientation == GTK_ORIENTATION_VERTICAL) {
+               page_size = gtk_adjustment_get_page_size (view->vadjustment);
+               upper = gtk_adjustment_get_upper (view->vadjustment);
+               lower = gtk_adjustment_get_lower (view->vadjustment);
+
                if (view->continuous) {
                        gtk_adjustment_clamp_page (view->vadjustment,
                                                   y - view->spacing / 2,
-                                                  y + view->vadjustment->page_size);
+                                                  y + page_size);
                } else {
                        gtk_adjustment_set_value (view->vadjustment,
-                                                 CLAMP (y,
-                                                 view->vadjustment->lower,
-                                                 view->vadjustment->upper -
-                                                 view->vadjustment->page_size));
+                                                 CLAMP (y, lower, upper - page_size));
                }
        } else {
+               page_size = gtk_adjustment_get_page_size (view->hadjustment);
+               upper = gtk_adjustment_get_upper (view->hadjustment);
+               lower = gtk_adjustment_get_lower (view->hadjustment);
+
                if (view->dual_page) {
                        gtk_adjustment_clamp_page (view->hadjustment, x,
-                                                  x + view->hadjustment->page_size);
+                                                  x + page_size);
                } else {
                        gtk_adjustment_set_value (view->hadjustment,
-                                                 CLAMP (x,
-                                                 view->hadjustment->lower,
-                                                 view->hadjustment->upper -
-                                                 view->hadjustment->page_size));
+                                                 CLAMP (x, lower, upper - page_size));
                }
        }
 }
@@ -548,19 +556,24 @@ view_set_adjustment_values (EvView         *view,
 {
        GtkWidget *widget = GTK_WIDGET (view);
        GtkAdjustment *adjustment;
-       int requisition;
-       int allocation;
-
+       GtkAllocation allocation;
+       int req_size;
+       int alloc_size;
+       gdouble page_size;
+       gdouble value;
+       gdouble upper;
        double factor;
        gint new_value;
 
+       gtk_widget_get_allocation (widget, &allocation);
+
        if (orientation == GTK_ORIENTATION_HORIZONTAL)  {
-               requisition = view->requisition.width;
-               allocation = widget->allocation.width;
+               req_size = view->requisition.width;
+               alloc_size = allocation.width;
                adjustment = view->hadjustment;
        } else {
-               requisition = view->requisition.height;
-               allocation = widget->allocation.height;
+               req_size = view->requisition.height;
+               alloc_size = allocation.height;
                adjustment = view->vadjustment;
        }
 
@@ -568,23 +581,30 @@ view_set_adjustment_values (EvView         *view,
                return;
 
        factor = 1.0;
+       value = gtk_adjustment_get_value (adjustment);
+       upper = gtk_adjustment_get_upper (adjustment);
+       page_size = gtk_adjustment_get_page_size (adjustment);
+
        switch (view->pending_scroll) {
                case SCROLL_TO_KEEP_POSITION:
                case SCROLL_TO_FIND_LOCATION:
-                       factor = (adjustment->value) / adjustment->upper;
+                       factor = value / upper;
                        break;
                case SCROLL_TO_PAGE_POSITION:
                        break;
                case SCROLL_TO_CENTER:
-                       factor = (adjustment->value + adjustment->page_size * 0.5) / adjustment->upper;
+                       factor = (value + page_size * 0.5) / upper;
                        break;
        }
 
-       adjustment->page_size = allocation;
-       adjustment->step_increment = allocation * 0.1;
-       adjustment->page_increment = allocation * 0.9;
-       adjustment->lower = 0;
-       adjustment->upper = MAX (allocation, requisition);
+       upper = MAX (alloc_size, req_size);
+       page_size = alloc_size;
+
+       gtk_adjustment_set_page_size (adjustment, page_size);
+       gtk_adjustment_set_step_increment (adjustment, alloc_size * 0.1);
+       gtk_adjustment_set_page_increment (adjustment, alloc_size * 0.9);
+       gtk_adjustment_set_lower (adjustment, 0);
+       gtk_adjustment_set_upper (adjustment, upper);
 
        /*
         * We add 0.5 to the values before to average out our rounding errors.
@@ -592,15 +612,15 @@ view_set_adjustment_values (EvView         *view,
        switch (view->pending_scroll) {
                case SCROLL_TO_KEEP_POSITION:
                case SCROLL_TO_FIND_LOCATION:
-                       new_value = CLAMP (adjustment->upper * factor + 0.5, 0, adjustment->upper - adjustment->page_size);
+                       new_value = CLAMP (upper * factor + 0.5, 0, upper - page_size);
                        gtk_adjustment_set_value (adjustment, (int)new_value);
                        break;
                case SCROLL_TO_PAGE_POSITION:
                        ev_view_scroll_to_page_position (view, orientation);
                        break;
                case SCROLL_TO_CENTER:
-                       new_value = CLAMP (adjustment->upper * factor - adjustment->page_size * 0.5 + 0.5,
-                                          0, adjustment->upper - adjustment->page_size);
+                       new_value = CLAMP (upper * factor - page_size * 0.5 + 0.5,
+                                          0, upper - page_size);
                        gtk_adjustment_set_value (adjustment, (int)new_value);
                        break;
        }
@@ -629,10 +649,10 @@ view_update_range_and_current_page (EvView *view)
                if (!(view->vadjustment && view->hadjustment))
                        return;
 
-               current_area.x = view->hadjustment->value;
-               current_area.width = view->hadjustment->page_size;
-               current_area.y = view->vadjustment->value;
-               current_area.height = view->vadjustment->page_size;
+               current_area.x = gtk_adjustment_get_value (view->hadjustment);
+               current_area.width = gtk_adjustment_get_page_size (view->hadjustment);
+               current_area.y = gtk_adjustment_get_value (view->vadjustment);
+               current_area.height = gtk_adjustment_get_page_size (view->vadjustment);
 
                for (i = 0; i < ev_document_get_n_pages (view->document); i++) {
 
@@ -793,6 +813,7 @@ compute_scroll_increment (EvView        *view,
        GtkWidget *widget = GTK_WIDGET (view);
        GtkAdjustment *adjustment = view->vadjustment;
        GdkRegion *text_region, *region;
+       GtkAllocation allocation;
        gint page;
        GdkRectangle rect;
        EvRectangle doc_rect;
@@ -803,17 +824,18 @@ compute_scroll_increment (EvView        *view,
        gdouble fraction = 1.0;
 
        if (scroll != GTK_SCROLL_PAGE_BACKWARD && scroll != GTK_SCROLL_PAGE_FORWARD)
-               return adjustment->page_size;
+               return gtk_adjustment_get_page_size (adjustment);
 
        page = scroll == GTK_SCROLL_PAGE_BACKWARD ? view->start_page : view->end_page;
 
        text_region = ev_page_cache_get_text_mapping (view->page_cache, page);
        if (!text_region || gdk_region_empty (text_region))
-               return adjustment->page_size;
+               return gtk_adjustment_get_page_size (adjustment);
 
+       gtk_widget_get_allocation (widget, &allocation);
        get_page_extents (view, page, &page_area, &border);
        rect.x = page_area.x + view->scroll_x;
-       rect.y = view->scroll_y + (scroll == GTK_SCROLL_PAGE_BACKWARD ? 5 : widget->allocation.height - 5);
+       rect.y = view->scroll_y + (scroll == GTK_SCROLL_PAGE_BACKWARD ? 5 : allocation.height - 5);
        rect.width = page_area.width;
        rect.height = 1;
        view_rect_to_doc_rect (view, &rect, &page_area, &doc_rect);
@@ -850,12 +872,12 @@ compute_scroll_increment (EvView        *view,
                gdk_region_get_rectangles (region, &recs, &n_recs);
                gdk_region_destroy (region);
                if (n_recs > 0) {
-                       fraction = 1 - (recs[0].height / adjustment->page_size);
+                       fraction = 1 - (recs[0].height / gtk_adjustment_get_page_size (adjustment));
                }
                g_free (recs);
        }
 
-       return adjustment->page_size * fraction;
+       return gtk_adjustment_get_page_size (adjustment) * fraction;
 
 }
 
@@ -866,6 +888,9 @@ ev_view_scroll (EvView        *view,
 {
        GtkAdjustment *adjustment;
        double value, increment;
+       gdouble upper, lower;
+       gdouble page_size;
+       gdouble step_increment;
        gboolean first_page = FALSE;
        gboolean last_page = FALSE;
 
@@ -889,7 +914,11 @@ ev_view_scroll (EvView        *view,
 
        /* Assign values for increment and vertical adjustment */
        adjustment = horizontal ? view->hadjustment : view->vadjustment;
-       value = adjustment->value;
+       value = gtk_adjustment_get_value (adjustment);
+       upper = gtk_adjustment_get_upper (adjustment);
+       lower = gtk_adjustment_get_lower (adjustment);
+       page_size = gtk_adjustment_get_page_size (adjustment);
+       step_increment = gtk_adjustment_get_step_increment (adjustment);
 
        /* Assign boolean for first and last page */
        if (view->current_page == 0)
@@ -900,50 +929,49 @@ ev_view_scroll (EvView        *view,
        switch (scroll) {
                case GTK_SCROLL_PAGE_BACKWARD:
                        /* Do not jump backwards if at the first page */
-                       if (value == (adjustment->lower) && first_page) {
+                       if (value == lower && first_page) {
                                /* Do nothing */
                                /* At the top of a page, assign the upper bound limit of previous page */
-                       } else if (value == (adjustment->lower)) {
-                               value = adjustment->upper - adjustment->page_size;
+                       } else if (value == lower) {
+                               value = upper - page_size;
                                ev_view_previous_page (view);
                                /* Jump to the top */
                        } else {
                                increment = compute_scroll_increment (view, GTK_SCROLL_PAGE_BACKWARD);
-                               value = MAX (value - increment, adjustment->lower);
+                               value = MAX (value - increment, lower);
                        }
                        break;
                case GTK_SCROLL_PAGE_FORWARD:
                        /* Do not jump forward if at the last page */
-                       if (value == (adjustment->upper - adjustment->page_size) && last_page) {
+                       if (value == (upper - page_size) && last_page) {
                                /* Do nothing */
                        /* At the bottom of a page, assign the lower bound limit of next page */
-                       } else if (value == (adjustment->upper - adjustment->page_size)) {
+                       } else if (value == (upper - page_size)) {
                                value = 0;
                                ev_view_next_page (view);
                        /* Jump to the bottom */
                        } else {
                                increment = compute_scroll_increment (view, GTK_SCROLL_PAGE_FORWARD);
-                               value = MIN (value + increment, adjustment->upper - adjustment->page_size);
+                               value = MIN (value + increment, upper - page_size);
                        }
                        break;
                case GTK_SCROLL_STEP_BACKWARD:
-                       value -= adjustment->step_increment;
+                       value -= step_increment;
                        break;
                case GTK_SCROLL_STEP_FORWARD:
-                       value += adjustment->step_increment;
+                       value += step_increment;
                        break;
                case GTK_SCROLL_STEP_DOWN:
-                       value -= adjustment->step_increment / 10;
+                       value -= step_increment / 10;
                        break;
                case GTK_SCROLL_STEP_UP:
-                       value += adjustment->step_increment / 10;
+                       value += step_increment / 10;
                        break;
                default:
                        break;
        }
 
-       value = CLAMP (value, adjustment->lower,
-                      adjustment->upper - adjustment->page_size);      
+       value = CLAMP (value, lower, upper - page_size);
 
        gtk_adjustment_set_value (adjustment, value);
 }
@@ -955,31 +983,35 @@ ensure_rectangle_is_visible (EvView *view, GdkRectangle *rect)
 {
        GtkWidget *widget = GTK_WIDGET (view);
        GtkAdjustment *adjustment;
+       GtkAllocation allocation;
+       gdouble adj_value;
        int value;
 
        view->pending_scroll = SCROLL_TO_FIND_LOCATION;
 
+       gtk_widget_get_allocation (widget, &allocation);
+
        adjustment = view->vadjustment;
+       adj_value = gtk_adjustment_get_value (adjustment);
 
-       if (rect->y < adjustment->value) {
-               value = MAX (adjustment->lower, rect->y - MARGIN);
+       if (rect->y < adj_value) {
+               value = MAX (gtk_adjustment_get_lower (adjustment), rect->y - MARGIN);
                gtk_adjustment_set_value (view->vadjustment, value);
-       } else if (rect->y + rect->height >
-                  adjustment->value + widget->allocation.height) {
-               value = MIN (adjustment->upper, rect->y + rect->height -
-                            widget->allocation.height + MARGIN);
+       } else if (rect->y + rect->height > adj_value + allocation.height) {
+               value = MIN (gtk_adjustment_get_upper (adjustment), rect->y + rect->height -
+                            allocation.height + MARGIN);
                gtk_adjustment_set_value (view->vadjustment, value);
        }
 
        adjustment = view->hadjustment;
+       adj_value = gtk_adjustment_get_value (adjustment);
 
-       if (rect->x < adjustment->value) {
-               value = MAX (adjustment->lower, rect->x - MARGIN);
+       if (rect->x < adj_value) {
+               value = MAX (gtk_adjustment_get_lower (adjustment), rect->x - MARGIN);
                gtk_adjustment_set_value (view->hadjustment, value);
-       } else if (rect->x + rect->height >
-                  adjustment->value + widget->allocation.width) {
-               value = MIN (adjustment->upper, rect->x + rect->width -
-                            widget->allocation.width + MARGIN);
+       } else if (rect->x + rect->height > adj_value + allocation.width) {
+               value = MIN (gtk_adjustment_get_upper (adjustment), rect->x + rect->width -
+                            allocation.width + MARGIN);
                gtk_adjustment_set_value (view->hadjustment, value);
        }
 
@@ -1081,8 +1113,10 @@ get_page_extents (EvView       *view,
 {
        GtkWidget *widget;
        int width, height;
+       GtkAllocation allocation;
 
        widget = GTK_WIDGET (view);
+       gtk_widget_get_allocation (widget, &allocation);
 
        /* Get the size of the page */
        ev_view_get_page_size (view, page, &width, &height);
@@ -1099,12 +1133,12 @@ get_page_extents (EvView       *view,
                /* Get the location of the bounding box */
                if (view->dual_page) {
                        x = view->spacing + ((page % 2 == get_dual_even_left (view)) ? 0 : 1) * (max_width + view->spacing);
-                       x = x + MAX (0, widget->allocation.width - (max_width * 2 + view->spacing * 3)) / 2;
+                       x = x + MAX (0, allocation.width - (max_width * 2 + view->spacing * 3)) / 2;
                        if (page % 2 == get_dual_even_left (view))
                                x = x + (max_width - width - border->left - border->right);
                } else {
                        x = view->spacing;
-                       x = x + MAX (0, widget->allocation.width - (width + view->spacing * 2)) / 2;
+                       x = x + MAX (0, allocation.width - (width + view->spacing * 2)) / 2;
                }
 
                get_page_y_offset (view, page, &y);
@@ -1147,16 +1181,16 @@ get_page_extents (EvView       *view,
                        y = y + (max_height - height)/2;
 
                        /* Adjust for extra allocation */
-                       x = x + MAX (0, widget->allocation.width -
+                       x = x + MAX (0, allocation.width -
                                     ((max_width + overall_border.left + overall_border.right) * 2 + view->spacing * 3))/2;
-                       y = y + MAX (0, widget->allocation.height - (height + view->spacing * 2))/2;
+                       y = y + MAX (0, allocation.height - (height + view->spacing * 2))/2;
                } else {
                        x = view->spacing;
                        y = view->spacing;
 
                        /* Adjust for extra allocation */
-                       x = x + MAX (0, widget->allocation.width - (width + border->left + border->right + view->spacing * 2))/2;
-                       y = y + MAX (0, widget->allocation.height - (height + border->top + border->bottom +  view->spacing * 2))/2;
+                       x = x + MAX (0, allocation.width - (width + border->left + border->right + view->spacing * 2))/2;
+                       y = y + MAX (0, allocation.height - (height + border->top + border->bottom +  view->spacing * 2))/2;
                }
 
                page_area->x = x;
@@ -1355,18 +1389,6 @@ location_in_text (EvView  *view,
                return FALSE;
 }
 
-static int
-ev_view_get_width (EvView *view)
-{
-       return GTK_WIDGET (view)->allocation.width;
-}
-
-static int
-ev_view_get_height (EvView *view)
-{
-       return GTK_WIDGET (view)->allocation.height;
-}
-
 static gboolean
 location_in_selected_text (EvView  *view,
                           gdouble  x,
@@ -1496,14 +1518,17 @@ goto_fitr_dest (EvView *view, EvLinkDest *dest)
        EvPoint doc_point;
        gdouble zoom, left, top;
        gboolean change_left, change_top;
+       GtkAllocation allocation;
+
+       gtk_widget_get_allocation (GTK_WIDGET (view), &allocation);
 
        left = ev_link_dest_get_left (dest, &change_left);
        top = ev_link_dest_get_top (dest, &change_top);
 
        zoom = zoom_for_size_best_fit (ev_link_dest_get_right (dest) - left,
                                       ev_link_dest_get_bottom (dest) - top,
-                                      ev_view_get_width (view),
-                                      ev_view_get_height (view));
+                                      allocation.width,
+                                      allocation.height);
 
        ev_document_model_set_sizing_mode (view->model, EV_SIZING_FREE);
        ev_document_model_set_scale (view->model, zoom);
@@ -1523,6 +1548,9 @@ goto_fitv_dest (EvView *view, EvLinkDest *dest)
        gint page;
        double zoom, left;
        gboolean change_left;
+       GtkAllocation allocation;
+
+       gtk_widget_get_allocation (GTK_WIDGET (view), &allocation);
 
        page = ev_link_dest_get_page (dest);
        ev_document_get_page_size (view->document, page, &doc_width, &doc_height);
@@ -1532,8 +1560,8 @@ goto_fitv_dest (EvView *view, EvLinkDest *dest)
        doc_point.y = 0;
 
        zoom = zoom_for_size_fit_height (doc_width - doc_point.x , doc_height,
-                                        ev_view_get_width (view),
-                                        ev_view_get_height (view));
+                                        allocation.width,
+                                        allocation.height);
 
        ev_document_model_set_sizing_mode (view->model, EV_SIZING_FREE);
        ev_document_model_set_scale (view->model, zoom);
@@ -1551,6 +1579,9 @@ goto_fith_dest (EvView *view, EvLinkDest *dest)
        gint page;
        gdouble zoom, top;
        gboolean change_top;
+       GtkAllocation allocation;
+
+       gtk_widget_get_allocation (GTK_WIDGET (view), &allocation);
 
        page = ev_link_dest_get_page (dest);
        ev_document_get_page_size (view->document, page, &doc_width, &doc_height);
@@ -1561,8 +1592,8 @@ goto_fith_dest (EvView *view, EvLinkDest *dest)
        doc_point.y = change_top ? top : 0;
 
        zoom = zoom_for_size_fit_width (doc_width, top,
-                                       ev_view_get_width (view),
-                                       ev_view_get_height (view));
+                                       allocation.width,
+                                       allocation.height);
 
        ev_document_model_set_sizing_mode (view->model, EV_SIZING_FIT_WIDTH);
        ev_document_model_set_scale (view->model, zoom);
@@ -1578,13 +1609,16 @@ goto_fit_dest (EvView *view, EvLinkDest *dest)
        double zoom;
        gdouble doc_width, doc_height;
        int page;
+       GtkAllocation allocation;
+
+       gtk_widget_get_allocation (GTK_WIDGET (view), &allocation);
 
        page = ev_link_dest_get_page (dest);
        ev_document_get_page_size (view->document, page, &doc_width, &doc_height);
 
        zoom = zoom_for_size_best_fit (doc_width, doc_height,
-                                      ev_view_get_width (view),
-                                      ev_view_get_height (view));
+                                      allocation.width,
+                                      allocation.height);
 
        ev_document_model_set_sizing_mode (view->model, EV_SIZING_BEST_FIT);
        ev_document_model_set_scale (view->model, zoom);
@@ -2274,7 +2308,8 @@ ev_view_form_field_choice_create_widget (EvView      *view,
                g_signal_connect (choice, "changed",
                                  G_CALLBACK (ev_view_form_field_choice_changed),
                                  field);
-               g_signal_connect_after (GTK_BIN(choice)->child, "activate",
+               g_signal_connect_after (gtk_bin_get_child (GTK_BIN (choice)),
+                                       "activate",
                                        G_CALLBACK (ev_view_form_field_destroy),
                                        view);
        } else { /* ComboBoxText */
@@ -2833,7 +2868,7 @@ ev_view_size_request (GtkWidget      *widget,
                      GtkRequisition *requisition)
 {
        EvView *view = EV_VIEW (widget);
-       
+
        if (view->document == NULL) {
                view->requisition.width = 1;
                view->requisition.height = 1;
@@ -2849,9 +2884,12 @@ ev_view_size_request (GtkWidget      *widget,
        if (!view->internal_size_request &&
            (view->sizing_mode == EV_SIZING_FIT_WIDTH ||
             view->sizing_mode == EV_SIZING_BEST_FIT)) {
+               GtkAllocation allocation;
+
+               gtk_widget_get_allocation (widget, &allocation);
                ev_view_zoom_for_size (view,
-                                      widget->allocation.width,
-                                      widget->allocation.height);
+                                      allocation.width,
+                                      allocation.height);
        }
 
        if (view->continuous && view->dual_page)
@@ -2969,13 +3007,16 @@ ev_view_size_allocate (GtkWidget      *widget,
 static void
 ev_view_realize (GtkWidget *widget)
 {
-       EvView *view = EV_VIEW (widget);
+       EvView    *view = EV_VIEW (widget);
+       GdkWindow *bin_window;
+       GtkStyle  *style;
 
        if (GTK_WIDGET_CLASS (ev_view_parent_class)->realize)
                (* GTK_WIDGET_CLASS (ev_view_parent_class)->realize) (widget);
 
-       gdk_window_set_events (view->layout.bin_window,
-                              (gdk_window_get_events (view->layout.bin_window) | 
+       bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view));
+       gdk_window_set_events (bin_window,
+                              (gdk_window_get_events (bin_window) |
                                GDK_EXPOSURE_MASK |
                                GDK_BUTTON_PRESS_MASK |
                                GDK_BUTTON_RELEASE_MASK |
@@ -2986,7 +3027,8 @@ ev_view_realize (GtkWidget *widget)
                                GDK_ENTER_NOTIFY_MASK |
                                GDK_LEAVE_NOTIFY_MASK));
 
-       gdk_window_set_background (view->layout.bin_window, &widget->style->mid [GTK_STATE_NORMAL]);
+       style = gtk_widget_get_style (widget);
+       gdk_window_set_background (bin_window, &style->mid[GTK_STATE_NORMAL]);
 
        on_adjustment_value_changed (NULL, view);
 }
@@ -3072,9 +3114,10 @@ static gboolean
 ev_view_expose_event (GtkWidget      *widget,
                      GdkEventExpose *event)
 {
-       EvView  *view = EV_VIEW (widget);
-       cairo_t *cr;
-       gint     i;
+       EvView    *view = EV_VIEW (widget);
+       GdkWindow *bin_window;
+       cairo_t   *cr;
+       gint       i;
 
        if (view->loading) {
                show_loading_window (view);
@@ -3086,7 +3129,8 @@ ev_view_expose_event (GtkWidget      *widget,
        if (view->document == NULL)
                return FALSE;
 
-       cr = gdk_cairo_create (view->layout.bin_window);
+       bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view));
+       cr = gdk_cairo_create (bin_window);
 
        for (i = view->start_page; i >= 0 && i <= view->end_page; i++) {
                GdkRectangle page_area;
@@ -3455,34 +3499,36 @@ selection_scroll_timeout_cb (EvView *view)
 {      
        gint x, y, shift = 0;
        GtkWidget *widget = GTK_WIDGET (view);
-       
+       GtkAllocation allocation;
+
+       gtk_widget_get_allocation (widget, &allocation);
        gtk_widget_get_pointer (widget, &x, &y);
 
-       if (y > widget->allocation.height) {
-               shift = (y - widget->allocation.height) / 2;
+       if (y > allocation.height) {
+               shift = (y - allocation.height) / 2;
        } else if (y < 0) {
                shift = y / 2;
        }
 
        if (shift)
                gtk_adjustment_set_value (view->vadjustment,
-                                         CLAMP (view->vadjustment->value + shift,
-                                         view->vadjustment->lower,
-                                         view->vadjustment->upper -
-                                         view->vadjustment->page_size));       
+                                         CLAMP (gtk_adjustment_get_value (view->vadjustment) + shift,
+                                                gtk_adjustment_get_lower (view->vadjustment),
+                                                gtk_adjustment_get_upper (view->vadjustment) -
+                                                gtk_adjustment_get_page_size (view->vadjustment)));
 
-       if (x > widget->allocation.width) {
-               shift = (x - widget->allocation.width) / 2;
+       if (x > allocation.width) {
+               shift = (x - allocation.width) / 2;
        } else if (x < 0) {
                shift = x / 2;
        }
 
        if (shift)
                gtk_adjustment_set_value (view->hadjustment,
-                                         CLAMP (view->hadjustment->value + shift,
-                                         view->hadjustment->lower,
-                                         view->hadjustment->upper -
-                                         view->hadjustment->page_size));       
+                                         CLAMP (gtk_adjustment_get_value (view->hadjustment) + shift,
+                                                gtk_adjustment_get_lower (view->hadjustment),
+                                                gtk_adjustment_get_upper (view->hadjustment) -
+                                                gtk_adjustment_get_page_size (view->hadjustment)));
 
        return TRUE;
 }
@@ -3514,36 +3560,47 @@ ev_view_scroll_drag_release (EvView *view)
 {
        gdouble dhadj_value, dvadj_value;
        gdouble oldhadjustment, oldvadjustment;
+       gdouble h_page_size, v_page_size;
+       gdouble h_upper, v_upper;
+       GtkAllocation allocation;
 
        view->drag_info.momentum.x /= 1.2;
        view->drag_info.momentum.y /= 1.2; /* Alter these constants to change "friction" */
 
-       dhadj_value = view->hadjustment->page_size *
-                     (gdouble)view->drag_info.momentum.x / GTK_WIDGET (view)->allocation.width;
-       dvadj_value = view->vadjustment->page_size *
-                     (gdouble)view->drag_info.momentum.y / GTK_WIDGET (view)->allocation.height;
+       gtk_widget_get_allocation (GTK_WIDGET (view), &allocation);
+
+       h_page_size = gtk_adjustment_get_page_size (view->hadjustment);
+       v_page_size = gtk_adjustment_get_page_size (view->vadjustment);
+
+       dhadj_value = h_page_size *
+                     (gdouble)view->drag_info.momentum.x / allocation.width;
+       dvadj_value = v_page_size *
+                     (gdouble)view->drag_info.momentum.y / allocation.height;
 
        oldhadjustment = gtk_adjustment_get_value (view->hadjustment);
        oldvadjustment = gtk_adjustment_get_value (view->vadjustment);
 
-     /* When we reach the edges, we need either to absorb some momentum and bounce by
-      * multiplying it on -0.5 or stop scrolling by setting momentum to 0. */  
-     if (((oldhadjustment + dhadj_value) > (view->hadjustment->upper - view->hadjustment->page_size)) ||
-          ((oldhadjustment + dhadj_value) < 0))
+       h_upper = gtk_adjustment_get_upper (view->hadjustment);
+       v_upper = gtk_adjustment_get_upper (view->vadjustment);
+
+       /* When we reach the edges, we need either to absorb some momentum and bounce by
+        * multiplying it on -0.5 or stop scrolling by setting momentum to 0. */
+       if (((oldhadjustment + dhadj_value) > (h_upper - h_page_size)) ||
+           ((oldhadjustment + dhadj_value) < 0))
                view->drag_info.momentum.x = 0;
-       if (((oldvadjustment + dvadj_value) > (view->vadjustment->upper - view->vadjustment->page_size)) ||
-          ((oldvadjustment + dvadj_value) < 0))
+       if (((oldvadjustment + dvadj_value) > (v_upper - v_page_size)) ||
+           ((oldvadjustment + dvadj_value) < 0))
                view->drag_info.momentum.y = 0;
 
        gtk_adjustment_set_value (view->hadjustment,
-                               MIN (oldhadjustment + dhadj_value,
-                               view->hadjustment->upper - view->hadjustment->page_size));
+                                 MIN (oldhadjustment + dhadj_value,
+                                      h_upper - h_page_size));
        gtk_adjustment_set_value (view->vadjustment,
-                               MIN (oldvadjustment + dvadj_value,
-                               view->vadjustment->upper - view->vadjustment->page_size));
+                                 MIN (oldvadjustment + dvadj_value,
+                                      v_upper - v_page_size));
 
        if (((view->drag_info.momentum.x < 1) && (view->drag_info.momentum.x > -1)) &&
-          ((view->drag_info.momentum.y < 1) && (view->drag_info.momentum.y > -1)))
+           ((view->drag_info.momentum.y < 1) && (view->drag_info.momentum.y > -1)))
                return FALSE;
        else
                return TRUE;
@@ -3553,13 +3610,16 @@ static gboolean
 ev_view_motion_notify_event (GtkWidget      *widget,
                             GdkEventMotion *event)
 {
-       EvView *view = EV_VIEW (widget);
-       gint x, y;
+       EvView    *view = EV_VIEW (widget);
+       GdkWindow *bin_window;
+       gint       x, y;
 
        if (!view->document)
                return FALSE;
 
-        if (event->is_hint || event->window != view->layout.bin_window) {
+       bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view));
+
+        if (event->is_hint || event->window != bin_window) {
            gtk_widget_get_pointer (widget, &x, &y);
         } else {
            x = event->x;
@@ -3668,6 +3728,7 @@ ev_view_motion_notify_event (GtkWidget      *widget,
                if (view->drag_info.in_drag) {
                        int dx, dy;
                        gdouble dhadj_value, dvadj_value;
+                       GtkAllocation allocation;
 
                        view->drag_info.buffer[0].x = event->x;
                        view->drag_info.buffer[0].y = event->y;
@@ -3675,20 +3736,22 @@ ev_view_motion_notify_event (GtkWidget      *widget,
                        dx = event->x_root - view->drag_info.start.x;
                        dy = event->y_root - view->drag_info.start.y;
 
-                       dhadj_value = view->hadjustment->page_size *
-                                     (gdouble)dx / widget->allocation.width;
-                       dvadj_value = view->vadjustment->page_size *
-                                     (gdouble)dy / widget->allocation.height;
+                       gtk_widget_get_allocation (widget, &allocation);
+
+                       dhadj_value = gtk_adjustment_get_page_size (view->hadjustment) *
+                                     (gdouble)dx / allocation.width;
+                       dvadj_value = gtk_adjustment_get_page_size (view->vadjustment) *
+                                     (gdouble)dy / allocation.height;
 
                        /* clamp scrolling to visible area */
                        gtk_adjustment_set_value (view->hadjustment,
-                                                 MIN(view->drag_info.hadj - dhadj_value,
-                                                     view->hadjustment->upper -
-                                                     view->hadjustment->page_size));
+                                                 MIN (view->drag_info.hadj - dhadj_value,
+                                                      gtk_adjustment_get_upper (view->hadjustment) -
+                                                      gtk_adjustment_get_page_size (view->hadjustment)));
                        gtk_adjustment_set_value (view->vadjustment,
-                                                 MIN(view->drag_info.vadj - dvadj_value,
-                                                     view->vadjustment->upper -
-                                                     view->vadjustment->page_size));
+                                                 MIN (view->drag_info.vadj - dvadj_value,
+                                                      gtk_adjustment_get_upper (view->vadjustment) -
+                                                      gtk_adjustment_get_page_size (view->vadjustment)));
 
                        return TRUE;
                }
@@ -3794,7 +3857,9 @@ ev_view_key_press_event (GtkWidget   *widget,
 
                        new_event = (GdkEventKey *) gdk_event_copy ((GdkEvent *)event);
                        g_object_unref (new_event->window);
-                       new_event->window = g_object_ref (view->window_child_focus->window->window);
+                       new_event->window = gtk_widget_get_window (view->window_child_focus->window);
+                       if (new_event->window)
+                               g_object_ref (new_event->window);
                        gtk_widget_realize (view->window_child_focus->window);
                        handled = gtk_widget_event (view->window_child_focus->window, (GdkEvent *)new_event);
                        gdk_event_free ((GdkEvent *)new_event);
@@ -3879,10 +3944,12 @@ draw_rubberband (GtkWidget *widget, GdkWindow *window,
 {
        GdkGC *gc;
        GdkPixbuf *pixbuf;
+       GtkStyle *style;
        GdkColor *fill_color_gdk;
        guint fill_color;
 
-       fill_color_gdk = gdk_color_copy (&GTK_WIDGET (widget)->style->base[GTK_STATE_SELECTED]);
+       style = gtk_widget_get_style (widget);
+       fill_color_gdk = gdk_color_copy (&style->base[GTK_STATE_SELECTED]);
        fill_color = ev_gdk_color_to_rgb (fill_color_gdk) << 8 | alpha;
 
        pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
@@ -3913,7 +3980,10 @@ draw_rubberband (GtkWidget *widget, GdkWindow *window,
 static void
 highlight_find_results (EvView *view, int page)
 {
-       gint i, n_results = 0;
+       gint       i, n_results = 0;
+       GdkWindow *bin_window;
+
+       bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view));
 
        n_results = ev_view_find_get_n_results (view, page);
 
@@ -3930,7 +4000,7 @@ highlight_find_results (EvView *view, int page)
 
                rectangle = ev_view_find_get_result (view, page, i);
                doc_rect_to_view_rect (view, page, rectangle, &view_rectangle);
-               draw_rubberband (GTK_WIDGET (view), view->layout.bin_window,
+               draw_rubberband (GTK_WIDGET (view), bin_window,
                                 &view_rectangle, alpha);
         }
 }
@@ -4019,6 +4089,7 @@ draw_one_page (EvView       *view,
               GdkRectangle *expose_area,
               gboolean     *page_ready)
 {
+       GdkWindow   *bin_window;
        GdkRectangle overlap;
        GdkRectangle real_page_area;
        gint         current_page;
@@ -4038,9 +4109,10 @@ draw_one_page (EvView       *view,
        real_page_area.height -= (border->top + border->bottom);
        *page_ready = TRUE;
 
+       bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view));
        current_page = ev_document_model_get_page (view->model);
        inverted_colors = ev_document_model_get_inverted_colors (view->model);
-       ev_document_misc_paint_one_page (view->layout.bin_window,
+       ev_document_misc_paint_one_page (bin_window,
                                         GTK_WIDGET (view),
                                         page_area, border,
                                         page == current_page,
@@ -4340,7 +4412,7 @@ ev_view_class_init (EvViewClass *class)
 static void
 ev_view_init (EvView *view)
 {
-       GTK_WIDGET_SET_FLAGS (view, GTK_CAN_FOCUS);
+       gtk_widget_set_can_focus (GTK_WIDGET (view), TRUE);
 
        view->start_page = -1;
        view->end_page = -1;
@@ -4392,8 +4464,10 @@ job_finished_cb (EvPixbufCache *pixbuf_cache,
                 EvView        *view)
 {
        if (region) {
-               gdk_window_invalidate_region (view->layout.bin_window,
-                                             region, TRUE);
+               GdkWindow *bin_window;
+
+               bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view));
+               gdk_window_invalidate_region (bin_window, region, TRUE);
        } else {
                gtk_widget_queue_draw (GTK_WIDGET (view));
        }
@@ -4423,21 +4497,24 @@ on_adjustment_value_changed (GtkAdjustment *adjustment,
 {
        int dx = 0, dy = 0;
        gint x, y;
+       gint value;
        GList *children, *l;
 
        if (!gtk_widget_get_realized (GTK_WIDGET (view)))
                return;
 
        if (view->hadjustment) {
-               dx = view->scroll_x - (int) view->hadjustment->value;
-               view->scroll_x = (int) view->hadjustment->value;
+               value = (gint) gtk_adjustment_get_value (view->hadjustment);
+               dx = view->scroll_x - value;
+               view->scroll_x = value;
        } else {
                view->scroll_x = 0;
        }
 
        if (view->vadjustment) {
-               dy = view->scroll_y - (int) view->vadjustment->value;
-               view->scroll_y = (int) view->vadjustment->value;
+               value = (gint) gtk_adjustment_get_value (view->vadjustment);
+               dy = view->scroll_y - value;
+               view->scroll_y = value;
        } else {
                view->scroll_y = 0;
        }
@@ -4464,11 +4541,15 @@ on_adjustment_value_changed (GtkAdjustment *adjustment,
                ev_view_window_child_move (view, child, child->x + dx, child->y + dy);
        }
        
-       if (view->pending_resize)
+       if (view->pending_resize) {
                gtk_widget_queue_draw (GTK_WIDGET (view));
-       else
-               gdk_window_scroll (view->layout.bin_window, dx, dy);
-               
+       } else {
+               GdkWindow *bin_window;
+
+               bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view));
+               gdk_window_scroll (bin_window, dx, dy);
+       }
+
        gtk_widget_get_pointer (GTK_WIDGET (view), &x, &y);
        ev_view_handle_cursor_over_xy (view, x, y);
 
@@ -4548,7 +4629,9 @@ ev_view_autoscroll_cb (EvView *view)
                speed = pow ((((gdouble)view->scroll_info.last_y - view->scroll_info.start_y) / 100), 3);
        
        value = gtk_adjustment_get_value (view->vadjustment);
-       value = CLAMP (value + speed, 0, view->vadjustment->upper - view->vadjustment->page_size);
+       value = CLAMP (value + speed, 0,
+                      gtk_adjustment_get_upper (view->vadjustment) -
+                      gtk_adjustment_get_page_size (view->vadjustment));
        gtk_adjustment_set_value (view->vadjustment, value);
        
        return TRUE;
@@ -5438,8 +5521,11 @@ merge_selection_region (EvView *view,
 
                /* Redraw the damaged region! */
                if (region) {
+                       GdkWindow   *bin_window;
                        GdkRectangle page_area;
-                       GtkBorder border;
+                       GtkBorder    border;
+
+                       bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view));
 
                        /* I don't know why but the region is smaller
                         * than expected. This hack fixes it, I guess
@@ -5451,7 +5537,7 @@ merge_selection_region (EvView *view,
                        gdk_region_offset (region,
                                           page_area.x + border.left - view->scroll_x,
                                           page_area.y + border.top - view->scroll_y);
-                       gdk_window_invalidate_region (view->layout.bin_window, region, TRUE);
+                       gdk_window_invalidate_region (bin_window, region, TRUE);
                        gdk_region_destroy (region);
                }
        }
@@ -5689,6 +5775,7 @@ ev_view_set_cursor (EvView *view, EvViewCursor new_cursor)
 {
        GdkCursor *cursor = NULL;
        GtkWidget *widget;
+       GdkWindow *bin_window;
 
        if (view->cursor == new_cursor) {
                return;
@@ -5696,9 +5783,10 @@ ev_view_set_cursor (EvView *view, EvViewCursor new_cursor)
 
        view->cursor = new_cursor;
 
+       bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view));
        widget = gtk_widget_get_toplevel (GTK_WIDGET (view));
        cursor = ev_view_cursor_new (gtk_widget_get_display (widget), new_cursor);
-       gdk_window_set_cursor (view->layout.bin_window, cursor);
+       gdk_window_set_cursor (bin_window, cursor);
        gdk_flush ();
        if (cursor)
                gdk_cursor_unref (cursor);