Index: plug-ins/print/print-page-layout.c
===================================================================
--- plug-ins/print/print-page-layout.c	(revision 24663)
+++ plug-ins/print/print-page-layout.c	(working copy)
@@ -58,9 +58,6 @@
 };
 
 
-static void        run_page_setup_dialog              (GtkWidget     *widget,
-                                                       PrintData     *data);
-
 static GtkWidget * print_size_frame                   (PrintData     *data,
                                                        GtkSizeGroup *label_group,
                                                        GtkSizeGroup *entry_group);
@@ -116,11 +113,6 @@
   info.image_height = gimp_drawable_height (data->drawable_id);
 
   setup = gtk_print_operation_get_default_page_setup (data->operation);
-  if (! setup)
-    {
-      setup = gtk_page_setup_new ();
-      gtk_print_operation_set_default_page_setup (data->operation, setup);
-    }
 
   layout = gtk_vbox_new (FALSE, 6);
   gtk_container_set_border_width (GTK_CONTAINER (layout), 12);
@@ -145,14 +137,6 @@
   gtk_box_pack_start (GTK_BOX (hbox), info.area_label, TRUE, TRUE, 0);
   gtk_widget_show (info.area_label);
 
-  button = gtk_button_new_with_mnemonic (_("_Adjust Page Size "
-                                           "and Orientation"));
-  gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-  g_signal_connect (G_OBJECT (button), "clicked",
-                    G_CALLBACK (run_page_setup_dialog),
-                    data);
-  gtk_widget_show (button);
-
   /*  main hbox  */
   main_hbox = gtk_hbox_new (FALSE, 12);
   gtk_box_pack_start (GTK_BOX (layout), main_hbox, TRUE, TRUE, 0);
@@ -224,37 +208,6 @@
   return layout;
 }
 
-static void
-run_page_setup_dialog (GtkWidget *widget,
-                       PrintData *data)
-{
-  GtkPrintOperation *operation = data->operation;
-  GtkPrintSettings  *settings;
-  GtkPageSetup      *page_setup;
-  GtkWidget         *toplevel;
-
-  /* find a transient parent if possible */
-  toplevel = gtk_widget_get_toplevel (widget);
-  if (! GTK_WIDGET_TOPLEVEL (toplevel))
-    toplevel = NULL;
-
-  settings = gtk_print_operation_get_print_settings (operation);
-  if (! settings)
-    settings = gtk_print_settings_new ();
-
-  page_setup = gtk_print_operation_get_default_page_setup (operation);
-
-  page_setup = gtk_print_run_page_setup_dialog (GTK_WINDOW (toplevel),
-                                                page_setup, settings);
-
-  gtk_print_operation_set_default_page_setup (operation, page_setup);
-
-  gimp_print_preview_set_page_setup (GIMP_PRINT_PREVIEW (info.preview),
-                                     page_setup);
-
-  print_size_info_set_page_setup (&info);
-}
-
 #define SB_WIDTH 8
 
 
Index: plug-ins/print/print-settings.c
===================================================================
--- plug-ins/print/print-settings.c	(revision 24663)
+++ plug-ins/print/print-settings.c	(working copy)
@@ -17,7 +17,7 @@
  */
 
 #define PRINT_SETTINGS_MAJOR_VERSION 0
-#define PRINT_SETTINGS_MINOR_VERSION 3
+#define PRINT_SETTINGS_MINOR_VERSION 4
 
 #include "config.h"
 
@@ -117,7 +117,6 @@
   GtkPrintOperation *operation = data->operation;
   GtkPrintSettings  *settings;
   GKeyFile          *key_file  = g_key_file_new ();
-  GtkPageSetup      *page_setup;
 
   g_key_file_set_list_separator (key_file, '=');
 
@@ -135,53 +134,6 @@
                                   key_file);
     }
 
-  /* page setup */
-  page_setup = gtk_print_operation_get_default_page_setup (operation);
-  if (page_setup)
-    {
-      GtkPaperSize       *paper_size;
-      GtkPageOrientation  orientation;
-      const gchar        *name;
-
-      orientation = gtk_page_setup_get_orientation (page_setup);
-      g_key_file_set_integer (key_file, "page-setup", "orientation",
-                              orientation);
-
-      paper_size = gtk_page_setup_get_paper_size (page_setup);
-
-      name = gtk_paper_size_get_name (paper_size);
-      if (name)
-        {
-          g_key_file_set_string (key_file, "paper-size", "name", name);
-
-          name = gtk_paper_size_get_ppd_name (paper_size);
-
-          if (name)
-            {
-              g_key_file_set_string (key_file, "paper-size", "ppd-name",
-                                     name);
-            }
-
-          if (name || gtk_paper_size_is_custom (paper_size))
-            {
-              g_key_file_set_string (key_file, "paper-size", "display-name",
-                                     gtk_paper_size_get_display_name (paper_size));
-              g_key_file_set_double (key_file, "paper-size", "width",
-                                     gtk_paper_size_get_width (paper_size,
-                                                               GTK_UNIT_POINTS));
-              g_key_file_set_double (key_file, "paper-size", "height",
-                                     gtk_paper_size_get_height (paper_size,
-                                                                GTK_UNIT_POINTS));
-            }
-        }
-    }
-
-#if 0
-  /* other settings */
-  g_key_file_set_boolean (key_file, "other-settings", "show-header",
-                          data->show_info_header);
-#endif
-
   return key_file;
 }
 
@@ -314,47 +266,12 @@
   return check_version (key_file);
 }
 
-static GtkPaperSize *
-load_paper_size_from_key_file (GKeyFile *key_file)
-{
-  const gchar *name;
-  const gchar *ppd_name;
-  const gchar *display_name;
-  gdouble      width;
-  gdouble      height;
-
-  name         = g_key_file_get_string (key_file, "paper-size", "name",
-                                        NULL);
-  ppd_name     = g_key_file_get_string (key_file, "paper-size", "ppd-name",
-                                        NULL);
-  display_name = g_key_file_get_string (key_file, "paper-size", "display-name",
-                                        NULL);
-  width        = g_key_file_get_double (key_file, "paper-size", "width",  NULL);
-  height       = g_key_file_get_double (key_file, "paper-size", "height", NULL);
-
-  if (ppd_name && display_name)
-    {
-      return gtk_paper_size_new_from_ppd (ppd_name,
-                                          display_name, width, height);
-    }
-
-  if (name && display_name)
-    {
-      return gtk_paper_size_new_custom (name,
-                                        display_name, width, height,
-                                        GTK_UNIT_POINTS);
-    }
-
-  return gtk_paper_size_new (name);
-}
-
 static gboolean
 load_print_settings_from_key_file (PrintData *data,
                                    GKeyFile  *key_file)
 {
   GtkPrintOperation  *operation = data->operation;
   GtkPrintSettings   *settings;
-  GtkPageSetup       *page_setup;
   gchar             **keys;
   gsize               n_keys;
   gint                i;
@@ -383,34 +300,6 @@
 
   g_strfreev (keys);
 
-  /* page setup parameters */
-
-  page_setup = gtk_print_operation_get_default_page_setup (operation);
-  if (! page_setup)
-    page_setup = gtk_page_setup_new ();
-
-  if (g_key_file_has_key (key_file, "paper-size", "name", NULL))
-    {
-      GtkPaperSize *paper_size = load_paper_size_from_key_file (key_file);
-
-      gtk_page_setup_set_paper_size_and_default_margins (page_setup,
-                                                         paper_size);
-    }
-
-  if (g_key_file_has_key (key_file, "page-setup", "orientation", NULL))
-    {
-      GtkPageOrientation  orientation;
-
-      orientation = g_key_file_get_integer (key_file,
-                                            "page-setup", "orientation", NULL);
-      gtk_page_setup_set_orientation (page_setup, orientation);
-      gtk_print_settings_set_orientation (settings, orientation);
-      data->orientation = orientation;
-    }
-
-  gtk_print_operation_set_default_page_setup (operation, page_setup);
-  g_object_unref (page_setup);
-
   if (g_key_file_has_key (key_file, "image-setup", "unit", NULL))
     {
       data->unit = g_key_file_get_integer (key_file,
@@ -447,20 +336,6 @@
                                                     "image-setup", "use-full-page", NULL);
     }
 
-#if 0
-  /* other settings */
-  if (g_key_file_has_key (key_file, "other-settings", "show-header", NULL))
-    {
-      data->show_info_header = g_key_file_get_boolean (key_file,
-                                                       "other-settings",
-                                                       "show-header", NULL);
-    }
-  else
-#endif
-    {
-      data->show_info_header = FALSE;
-    }
-
   gtk_print_operation_set_print_settings (operation, settings);
 
   return TRUE;
Index: plug-ins/print/print.c
===================================================================
--- plug-ins/print/print.c	(revision 24663)
+++ plug-ins/print/print.c	(working copy)
@@ -31,8 +31,9 @@
 #include "libgimp/stdplugins-intl.h"
 
 
-#define PRINT_PROC_NAME  "file-print-gtk"
-#define PLUG_IN_BINARY   "print"
+#define PRINT_PROC_NAME       "file-print-gtk"
+#define PAGE_SETUP_PROC_NAME  "file-print-page-setup"
+#define PLUG_IN_BINARY        "print"
 
 
 static void        query (void);
@@ -64,8 +65,12 @@
 static GtkWidget * create_custom_widget     (GtkPrintOperation *operation,
                                              PrintData         *data);
 
+static void        run_page_setup_dialog    (void);
 
+static void        load_page_setup          (GtkPrintOperation *operation);
 
+static void        save_page_setup          (GtkPrintOperation *operation);
+
 const GimpPlugInInfo PLUG_IN_INFO =
 {
   NULL,  /* init_proc  */
@@ -85,6 +90,12 @@
     { GIMP_PDB_IMAGE,    "image",    "Image to print"               }
   };
 
+  static const GimpParamDef page_setup_args[] =
+  {
+    { GIMP_PDB_INT32,    "run-mode", "Interactive, non-interactive" },
+    { GIMP_PDB_IMAGE,    "image",    "Image to print"               }
+  };
+
   gimp_install_procedure (PRINT_PROC_NAME,
                           N_("Print the image"),
                           "Print the image using the GTK+ Print API.",
@@ -97,9 +108,24 @@
                           G_N_ELEMENTS (print_args), 0,
                           print_args, NULL);
 
+  gimp_install_procedure (PAGE_SETUP_PROC_NAME,
+                          N_("Setup page for printing"),
+                          "Set page parameters for printing using the GTK+ Print API.",
+                          "Bill Skaggs, Sven Neumann, Stefan Röllin",
+                          "Bill Skaggs  <weskaggs@primate.ucdavis.edu>",
+                          "2008",
+                          N_("_Page Setup..."),
+                          "",
+                          GIMP_PLUGIN,
+                          G_N_ELEMENTS (page_setup_args), 0,
+                          page_setup_args, NULL);
+
   gimp_plugin_menu_register (PRINT_PROC_NAME, "<Image>/File/Send");
   gimp_plugin_icon_register (PRINT_PROC_NAME, GIMP_ICON_TYPE_STOCK_ID,
                              (const guint8 *) GTK_STOCK_PRINT);
+  gimp_plugin_menu_register (PAGE_SETUP_PROC_NAME, "<Image>/File/Send");
+  gimp_plugin_icon_register (PAGE_SETUP_PROC_NAME, GIMP_ICON_TYPE_STOCK_ID,
+                             (const guint8 *) GTK_STOCK_PRINT);
 
 }
 
@@ -140,6 +166,19 @@
           status = GIMP_PDB_EXECUTION_ERROR;
         }
     }
+  else if (strcmp (name, PAGE_SETUP_PROC_NAME) == 0)
+    {
+      if (run_mode != GIMP_RUN_INTERACTIVE)
+        {
+          status = GIMP_PDB_EXECUTION_ERROR;
+        }
+      else
+        {
+          gimp_ui_init (PLUG_IN_BINARY, FALSE);
+
+          run_page_setup_dialog ();
+        }
+    }
   else
     {
       status = GIMP_PDB_CALLING_ERROR;
@@ -169,6 +208,8 @@
 
   operation = gtk_print_operation_new ();
 
+  load_page_setup (operation);
+
   print_operation_set_name (operation, orig_image_ID);
 
   /* fill in the PrintData struct */
@@ -320,3 +361,64 @@
 {
   return print_page_layout_gui (data);
 }
+
+static void
+run_page_setup_dialog (void)
+{
+  GtkPageSetup      *page_setup;
+  GtkPageSetup      *new_page_setup;
+  GtkPrintOperation *operation          = gtk_print_operation_new ();
+  GtkPrintSettings  *print_settings     = gtk_print_settings_new ();
+
+  load_page_setup (operation);
+  page_setup = gtk_print_operation_get_default_page_setup (operation);
+
+  new_page_setup = gtk_print_run_page_setup_dialog (NULL,
+                                                    page_setup,
+                                                    print_settings);
+
+  gtk_print_operation_set_default_page_setup (operation, new_page_setup);
+
+  save_page_setup (operation);
+}
+
+
+static void
+load_page_setup (GtkPrintOperation *operation)
+{
+  GtkPageSetup *page_setup;
+  gchar        *filename;
+  GError       *error      = NULL;
+
+  filename = g_build_filename (gimp_directory (), "print-page-setup", NULL);
+
+  page_setup = gtk_page_setup_new_from_file (filename, &error);
+
+  if (! page_setup)
+    page_setup = gtk_page_setup_new ();
+
+  gtk_print_operation_set_default_page_setup (operation, page_setup);
+}
+
+static void
+save_page_setup (GtkPrintOperation *operation)
+{
+  GtkPageSetup *page_setup;
+  gchar        *filename;
+  GError       *error       = NULL;
+
+  page_setup = gtk_print_operation_get_default_page_setup (operation);
+
+  filename = g_build_filename (gimp_directory (), "print-page-setup", NULL);
+
+  gtk_page_setup_to_file (page_setup, filename, &error);
+  if (error)
+    {
+      g_message ("Error saving page setup as resource file: %s",
+                 error->message);
+      g_error_free (error);
+      return;
+    }
+
+  g_free (filename);
+}
