Index: shell/ev-utils.c
===================================================================
--- shell/ev-utils.c	(revision 2581)
+++ shell/ev-utils.c	(working copy)
@@ -369,3 +369,40 @@
 	ev_gui_sanitise_popup_position (menu, widget, x, y);
 }
 
+/**
+ * get_num_monitors
+ * w: optional GtkWindow to look at.
+ * @return Number of monitors, -1 if uncertain situation (like multiple screens)
+ */
+gint 
+get_num_monitors (GtkWindow * w)
+{
+	GdkDisplay * display = gdk_display_get_default();
+	gint num_screen = gdk_display_get_n_screens(display);
+	
+	if(num_screen==1){
+		GdkScreen * screen;
+		if(w){
+			screen = gtk_window_get_screen(w);
+		}else{
+			screen = gdk_display_get_screen(display, 0);
+		}
+		return gdk_screen_get_n_monitors(screen);
+	}else{
+		return -1;
+	}
+}
+
+gdouble
+get_screen_dpi (GtkWindow * window)
+{
+	GdkScreen *screen;
+	gdouble    xdpi, ydpi;
+
+	screen = gtk_window_get_screen (window);
+
+	xdpi = 25.4 * gdk_screen_get_width (screen) / gdk_screen_get_width_mm (screen);
+	ydpi = 25.4 * gdk_screen_get_height (screen) / gdk_screen_get_height_mm (screen);
+	
+	return (xdpi + ydpi) / 2.0;
+}
Index: shell/ev-utils.h
===================================================================
--- shell/ev-utils.h	(revision 2581)
+++ shell/ev-utils.h	(working copy)
@@ -47,6 +47,15 @@
 gboolean		using_pdf_printer (GnomePrintConfig *config);
 #endif
 
+/**
+ * get_num_monitors
+ * w: optional GtkWindow to look at.
+ * @return Number of monitors, -1 if uncertain situation (like multiple screens)
+ */
+gint get_num_monitors (GtkWindow * w);
+
+gdouble get_screen_dpi (GtkWindow * window);
+
 G_END_DECLS
 
 #endif /* __EV_VIEW_H__ */
Index: shell/ev-window.c
===================================================================
--- shell/ev-window.c	(revision 2581)
+++ shell/ev-window.c	(working copy)
@@ -36,6 +36,7 @@
 #include "ev-sidebar-links.h"
 #include "ev-sidebar-attachments.h"
 #include "ev-sidebar-thumbnails.h"
+#include "ev-utils.h"
 #include "ev-view.h"
 #include "ev-password.h"
 #include "ev-password-view.h"
@@ -273,20 +273,6 @@
 
 G_DEFINE_TYPE (EvWindow, ev_window, GTK_TYPE_WINDOW)
 
-static gdouble
-ev_window_get_screen_dpi (EvWindow *ev_window)
-{
-	GdkScreen *screen;
-	gdouble    xdpi, ydpi;
-
-	screen = gtk_window_get_screen (GTK_WINDOW (ev_window));
-
-	xdpi = 25.4 * gdk_screen_get_width (screen) / gdk_screen_get_width_mm (screen);
-	ydpi = 25.4 * gdk_screen_get_height (screen) / gdk_screen_get_height_mm (screen);
-	
-	return (xdpi + ydpi) / 2.0;
-}
-
 static void
 ev_window_set_action_sensitive (EvWindow   *ev_window,
 		    	        const char *name,
@@ -457,7 +443,7 @@
 						      ZOOM_CONTROL_ACTION);
 
 		real_zoom = ev_view_get_zoom (EV_VIEW (ev_window->priv->view));
-		real_zoom *= 72.0 / ev_window_get_screen_dpi (ev_window);
+		real_zoom *= 72.0 / get_screen_dpi (GTK_WINDOW (ev_window));
 		zoom = ephy_zoom_get_nearest_zoom_level (real_zoom);
 
 		ephy_zoom_action_set_zoom_level (EPHY_ZOOM_ACTION (action), zoom);
@@ -987,7 +973,7 @@
 		gdouble zoom_value;
 
 		zoom_value = g_value_get_double (&zoom);
-		zoom_value *= ev_window_get_screen_dpi (window) / 72.0;
+		zoom_value *= get_screen_dpi (GTK_WINDOW (window)) / 72.0;
 		ev_view_set_zoom (view, zoom_value, FALSE);
 		g_value_unset (&zoom);
 	}
@@ -3032,7 +3018,7 @@
 {
 	gboolean presentation;
 
-        g_return_if_fail (EV_IS_WINDOW (window));
+	g_return_if_fail (EV_IS_WINDOW (window));
 	ev_window_stop_fullscreen (window);
 
 	presentation = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
@@ -3106,7 +3108,7 @@
 #endif
 	
 	ev_view_set_screen_dpi (EV_VIEW (window->priv->view),
-				ev_window_get_screen_dpi (window));
+				get_screen_dpi (GTK_WINDOW (window)));
 	
 	if (GTK_WIDGET_CLASS (ev_window_parent_class)->screen_changed) {
 		GTK_WIDGET_CLASS (ev_window_parent_class)->screen_changed (widget, old_screen);
@@ -3504,38 +3506,6 @@
 }
 
 static void
-update_view_size (EvView *view, EvWindow *window)
-{
-	int width, height;
-	GtkRequisition vsb_requisition;
-	GtkRequisition hsb_requisition;
-	int scrollbar_spacing;
-
-	/* Calculate the width available for the */
-	width = window->priv->scrolled_window->allocation.width;
-	height = window->priv->scrolled_window->allocation.height;
-
-	if (gtk_scrolled_window_get_shadow_type (GTK_SCROLLED_WINDOW (window->priv->scrolled_window)) == GTK_SHADOW_IN) {
-		width -= 2 * window->priv->view->style->xthickness;
-		height -= 2 * window->priv->view->style->ythickness;
-	}
-
-	gtk_widget_size_request (GTK_SCROLLED_WINDOW (window->priv->scrolled_window)->vscrollbar,
-				 &vsb_requisition);
-	gtk_widget_size_request (GTK_SCROLLED_WINDOW (window->priv->scrolled_window)->hscrollbar,
-				 &hsb_requisition);
-	gtk_widget_style_get (window->priv->scrolled_window,
-			      "scrollbar_spacing", &scrollbar_spacing,
-			      NULL);
-
-	ev_view_set_zoom_for_size (EV_VIEW (window->priv->view),
-				   MAX (1, width),
-				   MAX (1, height),
-				   vsb_requisition.width + scrollbar_spacing,
-				   hsb_requisition.height + scrollbar_spacing);
-}
-
-static void
 save_sizing_mode (EvWindow *window)
 {
 	EvSizingMode mode;
@@ -3553,19 +3523,19 @@
 ev_window_sizing_mode_changed_cb (EvView *view, GParamSpec *pspec,
 		 		  EvWindow   *ev_window)
 {
-	GtkWidget *scrolled_window;
+	GtkScrolledWindow *scrolled_window;
 	EvSizingMode sizing_mode;
 
 	g_object_get (ev_window->priv->view,
 		      "sizing-mode", &sizing_mode,
 		      NULL);
 
-	scrolled_window = ev_window->priv->scrolled_window;
+	scrolled_window = GTK_SCROLLED_WINDOW (ev_window->priv->scrolled_window);
 
-	g_signal_handlers_disconnect_by_func (ev_window->priv->view, update_view_size, ev_window);
+	g_signal_handlers_disconnect_by_func (ev_window->priv->view, ev_view_update_view_size, scrolled_window);
 
 	if (sizing_mode != EV_SIZING_FREE)
-	    	update_view_size (NULL, ev_window);
+	    	ev_view_update_view_size (NULL, scrolled_window);
 
 	switch (sizing_mode) {
 	        case EV_SIZING_BEST_FIT:
@@ -3574,8 +3544,8 @@
 				      "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
 				      NULL);
 			g_signal_connect (ev_window->priv->view, "zoom_invalid",
-					  G_CALLBACK (update_view_size),
-					  ev_window);
+					  G_CALLBACK (ev_view_update_view_size),
+					  scrolled_window);
 			break;
 	        case EV_SIZING_FIT_WIDTH:
 			g_object_set (G_OBJECT (scrolled_window),
@@ -3583,8 +3553,8 @@
 				      "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
 				      NULL);
 			g_signal_connect (ev_window->priv->view, "zoom_invalid",
-					  G_CALLBACK (update_view_size),
-					  ev_window);
+					  G_CALLBACK (ev_view_update_view_size),
+					  scrolled_window);
 			break;
 	        case EV_SIZING_FREE:
 			g_object_set (G_OBJECT (scrolled_window),
@@ -3607,7 +3577,7 @@
 		gdouble zoom;
 
 		zoom = ev_view_get_zoom (view);
-		zoom *= 72.0 / ev_window_get_screen_dpi (ev_window);
+		zoom *= 72.0 / get_screen_dpi (GTK_WINDOW(ev_window));
 		ev_metadata_manager_set_double (ev_window->priv->uri, "zoom", zoom);
 	}
 }
@@ -4075,7 +4049,7 @@
 	
 	if (mode == EV_SIZING_FREE) {
 		ev_view_set_zoom (EV_VIEW (ev_window->priv->view),
-				  zoom * ev_window_get_screen_dpi (ev_window) / 72.0,
+				  zoom * get_screen_dpi (GTK_WINDOW (ev_window)) / 72.0,
 				  FALSE);
 	}
 }
@@ -5305,7 +5279,7 @@
 
 	ev_window->priv->view = ev_view_new ();
 	ev_view_set_screen_dpi (EV_VIEW (ev_window->priv->view),
-				ev_window_get_screen_dpi (ev_window));
+				get_screen_dpi (GTK_WINDOW (ev_window)));
 	ev_window->priv->password_view = ev_password_view_new ();
 	g_signal_connect_swapped (ev_window->priv->password_view,
 				  "unlock",
Index: shell/ev-view.c
===================================================================
--- shell/ev-view.c	(revision 2581)
+++ shell/ev-view.c	(working copy)
@@ -4692,6 +4692,7 @@
 			   int     vsb_width,
 			   int     hsb_height)
 {
+	g_return_if_fail (EV_IS_VIEW(view));
 	g_return_if_fail (view->sizing_mode == EV_SIZING_FIT_WIDTH ||
 			  view->sizing_mode == EV_SIZING_BEST_FIT);
 	g_return_if_fail (width >= 0);
@@ -5564,3 +5565,36 @@
   }
   return etype;
 }
+
+void
+ev_view_update_view_size (EvView *view, GtkScrolledWindow * scrolled_window)
+{
+	int width, height;
+	GtkRequisition vsb_requisition;
+	GtkRequisition hsb_requisition;
+	int scrollbar_spacing;
+	
+	/* Calculate the width available for the content */ 
+	width  = GTK_WIDGET (scrolled_window)->allocation.width;
+	height = GTK_WIDGET (scrolled_window)->allocation.height;
+
+	if (gtk_scrolled_window_get_shadow_type (scrolled_window) == GTK_SHADOW_IN 
+		&& view
+	) {
+		width -=  2 * GTK_WIDGET(view)->style->xthickness;
+		height -= 2 * GTK_WIDGET(view)->style->ythickness;
+	}
+
+	gtk_widget_size_request (scrolled_window->vscrollbar, &vsb_requisition);
+	gtk_widget_size_request (scrolled_window->hscrollbar, &hsb_requisition);
+	gtk_widget_style_get (GTK_WIDGET (scrolled_window), "scrollbar_spacing", 
+		&scrollbar_spacing, NULL);
+	
+	if (EV_IS_VIEW(view)) {
+		ev_view_set_zoom_for_size (EV_VIEW (view),
+		   MAX (1, width),
+		   MAX (1, height),
+		   vsb_requisition.width + scrollbar_spacing,
+		   hsb_requisition.height + scrollbar_spacing);
+	}
+}
Index: shell/ev-window.h
===================================================================
--- shell/ev-window.h	(revision 2581)
+++ shell/ev-window.h	(working copy)
@@ -25,8 +25,10 @@
 
 #include <glib-object.h>
 #include <gtk/gtkwindow.h>
+#include <gtk/gtkscrolledwindow.h>
 
 #include "ev-link.h"
+#include "ev-view.h"
 #include "ev-page-cache.h"
 
 G_BEGIN_DECLS
@@ -88,4 +93,3 @@
 G_END_DECLS
 
 #endif /* !EV_WINDOW_H */
-
Index: shell/ev-view.h
===================================================================
--- shell/ev-view.h	(revision 2581)
+++ shell/ev-view.h	(working copy)
@@ -22,6 +22,7 @@
 
 #include <gtk/gtkwidget.h>
 #include <gtk/gtklayout.h>
+#include <gtk/gtkscrolledwindow.h>
 
 #include "ev-document.h"
 #include "ev-link.h"
@@ -146,6 +147,8 @@
 gboolean       ev_view_previous_page	  (EvView         *view);
 gchar*         ev_view_page_label_from_dest (EvView *view, EvLinkDest *dest);
 
+void           ev_view_update_view_size (EvView *view, GtkScrolledWindow * scrolled_window);
+
 G_END_DECLS
 
 #endif /* __EV_VIEW_H__ */
