Add a preview capability

This commit is contained in:
Matthias Clasen 2006-06-30 10:32:56 +00:00
parent 593170d7e3
commit 866006534c
6 changed files with 37 additions and 3 deletions

View File

@ -1,3 +1,13 @@
2006-06-30 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprintjob.[hc]: Add a PREVIEW capability to hide
the preview button. (#346113, Christian Persch)
* gtk/gtkprintunixdialog.c (update_dialog_from_capabilities):
Hide the preview button depending on the capability.
* gtk/gtkprintoperation-unix.c: Set the PREVIEW capability.
2006-06-29 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* gtk/gtkprogress.h: revert last change by Matthias -- it broke the

View File

@ -1,3 +1,13 @@
2006-06-30 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprintjob.[hc]: Add a PREVIEW capability to hide
the preview button. (#346113, Christian Persch)
* gtk/gtkprintunixdialog.c (update_dialog_from_capabilities):
Hide the preview button depending on the capability.
* gtk/gtkprintoperation-unix.c: Set the PREVIEW capability.
2006-06-29 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* gtk/gtkprogress.h: revert last change by Matthias -- it broke the

View File

@ -695,6 +695,7 @@ gtk_print_capabilities_get_type (void)
{ GTK_PRINT_CAPABILITY_SCALE, "GTK_PRINT_CAPABILITY_SCALE", "scale" },
{ GTK_PRINT_CAPABILITY_GENERATE_PDF, "GTK_PRINT_CAPABILITY_GENERATE_PDF", "generate-pdf" },
{ GTK_PRINT_CAPABILITY_GENERATE_PS, "GTK_PRINT_CAPABILITY_GENERATE_PS", "generate-ps" },
{ GTK_PRINT_CAPABILITY_PREVIEW, "GTK_PRINT_CAPABILITY_PREVIEW", "preview" },
{ 0, NULL, NULL }
};

View File

@ -45,7 +45,8 @@ typedef enum
GTK_PRINT_CAPABILITY_REVERSE = 1 << 3,
GTK_PRINT_CAPABILITY_SCALE = 1 << 4,
GTK_PRINT_CAPABILITY_GENERATE_PDF = 1 << 5,
GTK_PRINT_CAPABILITY_GENERATE_PS = 1 << 6
GTK_PRINT_CAPABILITY_GENERATE_PS = 1 << 6,
GTK_PRINT_CAPABILITY_PREVIEW = 1 << 7
} GtkPrintCapabilities;
typedef struct _GtkPrintJob GtkPrintJob;

View File

@ -346,7 +346,8 @@ get_print_dialog (GtkPrintOperation *op,
GTK_PRINT_CAPABILITY_REVERSE |
GTK_PRINT_CAPABILITY_SCALE |
GTK_PRINT_CAPABILITY_GENERATE_PDF |
GTK_PRINT_CAPABILITY_GENERATE_PS);
GTK_PRINT_CAPABILITY_GENERATE_PS |
GTK_PRINT_CAPABILITY_PREVIEW);
if (priv->print_settings)
gtk_print_unix_dialog_set_settings (GTK_PRINT_UNIX_DIALOG (pd),

View File

@ -136,6 +136,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;
@ -273,8 +274,13 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog)
(GCallback) gtk_print_unix_dialog_destroy,
NULL);
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_PRINT_PREVIEW, GTK_RESPONSE_APPLY,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_PRINT, GTK_RESPONSE_OK,
NULL);
@ -1029,6 +1035,11 @@ update_dialog_from_capabilities (GtkPrintUnixDialog *dialog)
gtk_widget_set_sensitive (priv->scale_spin,
caps & GTK_PRINT_CAPABILITY_PAGE_SET);
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);