Index: shell/e-shell-window-commands.c
===================================================================
--- shell/e-shell-window-commands.c	(revision 33665)
+++ shell/e-shell-window-commands.c	(working copy)
@@ -44,6 +44,7 @@
 #include "e-util/e-icon-factory.h"
 #include "e-util/e-dialog-utils.h"
 #include "e-util/e-error.h"
+#include "e-util/e-print.h"
 #include "e-util/e-util-private.h"
 
 #include "e-shell-window-commands.h"
@@ -96,6 +97,14 @@ command_import (BonoboUIComponent *uih,
 }
 
 static void
+command_page_setup (BonoboUIComponent *uih,
+		    EShellWindow *window,
+		    const char *path)
+{
+	e_print_run_page_setup_dialog (GTK_WINDOW (window));
+}
+
+static void
 command_close (BonoboUIComponent *uih,
 	       EShellWindow *window,
 	       const char *path)
@@ -717,6 +726,7 @@ command_pilot_settings (BonoboUIComponen
 
 static BonoboUIVerb file_verbs [] = {
 	BONOBO_UI_VERB ("FileImporter", (BonoboUIVerbFn) command_import),
+	BONOBO_UI_VERB ("FilePageSetup", (BonoboUIVerbFn) command_page_setup),
 	BONOBO_UI_VERB ("FileClose", (BonoboUIVerbFn) command_close),
 	BONOBO_UI_VERB ("FileExit", (BonoboUIVerbFn) command_quit),
 
Index: mail/em-format-html-print.c
===================================================================
--- mail/em-format-html-print.c	(revision 33665)
+++ mail/em-format-html-print.c	(working copy)
@@ -112,84 +112,88 @@ em_format_html_print_new (EMFormatHTML *
 	return efhp;
 }
 
-struct footer_info {
-	PangoLayout *layout;
-	gint page_num, pages;
-};
-
-static void
-efhp_footer_cb (GtkHTML *html, GtkPrintContext *context, gdouble x, gdouble y,
-                gdouble width, gdouble height, gpointer data)
+static gint
+efhp_calc_footer_height (GtkHTML *html,
+                         GtkPrintOperation *operation,
+                         GtkPrintContext *context)
 {
-	struct footer_info *info = data;
-	gchar *footer_text;
-	cairo_t *cr;
-
-	footer_text = g_strdup_printf (_("Page %d of %d"),
-		info->page_num++, info->pages);
+	PangoContext *pango_context;
+	PangoFontDescription *desc;
+	PangoFontMetrics *metrics;
+	gint footer_height;
 
-	pango_layout_set_text (info->layout, footer_text, -1);
-	pango_layout_set_width (info->layout, pango_units_from_double (width));
+	pango_context = gtk_print_context_create_pango_context (context);
+	desc = pango_font_description_from_string ("Sans Regular 10");
 
-	cr = gtk_print_context_get_cairo_context (context);
+	metrics = pango_context_get_metrics (
+		pango_context, desc, pango_language_get_default ());
+	footer_height =
+		pango_font_metrics_get_ascent (metrics) +
+		pango_font_metrics_get_descent (metrics);
+	pango_font_metrics_unref (metrics);
 
-	cairo_save (cr);
-	cairo_set_source_rgb (cr, .0, .0, .0);
-	cairo_move_to (cr, x, y);
-	pango_cairo_show_layout (cr, info->layout);
-	cairo_restore (cr);
+	pango_font_description_free (desc);
+	g_object_unref (pango_context);
 
-	g_free (footer_text);
+	return footer_height;
 }
 
-static void 
-mail_draw_page (GtkPrintOperation *print, GtkPrintContext *context,
-                gint page_nr, EMFormatHTMLPrint *efhp)
+static void
+efhp_draw_footer (GtkHTML *html,
+                  GtkPrintOperation *operation,
+                  GtkPrintContext *context,
+                  gint page_nr,
+                  PangoRectangle *rec)
 {
-	GtkHTML *html = efhp->parent.html;
 	PangoFontDescription *desc;
-	PangoFontMetrics *metrics;
-	struct footer_info info;
-	gdouble footer_height;
+	PangoLayout *layout;
+	gdouble x, y;
+	gint n_pages;
+	gchar *text;
+	cairo_t *cr;
+
+	g_object_get (operation, "n-pages", &n_pages, NULL);
+	text = g_strdup_printf (_("Page %d of %d"), page_nr + 1, n_pages);
 
 	desc = pango_font_description_from_string ("Sans Regular 10");
+	layout = gtk_print_context_create_pango_layout (context);
+	pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
+	pango_layout_set_font_description (layout, desc);
+	pango_layout_set_text (layout, text, -1);
+	pango_layout_set_width (layout, rec->width);
 
-	info.layout = gtk_print_context_create_pango_layout (context);
-	pango_layout_set_alignment (info.layout, PANGO_ALIGN_CENTER);
-	pango_layout_set_font_description (info.layout, desc);
+	x = pango_units_to_double (rec->x);
+	y = pango_units_to_double (rec->y);
 
-	metrics = pango_context_get_metrics (
-		pango_layout_get_context (info.layout),
-		desc, pango_language_get_default ());
-	footer_height = pango_units_to_double (
-		pango_font_metrics_get_ascent (metrics) +
-		pango_font_metrics_get_descent (metrics));
-	pango_font_metrics_unref (metrics);
+	cr = gtk_print_context_get_cairo_context (context);
+
+	cairo_save (cr);
+	cairo_set_source_rgb (cr, .0, .0, .0);
+	cairo_move_to (cr, x, y);
+	pango_cairo_show_layout (cr, layout);
+	cairo_restore (cr);
 
+	g_object_unref (layout);
 	pango_font_description_free (desc);
 
-	info.page_num = 1;
-	info.pages = gtk_html_print_page_get_pages_num (
-		html, context, 0.0, footer_height);
-
-	gtk_html_print_page_with_header_footer (
-		html, context, 0.0, footer_height,
-		NULL, efhp_footer_cb, &info);
+	g_free (text);
 }
 
 static void
 emfhp_complete (EMFormatHTMLPrint *efhp)
 {
 	GtkPrintOperation *operation;
+	GError *error = NULL;
 
 	operation = e_print_operation_new ();
-	gtk_print_operation_set_n_pages (operation, 1); 
-
-	g_signal_connect (
-		operation, "draw-page",
-		G_CALLBACK (mail_draw_page), efhp);
 
-	gtk_print_operation_run (operation, efhp->action, NULL, NULL); 
+	gtk_html_print_operation_run (
+		efhp->parent.html, operation, efhp->action, NULL,
+		(GtkHTMLPrintCalcHeight) NULL,
+		(GtkHTMLPrintCalcHeight) efhp_calc_footer_height,
+		(GtkHTMLPrintDrawFunc) NULL,
+		(GtkHTMLPrintDrawFunc) efhp_draw_footer,
+		NULL, &error);
 
 	g_object_unref (operation);
 }
Index: e-util/e-print.c
===================================================================
--- e-util/e-print.c	(revision 33665)
+++ e-util/e-print.c	(working copy)
@@ -43,7 +43,7 @@ unpack_settings (gchar *item, GtkPrintSe
 	gchar *cp, *key, *value;
 	cp = strchr (item, '=');
 	if (cp == NULL)
-		return;	
+		return;
 	*cp ++ = '\0';
 	key = g_strstrip (item);
 	value = g_strstrip (cp);
@@ -78,15 +78,12 @@ load_settings (void)
 }
 
 static void
-save_settings (GtkPrintOperation *operation)
+save_settings (GtkPrintSettings *settings)
 {
-	GtkPrintSettings *settings;
 	GConfClient *client;
 	GSList *list = NULL;
 	GError *error = NULL;
 	
-	settings = gtk_print_operation_get_print_settings (operation);
-
 	client = gconf_client_get_default ();
 	
 	gtk_print_settings_foreach (
@@ -103,6 +100,30 @@ save_settings (GtkPrintOperation *operat
 	g_object_unref (client);
 }
 
+static GtkPageSetup *
+load_page_setup (GtkPrintSettings *settings)
+{
+	GtkPageSetup *page_setup;
+	GtkPaperSize *paper_size;
+
+	page_setup = gtk_page_setup_new ();
+	gtk_page_setup_set_orientation (
+		page_setup, gtk_print_settings_get_orientation (settings));
+	paper_size = gtk_print_settings_get_paper_size (settings);
+	if (paper_size != NULL)
+		gtk_page_setup_set_paper_size_and_default_margins (
+			page_setup, paper_size);
+}
+
+static void
+save_page_setup (GtkPrintSettings *settings, GtkPageSetup *page_setup)
+{
+	gtk_print_settings_set_orientation (
+		settings, gtk_page_setup_get_orientation (page_setup));
+	gtk_print_settings_set_paper_size (
+		settings, gtk_page_setup_get_paper_size (page_setup));
+}
+
 static void
 handle_error (GtkPrintOperation *operation)
 {
@@ -139,8 +160,12 @@ handle_error (GtkPrintOperation *operati
 static void
 print_done_cb (GtkPrintOperation *operation, GtkPrintOperationResult result)
 {
+	GtkPrintSettings *settings;
+
+	settings = gtk_print_operation_get_print_settings (operation);
+
 	if (result == GTK_PRINT_OPERATION_RESULT_APPLY)
-		save_settings (operation);
+		save_settings (settings);
 	if (result == GTK_PRINT_OPERATION_RESULT_ERROR)
 		handle_error (operation);
 }
@@ -161,3 +186,22 @@ e_print_operation_new (void)
 
 	return operation;
 }
+
+void
+e_print_run_page_setup_dialog (GtkWindow *parent)
+{
+	GtkPageSetup *new_page_setup;
+	GtkPageSetup *old_page_setup;
+	GtkPrintSettings *settings;
+
+	settings = load_settings ();
+	old_page_setup = load_page_setup (settings);
+	new_page_setup = gtk_print_run_page_setup_dialog (
+		parent, old_page_setup, settings);
+	save_page_setup (settings, new_page_setup);
+	save_settings (settings);
+
+	g_object_unref (new_page_setup);
+	g_object_unref (old_page_setup);
+	g_object_unref (settings);
+}
Index: e-util/e-print.h
===================================================================
--- e-util/e-print.h	(revision 33665)
+++ e-util/e-print.h	(working copy)
@@ -27,6 +27,7 @@
 G_BEGIN_DECLS
 
 GtkPrintOperation *	e_print_operation_new		(void);
+void			e_print_run_page_setup_dialog	(GtkWindow *parent);
 
 G_END_DECLS
 
Index: ui/evolution.xml
===================================================================
--- ui/evolution.xml	(revision 33665)
+++ ui/evolution.xml	(working copy)
@@ -4,6 +4,8 @@
       _tip="Create a new window displaying this folder"
       accel="*Control**Shift*w"/>
 
+    <cmd name="FilePageSetup" _label="Page Set_up..." _tip="Set up the page settings for your current printer"/>
+
     <cmd name="FileClose" _label="_Close Window" _tip="Close this window"
       pixtype="stock" pixname="gtk-close" accel="*Control*w"/>
 
@@ -76,7 +78,9 @@
 	_tip="Import data from other programs"
 	pixtype="pixbuf"/>
 
-      <placeholder name="Print" delimit="top"/>
+      <placeholder name="Print" delimit="top">
+        <menuitem name="FilePageSetup" verb=""/>
+      </placeholder>
 
 <!--
       <placeholder name="ComponentPlaceholder"/>
