]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkprintunixdialog.c
always set hide_tooltip to TRUE if we are handling a leave notify event.
[~andy/gtk] / gtk / gtkprintunixdialog.c
index f933da7f1a8713c6deee3a9e0bd7a99455be544e..66b65c8bdb00f50e099234a02379aa7a68c6fdb2 100644 (file)
@@ -21,6 +21,7 @@
 #include "config.h"
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 #include <stdio.h>
 #include <math.h>
 
 #include "gtkframe.h"
 #include "gtkalignment.h"
 #include "gtklabel.h"
+#include "gtkeventbox.h"
 
 #include "gtkprintbackend.h"
+#include "gtkprinter-private.h"
 #include "gtkprintunixdialog.h"
 #include "gtkprinteroptionwidget.h"
 #include "gtkalias.h"
 #define GTK_PRINT_UNIX_DIALOG_GET_PRIVATE(o)  \
    (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_PRINT_UNIX_DIALOG, GtkPrintUnixDialogPrivate))
 
-static void gtk_print_unix_dialog_destroy      (GtkPrintUnixDialog *dialog);
-static void gtk_print_unix_dialog_finalize     (GObject            *object);
-static GObject* gtk_print_unix_dialog_constructor (GType               type,
-                                                  guint               n_construct_properties,
-                                                  GObjectConstructParam *construct_params);
-static void gtk_print_unix_dialog_set_property (GObject            *object,
-                                               guint               prop_id,
-                                               const GValue       *value,
-                                               GParamSpec         *pspec);
-static void gtk_print_unix_dialog_get_property (GObject            *object,
-                                               guint               prop_id,
-                                               GValue             *value,
-                                               GParamSpec         *pspec);
-static void gtk_print_unix_dialog_style_set    (GtkWidget          *widget,
-                                               GtkStyle           *previous_style);
-static void populate_dialog                    (GtkPrintUnixDialog *dialog);
-static void unschedule_idle_mark_conflicts     (GtkPrintUnixDialog *dialog);
-static void selected_printer_changed           (GtkTreeSelection   *selection,
-                                               GtkPrintUnixDialog *dialog);
-static void clear_per_printer_ui               (GtkPrintUnixDialog *dialog);
-static void printer_added_cb                   (GtkPrintBackend    *backend,
-                                               GtkPrinter         *printer,
-                                               GtkPrintUnixDialog *dialog);
-static void printer_removed_cb                 (GtkPrintBackend    *backend,
-                                               GtkPrinter         *printer,
-                                               GtkPrintUnixDialog *dialog);
-static void printer_status_cb                  (GtkPrintBackend    *backend,
-                                               GtkPrinter         *printer,
-                                               GtkPrintUnixDialog *dialog);
+static void     gtk_print_unix_dialog_destroy      (GtkPrintUnixDialog *dialog);
+static void     gtk_print_unix_dialog_finalize     (GObject            *object);
+static void     gtk_print_unix_dialog_set_property (GObject            *object,
+                                                   guint               prop_id,
+                                                   const GValue       *value,
+                                                   GParamSpec         *pspec);
+static void     gtk_print_unix_dialog_get_property (GObject            *object,
+                                                   guint               prop_id,
+                                                   GValue             *value,
+                                                   GParamSpec         *pspec);
+static void     gtk_print_unix_dialog_style_set    (GtkWidget          *widget,
+                                                   GtkStyle           *previous_style);
+static void     populate_dialog                    (GtkPrintUnixDialog *dialog);
+static void     unschedule_idle_mark_conflicts     (GtkPrintUnixDialog *dialog);
+static void     selected_printer_changed           (GtkTreeSelection   *selection,
+                                                   GtkPrintUnixDialog *dialog);
+static void     clear_per_printer_ui               (GtkPrintUnixDialog *dialog);
+static void     printer_added_cb                   (GtkPrintBackend    *backend,
+                                                   GtkPrinter         *printer,
+                                                   GtkPrintUnixDialog *dialog);
+static void     printer_removed_cb                 (GtkPrintBackend    *backend,
+                                                   GtkPrinter         *printer,
+                                                   GtkPrintUnixDialog *dialog);
+static void     printer_status_cb                  (GtkPrintBackend    *backend,
+                                                   GtkPrinter         *printer,
+                                                   GtkPrintUnixDialog *dialog);
+static void     update_collate_icon                (GtkToggleButton    *toggle_button,
+                                                   GtkPrintUnixDialog *dialog);
+static gboolean dialog_get_collate                 (GtkPrintUnixDialog *dialog);
+static gboolean dialog_get_reverse                 (GtkPrintUnixDialog *dialog);
+static gint     dialog_get_n_copies                (GtkPrintUnixDialog *dialog);
 
 enum {
   PROP_0,
@@ -104,13 +109,14 @@ enum {
   PRINTER_LIST_N_COLS
 };
 
-#define _EXTENTION_POINT_MAIN_PAGE_CUSTOM_INPUT "gtk-main-page-custom-input"
-
 struct GtkPrintUnixDialogPrivate
 {
   GtkWidget *notebook;
 
   GtkWidget *printer_treeview;
+
+  GtkPrintCapabilities manual_capabilities;
+  GtkPrintCapabilities printer_capabilities;
   
   GtkTreeModel *printer_list;
   GtkTreeModelFilter *printer_list_filter;
@@ -133,6 +139,7 @@ struct GtkPrintUnixDialogPrivate
   GtkWidget *print_at_radio;
   GtkWidget *print_at_entry;
   GtkWidget *print_hold_radio;
+  GtkWidget *preview_button;
   gboolean updating_print_at;
   GtkPrinterOptionWidget *pages_per_sheet;
   GtkPrinterOptionWidget *duplex;
@@ -157,17 +164,19 @@ struct GtkPrintUnixDialogPrivate
   GtkWidget *advanced_vbox;
   GtkWidget *advanced_page;
 
-  GHashTable *extension_points;  
+  GtkWidget *extension_point;
 
-  /* These are set initially on selected printer (either default printer, printer
-   * taken from set settings, or user-selected), but when any setting is changed
-   * by the user it is cleared */
+  /* These are set initially on selected printer (either default printer, 
+   * printer taken from set settings, or user-selected), but when any setting 
+   * is changed by the user it is cleared.
+   */
   GtkPrintSettings *initial_settings;
   
   /* This is the initial printer set by set_settings. We look for it in the
    * added printers. We clear this whenever the user manually changes
    * to another printer, when the user changes a setting or when we find
-   * this printer */
+   * this printer.
+   */
   char *waiting_for_printer;
   gboolean internal_printer_change;
   
@@ -179,16 +188,16 @@ struct GtkPrintUnixDialogPrivate
   gulong options_changed_handler;
   gulong mark_conflicts_id;
 
-  char *format_for_printer;
+  gchar *format_for_printer;
   
   gint current_page;
 };
 
-G_DEFINE_TYPE (GtkPrintUnixDialog, gtk_print_unix_dialog, GTK_TYPE_DIALOG);
+G_DEFINE_TYPE (GtkPrintUnixDialog, gtk_print_unix_dialog, GTK_TYPE_DIALOG)
 
 static gboolean
 is_default_printer (GtkPrintUnixDialog *dialog,
-                   GtkPrinter *printer)
+                   GtkPrinter         *printer)
 {
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
 
@@ -209,7 +218,6 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class)
   widget_class = (GtkWidgetClass *) class;
 
   object_class->finalize = gtk_print_unix_dialog_finalize;
-  object_class->constructor = gtk_print_unix_dialog_constructor;
   object_class->set_property = gtk_print_unix_dialog_set_property;
   object_class->get_property = gtk_print_unix_dialog_get_property;
 
@@ -262,9 +270,6 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog)
   priv->print_backends = NULL;
   priv->current_page = -1;
 
-  priv->extension_points = g_hash_table_new (g_str_hash,
-                                             g_str_equal);
-
   priv->page_setup = gtk_page_setup_new ();
 
   g_signal_connect (dialog, 
@@ -272,38 +277,23 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog)
                    (GCallback) gtk_print_unix_dialog_destroy, 
                    NULL);
 
-  gtk_dialog_add_buttons (GTK_DIALOG (dialog), 
+  priv->preview_button = gtk_button_new_from_stock (GTK_STOCK_PRINT_PREVIEW);
+  gtk_widget_show (priv->preview_button);
+   
+  gtk_dialog_add_action_widget (GTK_DIALOG (dialog), 
+                                priv->preview_button, 
+                                GTK_RESPONSE_APPLY);
+  gtk_dialog_add_buttons (GTK_DIALOG (dialog),
                          GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                          GTK_STOCK_PRINT, GTK_RESPONSE_OK,
                           NULL);
 
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
   gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE);
-}
-
-static GObject *
-gtk_print_unix_dialog_constructor (GType               type,
-                                  guint               n_construct_properties,
-                                  GObjectConstructParam *construct_params)
-{
-  GtkPrintUnixDialog *dialog;
-  GObject *object;
-
-  object =
-    G_OBJECT_CLASS (gtk_print_unix_dialog_parent_class)->constructor (type,
-                                                                     n_construct_properties,
-                                                                     construct_params);
 
-  /* We need to populate the dialog after the transient-to has been set.
-   * See bug #340401.
-   */
-  dialog = GTK_PRINT_UNIX_DIALOG (object);
-  populate_dialog (dialog);
-
-  return object;
+  populate_dialog (dialog);  
 }
 
-
 static void
 gtk_print_unix_dialog_destroy (GtkPrintUnixDialog *dialog)
 {
@@ -352,13 +342,7 @@ gtk_print_unix_dialog_finalize (GObject *object)
       priv->options = NULL;
     }
  
-  if (priv->extension_points)
-    {
-      g_hash_table_unref (priv->extension_points);
-      priv->extension_points = NULL;
-    }
-  if (priv->page_setup)
+ if (priv->page_setup)
     {
       g_object_unref (priv->page_setup);
       priv->page_setup = NULL;
@@ -433,6 +417,7 @@ printer_added_cb (GtkPrintBackend    *backend,
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
   GtkTreeIter iter, filter_iter;
   GtkTreeSelection *selection;
+  GtkTreePath *path;
 
   gtk_list_store_append (GTK_LIST_STORE (priv->printer_list), &iter);
   
@@ -452,7 +437,8 @@ printer_added_cb (GtkPrintBackend    *backend,
 
   gtk_tree_model_filter_convert_child_iter_to_iter (priv->printer_list_filter,
                                                    &filter_iter, &iter);
-  
+  path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->printer_list_filter), &filter_iter);
+
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->printer_treeview));
   
   if (priv->waiting_for_printer != NULL &&
@@ -461,6 +447,8 @@ printer_added_cb (GtkPrintBackend    *backend,
     {
       priv->internal_printer_change = TRUE;
       gtk_tree_selection_select_iter (selection, &filter_iter);
+      gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (priv->printer_treeview),
+                                    path, NULL, TRUE, 0.5, 0.0);
       priv->internal_printer_change = FALSE;
       g_free (priv->waiting_for_printer);
       priv->waiting_for_printer = NULL;
@@ -470,8 +458,12 @@ printer_added_cb (GtkPrintBackend    *backend,
     {
       priv->internal_printer_change = TRUE;
       gtk_tree_selection_select_iter (selection, &filter_iter);
+      gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (priv->printer_treeview),
+                                    path, NULL, TRUE, 0.5, 0.0);
       priv->internal_printer_change = FALSE;
     }
+
+  gtk_tree_path_free (path);
 }
 
 static void
@@ -585,6 +577,7 @@ is_printer_active (GtkTreeModel       *model,
 {
   gboolean result;
   GtkPrinter *printer;
+  GtkPrintUnixDialogPrivate *priv = dialog->priv;
 
   gtk_tree_model_get (model,
                      iter,
@@ -596,9 +589,22 @@ is_printer_active (GtkTreeModel       *model,
     return FALSE;
 
   result = gtk_printer_is_active (printer);
-
+  
+  if (result && 
+      priv->manual_capabilities & (GTK_PRINT_CAPABILITY_GENERATE_PDF |
+                                  GTK_PRINT_CAPABILITY_GENERATE_PS))
+    {
+       /* Check that the printer can handle at least one of the data 
+       * formats that the application supports.
+        */
+       result = ((priv->manual_capabilities & GTK_PRINT_CAPABILITY_GENERATE_PDF) &&
+                gtk_printer_accepts_pdf (printer)) ||
+               ((priv->manual_capabilities & GTK_PRINT_CAPABILITY_GENERATE_PS) &&
+                gtk_printer_accepts_ps (printer));
+    }
+  
   g_object_unref (printer);
-
+  
   return result;
 }
 
@@ -695,7 +701,7 @@ wrap_in_frame (const gchar *label,
                GtkWidget   *child)
 {
   GtkWidget *frame, *alignment, *label_widget;
-  char *bold_text;
+  gchar *bold_text;
 
   label_widget = gtk_label_new ("");
   gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
@@ -737,40 +743,32 @@ setup_option (GtkPrintUnixDialog     *dialog,
 
 static void
 add_option_to_extension_point (GtkPrinterOption *option,
-                              gpointer          user_data)
+                              gpointer          data)
 {
-  GHashTable *extension_points = (GHashTable *) user_data;
-  GtkWidget *widget, *extension_hbox;
-
-  extension_hbox = g_hash_table_lookup (extension_points, option->name);
+  GtkWidget *extension_point = data;
+  GtkWidget *widget;
 
-  if (extension_hbox)
-    {
-
-      widget = gtk_printer_option_widget_new (option);
-      gtk_widget_show (widget);
+  widget = gtk_printer_option_widget_new (option);
+  gtk_widget_show (widget);
    
-      if (gtk_printer_option_widget_has_external_label (GTK_PRINTER_OPTION_WIDGET (widget)))
-        {
-          GtkWidget *label, *hbox;
-
-          label = gtk_printer_option_widget_get_external_label (GTK_PRINTER_OPTION_WIDGET (widget));
-          gtk_widget_show (label);
-          gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-          gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
-
-          hbox = gtk_hbox_new (FALSE, 12);
-          gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-          gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
-          gtk_widget_show (hbox);
-
-          gtk_box_pack_start (GTK_BOX (extension_hbox), hbox, FALSE, FALSE, 0);
-        }
-      else
-        gtk_box_pack_start (GTK_BOX (extension_hbox), widget, FALSE, FALSE, 0);
+  if (gtk_printer_option_widget_has_external_label (GTK_PRINTER_OPTION_WIDGET (widget)))
+    {
+      GtkWidget *label, *hbox;
+      
+      label = gtk_printer_option_widget_get_external_label (GTK_PRINTER_OPTION_WIDGET (widget));
+      gtk_widget_show (label);
+      gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+      gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
+      
+      hbox = gtk_hbox_new (FALSE, 12);
+      gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+      gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
+      gtk_widget_show (hbox);
+      
+      gtk_box_pack_start (GTK_BOX (extension_point), hbox, FALSE, FALSE, 0);
     }
   else
-    g_warning ("Extension point %s requested but not found.", option->name);
+    gtk_box_pack_start (GTK_BOX (extension_point), widget, FALSE, FALSE, 0);
 }
 
 static void
@@ -779,7 +777,7 @@ add_option_to_table (GtkPrinterOption *option,
 {
   GtkTable *table;
   GtkWidget *label, *widget;
-  int row;
+  gint row;
 
   table = GTK_TABLE (user_data);
   
@@ -790,7 +788,7 @@ add_option_to_table (GtkPrinterOption *option,
   gtk_widget_show (widget);
 
   row = table->nrows;
-  gtk_table_resize (table, table->nrows + 1, table->ncols + 1);
+  gtk_table_resize (table, table->nrows + 1, 2);
   
   if (gtk_printer_option_widget_has_external_label (GTK_PRINTER_OPTION_WIDGET (widget)))
     {
@@ -920,7 +918,7 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
 {
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
   GList *groups, *l;
-  char *group;
+  gchar *group;
   GtkWidget *table, *frame;
   gboolean has_advanced, has_job;
  
@@ -971,6 +969,11 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
                    priv->color_table,
                    priv->color_page);
 
+  gtk_printer_option_set_foreach_in_group (priv->options,
+                                          "GtkPrintDialogExtension",
+                                          add_option_to_extension_point,
+                                          priv->extension_point);
+
   /* Put the rest of the groups in the advanced page */
   groups = gtk_printer_option_set_get_groups (priv->options);
 
@@ -984,18 +987,10 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
       
       if (strcmp (group, "ImageQualityPage") == 0 ||
          strcmp (group, "ColorPage") == 0 ||
-         strcmp (group, "FinishingPage") == 0)
+         strcmp (group, "FinishingPage") == 0 ||
+         strcmp (group, "GtkPrintDialogExtension") == 0)
        continue;
 
-      if (strcmp (group, "GtkPrintDialogExtention") == 0)
-        {
-          gtk_printer_option_set_foreach_in_group (priv->options,
-                                                  group,
-                                                  add_option_to_extension_point,
-                                                  priv->extension_points);
-          continue;
-        }
-
       table = gtk_table_new (1, 2, FALSE);
       gtk_table_set_row_spacings (GTK_TABLE (table), 6);
       gtk_table_set_col_spacings (GTK_TABLE (table), 12);
@@ -1028,6 +1023,43 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
   g_list_free (groups);
 }
 
+static void
+update_dialog_from_capabilities (GtkPrintUnixDialog *dialog)
+{
+  GtkPrintCapabilities caps;
+  GtkPrintUnixDialogPrivate *priv = dialog->priv;
+  gboolean can_collate;
+  const gchar *copies;
+
+  copies = gtk_entry_get_text (GTK_ENTRY (priv->copies_spin));
+  can_collate = (*copies != '\0' && atoi (copies) > 1);
+
+  caps = priv->manual_capabilities | priv->printer_capabilities;
+
+  gtk_widget_set_sensitive (priv->page_set_combo,
+                           caps & GTK_PRINT_CAPABILITY_PAGE_SET);
+  gtk_widget_set_sensitive (priv->copies_spin,
+                           caps & GTK_PRINT_CAPABILITY_COPIES);
+  gtk_widget_set_sensitive (priv->collate_check,
+                           can_collate && 
+                           (caps & GTK_PRINT_CAPABILITY_COLLATE));
+  gtk_widget_set_sensitive (priv->reverse_check,
+                           caps & GTK_PRINT_CAPABILITY_REVERSE);
+  gtk_widget_set_sensitive (priv->scale_spin,
+                           caps & GTK_PRINT_CAPABILITY_SCALE);
+  gtk_widget_set_sensitive (GTK_WIDGET (priv->pages_per_sheet),
+                           caps & GTK_PRINT_CAPABILITY_NUMBER_UP);
+
+  if (caps & GTK_PRINT_CAPABILITY_PREVIEW)
+    gtk_widget_show (priv->preview_button);
+  else
+    gtk_widget_hide (priv->preview_button);
+
+  update_collate_icon (NULL, dialog);
+
+  gtk_tree_model_filter_refilter (priv->printer_list_filter);
+}
+
 static void
 mark_conflicts (GtkPrintUnixDialog *dialog)
 {
@@ -1093,8 +1125,8 @@ schedule_idle_mark_conflicts (GtkPrintUnixDialog *dialog)
   if (priv->mark_conflicts_id != 0)
     return;
 
-  priv->mark_conflicts_id = g_idle_add (mark_conflicts_callback,
-                                               dialog);
+  priv->mark_conflicts_id = gdk_threads_add_idle (mark_conflicts_callback,
+                                       dialog);
 }
 
 static void
@@ -1122,9 +1154,7 @@ remove_custom_widget (GtkWidget    *widget,
 }
 
 static void
-extension_point_clear_children (const gchar  *key,
-                                GtkContainer *container,
-                                gpointer      data)
+extension_point_clear_children (GtkContainer *container)
 {
   gtk_container_foreach (container,
                          (GtkCallback)remove_custom_widget,
@@ -1151,9 +1181,7 @@ clear_per_printer_ui (GtkPrintUnixDialog *dialog)
   gtk_container_foreach (GTK_CONTAINER (priv->advanced_vbox),
                         (GtkCallback)gtk_widget_destroy,
                         NULL);
-  g_hash_table_foreach (priv->extension_points, 
-                        (GHFunc) extension_point_clear_children, 
-                        NULL);
+  extension_point_clear_children (GTK_CONTAINER (priv->extension_point));
 }
 
 static void
@@ -1209,13 +1237,13 @@ selected_printer_changed (GtkTreeSelection   *selection,
                          -1);
     }
   
-  if (printer != NULL && !_gtk_printer_has_details (printer))
+  if (printer != NULL && !gtk_printer_has_details (printer))
     {
       gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE);
       priv->request_details_tag =
        g_signal_connect (printer, "details-acquired",
                          G_CALLBACK (printer_details_acquired), dialog);
-      _gtk_printer_request_details (printer);
+      gtk_printer_request_details (printer);
       g_object_unref (printer);
       return;
     }
@@ -1240,20 +1268,27 @@ selected_printer_changed (GtkTreeSelection   *selection,
       g_object_unref (priv->current_printer);
     }
 
+  priv->printer_capabilities = 0;
+  
   gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE);
   priv->current_printer = printer;
 
   if (printer != NULL)
     {
-      priv->options = _gtk_printer_get_options (printer, priv->initial_settings,
-                                                       priv->page_setup);
+      priv->printer_capabilities = gtk_printer_get_capabilities (printer);
+      priv->options = _gtk_printer_get_options (printer, 
+                                               priv->initial_settings,
+                                               priv->page_setup,
+                                               priv->manual_capabilities);
   
       priv->options_changed_handler = 
         g_signal_connect_swapped (priv->options, "changed", G_CALLBACK (options_changed_cb), dialog);
     }
 
   update_dialog_from_settings (dialog);
+  update_dialog_from_capabilities (dialog);
 }
+
 static void
 update_collate_icon (GtkToggleButton    *toggle_button,
                     GtkPrintUnixDialog *dialog)
@@ -1306,16 +1341,18 @@ draw_collate_cb (GtkWidget          *widget,
                 GdkEventExpose     *event,
                 GtkPrintUnixDialog *dialog)
 {
-  GtkPrintUnixDialogPrivate *priv = dialog->priv;
   GtkSettings *settings;
   cairo_t *cr;
   gint size;
   gfloat scale;
   gboolean collate, reverse, rtl;
+  gint copies;
   gint text_x;
 
-  collate = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->collate_check));
-  reverse = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->reverse_check));
+  collate = dialog_get_collate (dialog);
+  reverse = dialog_get_reverse (dialog);
+  copies = dialog_get_n_copies (dialog);
+
   rtl = (gtk_widget_get_direction (GTK_WIDGET (widget)) == GTK_TEXT_DIR_RTL);
 
   settings = gtk_widget_get_settings (widget);
@@ -1328,12 +1365,20 @@ draw_collate_cb (GtkWidget          *widget,
 
   cr = gdk_cairo_create (widget->window);
 
-  paint_page (widget, cr, scale, rtl ? 40: 15, 5, collate == reverse ? "1" : "2", text_x);
-  paint_page (widget, cr, scale, rtl ? 50: 5, 15, reverse ? "2" : "1", text_x);
+  if (copies == 1)
+    {
+      paint_page (widget, cr, scale, rtl ? 40: 15, 5, reverse ? "1" : "2", text_x);
+      paint_page (widget, cr, scale, rtl ? 50: 5, 15, reverse ? "2" : "1", text_x);
+    }
+  else
+    {
+      paint_page (widget, cr, scale, rtl ? 40: 15, 5, collate == reverse ? "1" : "2", text_x);
+      paint_page (widget, cr, scale, rtl ? 50: 5, 15, reverse ? "2" : "1", text_x);
+
+      paint_page (widget, cr, scale, rtl ? 5 : 50, 5, reverse ? "1" : "2", text_x);
+      paint_page (widget, cr, scale, rtl ? 15 : 40, 15, collate == reverse ? "2" : "1", text_x);
+    }
 
-  paint_page (widget, cr, scale, rtl ? 5 : 50, 5, reverse ? "1" : "2", text_x);
-  paint_page (widget, cr, scale, rtl ? 15 : 40, 15, collate == reverse ? "2" : "1", text_x);
-  
   cairo_destroy (cr);
 
   return TRUE;
@@ -1367,6 +1412,17 @@ gtk_print_unix_dialog_style_set (GtkWidget *widget,
     }
 }
 
+static void
+update_range_sensitivity (GtkWidget *button,
+                         GtkWidget *range)
+{
+  gboolean active;
+
+  active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+
+  gtk_widget_set_sensitive (range, active);
+}
+
 static void
 create_main_page (GtkPrintUnixDialog *dialog)
 {
@@ -1445,9 +1501,7 @@ create_main_page (GtkPrintUnixDialog *dialog)
   custom_input = gtk_hbox_new (FALSE, 18);
   gtk_widget_show (custom_input);
   gtk_box_pack_start (GTK_BOX (vbox), custom_input, FALSE, FALSE, 0);
-  g_hash_table_insert (priv->extension_points, 
-                       _EXTENTION_POINT_MAIN_PAGE_CUSTOM_INPUT,
-                       custom_input);
+  priv->extension_point = custom_input;
 
   hbox = gtk_hbox_new (FALSE, 18);
   gtk_widget_show (hbox);
@@ -1475,8 +1529,10 @@ create_main_page (GtkPrintUnixDialog *dialog)
   gtk_table_attach (GTK_TABLE (table), radio,
                    0, 2, 1, 2,  GTK_FILL, 0,
                    0, 0);
-  radio = gtk_radio_button_new_with_mnemonic (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)),
-                                             _("Ra_nge: "));
+  radio = gtk_radio_button_new_with_mnemonic (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("Ra_nge"));
+  gtk_widget_set_tooltip_text (radio, _("Specify one or more page ranges,\n e.g. 1-3,7,11"));
   priv->page_range_radio = radio;
   gtk_widget_show (radio);
   gtk_table_attach (GTK_TABLE (table), radio,
@@ -1488,6 +1544,8 @@ create_main_page (GtkPrintUnixDialog *dialog)
   gtk_table_attach (GTK_TABLE (table), entry,
                    1, 2, 2, 3,  GTK_FILL, 0,
                    0, 0);
+  g_signal_connect (radio, "toggled", G_CALLBACK (update_range_sensitivity), entry);
+  update_range_sensitivity (radio, entry);
 
   table = gtk_table_new (3, 2, FALSE);
   gtk_table_set_row_spacings (GTK_TABLE (table), 6);
@@ -1496,7 +1554,7 @@ create_main_page (GtkPrintUnixDialog *dialog)
   gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
   gtk_widget_show (table);
 
-  /* FIXMEchpe: too much space between Copies and spinbutton, put those 2 in a hbox and make it span 2 columns */
+  /* FIXME chpe: too much space between Copies and spinbutton, put those 2 in a hbox and make it span 2 columns */
   label = gtk_label_new_with_mnemonic (_("Copie_s:"));
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
   gtk_widget_show (label);
@@ -1510,7 +1568,11 @@ create_main_page (GtkPrintUnixDialog *dialog)
                    1, 2, 0, 1,  GTK_FILL, 0,
                    0, 0);
   gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
-
+  g_signal_connect_swapped (spinbutton, "value-changed", 
+                           G_CALLBACK (update_dialog_from_capabilities), dialog);
+  g_signal_connect_swapped (spinbutton, "changed", 
+                           G_CALLBACK (update_dialog_from_capabilities), dialog);
+  
   check = gtk_check_button_new_with_mnemonic (_("C_ollate"));
   priv->collate_check = check;
   g_signal_connect (check, "toggled", G_CALLBACK (update_collate_icon), dialog);
@@ -1518,6 +1580,7 @@ create_main_page (GtkPrintUnixDialog *dialog)
   gtk_table_attach (GTK_TABLE (table), check,
                    0, 1, 1, 2,  GTK_FILL, 0,
                    0, 0);
+
   check = gtk_check_button_new_with_mnemonic (_("_Reverse"));
   g_signal_connect (check, "toggled", G_CALLBACK (update_collate_icon), dialog);
   priv->reverse_check = check;
@@ -1533,13 +1596,12 @@ create_main_page (GtkPrintUnixDialog *dialog)
   gtk_table_attach (GTK_TABLE (table), image,
                    1, 2, 1, 3, GTK_FILL, 0,
                    0, 0);
-  g_signal_connect (image, "expose_event", G_CALLBACK (draw_collate_cb), dialog);
+  g_signal_connect (image, "expose-event", G_CALLBACK (draw_collate_cb), dialog);
 
   label = gtk_label_new (_("General"));
   gtk_widget_show (label);
   
-  gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
-                           main_vbox, label);
+  gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), main_vbox, label);
 }
 
 static gboolean
@@ -1553,11 +1615,11 @@ dialog_get_page_ranges (GtkPrintUnixDialog *dialog,
                        gint               *n_ranges_out)
 {
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
-  int i, n_ranges;
-  const char *text, *p;
-  char *next;
+  gint i, n_ranges;
+  const gchar *text, *p;
+  gchar *next;
   GtkPageRange *ranges;
-  int start, end;
+  gint start, end;
   
   text = gtk_entry_get_text (GTK_ENTRY (priv->page_range_entry));
 
@@ -1582,22 +1644,33 @@ dialog_get_page_ranges (GtkPrintUnixDialog *dialog,
   p = text;
   while (*p)
     {
-      start = (int)strtol (p, &next, 10);
-      if (start < 1)
-       start = 1;
+      while (isspace (*p)) p++;
+
+      if (*p == '-')
+        {
+          /* a half-open range like -2 */
+          start = 1;
+        }
+      else
+        {
+          start = (int)strtol (p, &next, 10);
+          if (start < 1)
+           start = 1;
+          p = next;
+        }
+      
       end = start;
 
-      if (next != p)
-       {
-         p = next;
+      while (isspace (*p)) p++;
 
-         if (*p == '-')
-           {
-             p++;
-             end = (int)strtol (p, NULL, 10);
-             if (end < start)
-               end = start;
-           }
+      if (*p == '-')
+       {
+         p++;
+         end = (int)strtol (p, &next, 10);
+          if (next == p) /* a half-open range like 2- */
+            end = 0;
+         else if (end < start)
+           end = start;
        }
 
       ranges[i].start = start - 1;
@@ -1624,7 +1697,7 @@ dialog_set_page_ranges (GtkPrintUnixDialog *dialog,
                        gint                n_ranges)
 {
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
-  int i;
+  gint i;
   GString *s = g_string_new ("");
 
   for (i = 0; i < n_ranges; i++)
@@ -1632,13 +1705,14 @@ dialog_set_page_ranges (GtkPrintUnixDialog *dialog,
       g_string_append_printf (s, "%d", ranges[i].start + 1);
       if (ranges[i].end > ranges[i].start)
        g_string_append_printf (s, "-%d", ranges[i].end + 1);
+      else if (ranges[i].end == -1)
+        g_string_append (s, "-");
       
       if (i != n_ranges - 1)
        g_string_append (s, ",");
     }
 
-  gtk_entry_set_text (GTK_ENTRY (priv->page_range_entry),
-                     s->str);
+  gtk_entry_set_text (GTK_ENTRY (priv->page_range_entry), s->str);
   
   g_string_free (s, TRUE);
 }
@@ -1658,7 +1732,8 @@ dialog_get_print_pages (GtkPrintUnixDialog *dialog)
 }
 
 static void
-dialog_set_print_pages (GtkPrintUnixDialog *dialog, GtkPrintPages pages)
+dialog_set_print_pages (GtkPrintUnixDialog *dialog, 
+                       GtkPrintPages       pages)
 {
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
 
@@ -1673,21 +1748,26 @@ dialog_set_print_pages (GtkPrintUnixDialog *dialog, GtkPrintPages pages)
 static gdouble
 dialog_get_scale (GtkPrintUnixDialog *dialog)
 {
-  return gtk_spin_button_get_value (GTK_SPIN_BUTTON (dialog->priv->scale_spin));
+  if (GTK_WIDGET_IS_SENSITIVE (dialog->priv->scale_spin))
+    return gtk_spin_button_get_value (GTK_SPIN_BUTTON (dialog->priv->scale_spin));
+  else
+    return 100.0;
 }
 
 static void
 dialog_set_scale (GtkPrintUnixDialog *dialog, 
                   gdouble             val)
 {
-  return gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->priv->scale_spin),
-                                   val);
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->priv->scale_spin), val);
 }
 
 static GtkPageSet
 dialog_get_page_set (GtkPrintUnixDialog *dialog)
 {
-  return (GtkPageSet)gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->priv->page_set_combo));
+  if (GTK_WIDGET_IS_SENSITIVE (dialog->priv->page_set_combo))
+    return (GtkPageSet)gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->priv->page_set_combo));
+  else
+    return GTK_PAGE_SET_ALL;
 }
 
 static void
@@ -1701,7 +1781,9 @@ dialog_set_page_set (GtkPrintUnixDialog *dialog,
 static gint
 dialog_get_n_copies (GtkPrintUnixDialog *dialog)
 {
-  return gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->priv->copies_spin));
+  if (GTK_WIDGET_IS_SENSITIVE (dialog->priv->copies_spin))
+    return gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->priv->copies_spin));
+  return 1;
 }
 
 static void
@@ -1715,7 +1797,9 @@ dialog_set_n_copies (GtkPrintUnixDialog *dialog,
 static gboolean
 dialog_get_collate (GtkPrintUnixDialog *dialog)
 {
-  return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->collate_check));
+  if (GTK_WIDGET_IS_SENSITIVE (dialog->priv->collate_check))
+    return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->collate_check));
+  return FALSE;
 }
 
 static void
@@ -1729,7 +1813,9 @@ dialog_set_collate (GtkPrintUnixDialog *dialog,
 static gboolean
 dialog_get_reverse (GtkPrintUnixDialog *dialog)
 {
-  return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->reverse_check));
+  if (GTK_WIDGET_IS_SENSITIVE (dialog->priv->reverse_check))
+    return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->reverse_check));
+  return FALSE;
 }
 
 static void
@@ -1744,8 +1830,8 @@ static gint
 dialog_get_pages_per_sheet (GtkPrintUnixDialog *dialog)
 {
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
-  const char *val;
-  int num;
+  const gchar *val;
+  gint num;
 
   val = gtk_printer_option_widget_get_value (priv->pages_per_sheet);
 
@@ -1769,15 +1855,15 @@ draw_page_cb (GtkWidget          *widget,
 {
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
   cairo_t *cr;
-  double ratio;
-  int w, h, tmp, shadow_offset;
-  int pages_x, pages_y, i, x, y, layout_w, layout_h;
-  double page_width, page_height;
+  gdouble ratio;
+  gint w, h, tmp, shadow_offset;
+  gint pages_x, pages_y, i, x, y, layout_w, layout_h;
+  gdouble page_width, page_height;
   GtkPageOrientation orientation;
   gboolean landscape;
   PangoLayout *layout;
   PangoFontDescription *font;
-  char *text;
+  gchar *text;
   GdkColor *color;
   
   orientation = gtk_page_setup_get_orientation (priv->page_setup);
@@ -1916,7 +2002,7 @@ create_page_setup_page (GtkPrintUnixDialog *dialog)
   gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
   gtk_widget_show (table);
 
-  label = gtk_label_new_with_mnemonic (_("Pages per _sheet:"));
+  label = gtk_label_new_with_mnemonic (_("Pages per _side:"));
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
   gtk_widget_show (label);
   gtk_table_attach (GTK_TABLE (table), label,
@@ -1947,7 +2033,7 @@ create_page_setup_page (GtkPrintUnixDialog *dialog)
                    0, 0);
   gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
 
-  label = gtk_label_new_with_mnemonic (_("_Only Print:"));
+  label = gtk_label_new_with_mnemonic (_("_Only print:"));
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
   gtk_widget_show (label);
   gtk_table_attach (GTK_TABLE (table), label,
@@ -1998,7 +2084,7 @@ create_page_setup_page (GtkPrintUnixDialog *dialog)
   gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 6);
   gtk_widget_show (table);
 
-  label = gtk_label_new_with_mnemonic (_("Paper _Type:"));
+  label = gtk_label_new_with_mnemonic (_("Paper _type:"));
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
   gtk_widget_show (label);
   gtk_table_attach (GTK_TABLE (table), label,
@@ -2013,7 +2099,7 @@ create_page_setup_page (GtkPrintUnixDialog *dialog)
                    0, 0);
   gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
 
-  label = gtk_label_new_with_mnemonic (_("Paper _Source:"));
+  label = gtk_label_new_with_mnemonic (_("Paper _source:"));
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
   gtk_widget_show (label);
   gtk_table_attach (GTK_TABLE (table), label,
@@ -2028,7 +2114,7 @@ create_page_setup_page (GtkPrintUnixDialog *dialog)
                    0, 0);
   gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
 
-  label = gtk_label_new_with_mnemonic (_("Output T_ray:"));
+  label = gtk_label_new_with_mnemonic (_("Output t_ray:"));
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
   gtk_widget_show (label);
   gtk_table_attach (GTK_TABLE (table), label,
@@ -2051,7 +2137,7 @@ create_page_setup_page (GtkPrintUnixDialog *dialog)
   draw = gtk_drawing_area_new ();
   priv->page_layout_preview = draw;
   gtk_widget_set_size_request (draw, 200, 200);
-  g_signal_connect (draw, "expose_event", G_CALLBACK (draw_page_cb), dialog);
+  g_signal_connect (draw, "expose-event", G_CALLBACK (draw_page_cb), dialog);
   gtk_widget_show (draw);
 
   gtk_box_pack_start (GTK_BOX (hbox2), draw, TRUE, FALSE, 0);
@@ -2146,7 +2232,7 @@ create_job_page (GtkPrintUnixDialog *dialog)
                    0, 0);
 
   radio = gtk_radio_button_new_with_mnemonic (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)),
-                                             _("On _Hold"));
+                                             _("On _hold"));
   priv->print_hold_radio = radio;
   gtk_widget_show (radio);
   gtk_table_attach (GTK_TABLE (table), radio,
@@ -2280,7 +2366,7 @@ populate_dialog (GtkPrintUnixDialog *print_dialog)
 {
   GtkPrintUnixDialogPrivate *priv = print_dialog->priv;
   GtkDialog *dialog = GTK_DIALOG (print_dialog);
-  GtkWidget *hbox, *conflict_hbox, *image, *label;
+  GtkWidget *vbox, *conflict_hbox, *image, *label;
 
   gtk_dialog_set_has_separator (dialog, FALSE);
   gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
@@ -2288,9 +2374,14 @@ populate_dialog (GtkPrintUnixDialog *print_dialog)
   gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5);
   gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6);
 
+  vbox = gtk_vbox_new (FALSE, 6);
+  gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+  gtk_box_pack_start (GTK_BOX (dialog->vbox), vbox, TRUE, TRUE, 0);
+  gtk_widget_show (vbox);
+
   priv->notebook = gtk_notebook_new ();
-  gtk_container_set_border_width (GTK_CONTAINER (priv->notebook), 5);
-  gtk_box_pack_start (GTK_BOX (dialog->vbox), priv->notebook, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), priv->notebook, TRUE, TRUE, 0);
+  gtk_widget_show (priv->notebook);
 
   create_printer_list_model (print_dialog);
 
@@ -2308,35 +2399,15 @@ populate_dialog (GtkPrintUnixDialog *print_dialog)
                        &priv->finishing_page);
   create_advanced_page (print_dialog);
 
-  hbox = gtk_hbox_new (FALSE, 0);
-  gtk_widget_show (hbox);
-  gtk_box_pack_end (GTK_BOX (dialog->vbox), hbox, FALSE, TRUE, 0);
-  
-  conflict_hbox = gtk_hbox_new (FALSE, 0);
+  priv->conflicts_widget = conflict_hbox = gtk_hbox_new (FALSE, 12);
+  gtk_box_pack_end (GTK_BOX (vbox), conflict_hbox, FALSE, FALSE, 0);
   image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU);
   gtk_widget_show (image);
   gtk_box_pack_start (GTK_BOX (conflict_hbox), image, FALSE, TRUE, 0);
   label = gtk_label_new (_("Some of the settings in the dialog conflict"));
   gtk_widget_show (label);
   gtk_box_pack_start (GTK_BOX (conflict_hbox), label, FALSE, TRUE, 0);
-  priv->conflicts_widget = conflict_hbox;
-
-  gtk_box_pack_start (GTK_BOX (hbox), conflict_hbox,
-                     FALSE, FALSE, 0);
-
-  /* Reparent the action area into the hbox. This is so we can have the
-   * conflict warning on the same row, but not make the buttons the same
-   * width as the warning (which the buttonbox does).
-   */
-  g_object_ref (dialog->action_area);
-  gtk_container_remove (GTK_CONTAINER (dialog->vbox),
-                       dialog->action_area);
-  gtk_box_pack_end (GTK_BOX (hbox), dialog->action_area,
-                   FALSE, FALSE, 0);
-  g_object_unref (dialog->action_area);
   
-  gtk_widget_show (priv->notebook);
-
   load_print_backends (print_dialog);
 }
 
@@ -2545,9 +2616,9 @@ gtk_print_unix_dialog_set_settings (GtkPrintUnixDialog *dialog,
                                    GtkPrintSettings   *settings)
 {
   GtkPrintUnixDialogPrivate *priv;
-  const char *printer;
+  const gchar *printer;
   GtkPageRange *ranges;
-  int num_ranges;
+  gint num_ranges;
   
   g_return_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog));
   g_return_if_fail (settings == NULL || GTK_IS_PRINT_SETTINGS (settings));
@@ -2564,7 +2635,10 @@ gtk_print_unix_dialog_set_settings (GtkPrintUnixDialog *dialog,
       dialog_set_print_pages (dialog, gtk_print_settings_get_print_pages (settings));
       ranges = gtk_print_settings_get_page_ranges (settings, &num_ranges);
       if (ranges)
-       dialog_set_page_ranges (dialog, ranges, num_ranges);
+        {
+         dialog_set_page_ranges (dialog, ranges, num_ranges);
+          g_free (ranges);
+        }
 
       priv->format_for_printer =
        g_strdup (gtk_print_settings_get (settings, "format-for-printer"));
@@ -2611,7 +2685,7 @@ gtk_print_unix_dialog_get_settings (GtkPrintUnixDialog *dialog)
   GtkPrintSettings *settings;
   GtkPrintPages print_pages;
   GtkPageRange *ranges;
-  int n_ranges;
+  gint n_ranges;
 
   g_return_val_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog), NULL);
 
@@ -2663,6 +2737,63 @@ gtk_print_unix_dialog_get_settings (GtkPrintUnixDialog *dialog)
   return settings;
 }
 
+/**
+ * gtk_print_unix_dialog_add_custom_tab:
+ * @dialog: a #GtkPrintUnixDialog
+ * @child: the widget to put in the custom tab
+ * @tab_label: the widget to use as tab label
+ *
+ * Adds a custom tab to the print dialog.
+ *
+ * Since: 2.10
+ */
+void
+gtk_print_unix_dialog_add_custom_tab (GtkPrintUnixDialog *dialog,
+                                     GtkWidget          *child,
+                                     GtkWidget          *tab_label)
+{
+  gtk_notebook_insert_page (GTK_NOTEBOOK (dialog->priv->notebook),
+                           child, tab_label, 2);
+  gtk_widget_show (child);
+  gtk_widget_show (tab_label);
+}
+
+/**
+ * gtk_print_unix_dialog_set_manual_capabilities:
+ * @dialog: a #GtkPrintUnixDialog
+ * @capabilities: the printing capabilities of your application
+ *
+ * This lets you specify the printing capabilities your application
+ * supports. For instance, if you can handle scaling the output then
+ * you pass #GTK_PRINT_CAPABILITY_SCALE. If you don't pass that, then
+ * the dialog will only let you select the scale if the printing
+ * system automatically handles scaling.
+ *
+ * Since: 2.10
+ */
+void
+gtk_print_unix_dialog_set_manual_capabilities (GtkPrintUnixDialog   *dialog,
+                                              GtkPrintCapabilities  capabilities)
+{
+  GtkPrintUnixDialogPrivate *priv = dialog->priv;
+
+  priv->manual_capabilities = capabilities;
+  update_dialog_from_capabilities (dialog);
+
+  if (priv->current_printer)
+    {
+      GtkTreeSelection *selection;
+
+      selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->printer_treeview));
+
+      g_object_unref (priv->current_printer);
+      priv->current_printer = NULL;
+      priv->internal_printer_change = TRUE;
+      selected_printer_changed (selection, dialog);
+      priv->internal_printer_change = FALSE;
+   }
+}
 
 #define __GTK_PRINT_UNIX_DIALOG_C__
 #include "gtkaliasdef.c"
+