diff options
author | Marek Kasik <mkasik@redhat.com> | 2009-10-26 17:47:37 +0100 |
---|---|---|
committer | Marek Kasik <mkasik@redhat.com> | 2009-10-26 17:47:37 +0100 |
commit | 6b5912a213d9c44e66fabddf980756b9af099e5c (patch) | |
tree | ad13f0b549d9940b54954fbd2a713061c6c270b2 /gtk/gtkprintoperation-unix.c | |
parent | 567b23229f78e2ca4d651c3ab60054fda5857d1b (diff) | |
download | gtk+-6b5912a213d9c44e66fabddf980756b9af099e5c.tar.gz |
Show correct print preview
Modify print preview according to settings from print dialog.
Similar approach as during real print is applied to the preview
process (#592582).
Diffstat (limited to 'gtk/gtkprintoperation-unix.c')
-rw-r--r-- | gtk/gtkprintoperation-unix.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/gtk/gtkprintoperation-unix.c b/gtk/gtkprintoperation-unix.c index 64b3a38e07..6b5aa15fc5 100644 --- a/gtk/gtkprintoperation-unix.c +++ b/gtk/gtkprintoperation-unix.c @@ -207,7 +207,7 @@ _gtk_print_operation_platform_backend_launch_preview (GtkPrintOperation *op, gchar *cmd; gchar *preview_cmd; GtkSettings *settings; - GtkPrintSettings *print_settings; + GtkPrintSettings *print_settings = NULL; GtkPageSetup *page_setup; GKeyFile *key_file = NULL; gchar *data = NULL; @@ -235,8 +235,28 @@ _gtk_print_operation_platform_backend_launch_preview (GtkPrintOperation *op, key_file = g_key_file_new (); - print_settings = gtk_print_operation_get_print_settings (op); - gtk_print_settings_to_key_file (print_settings, key_file, NULL); + print_settings = gtk_print_settings_copy (gtk_print_operation_get_print_settings (op)); + + if (print_settings != NULL) + { + gtk_print_settings_set_reverse (print_settings, FALSE); + gtk_print_settings_set_page_set (print_settings, GTK_PAGE_SET_ALL); + gtk_print_settings_set_scale (print_settings, 1.0); + gtk_print_settings_set_number_up (print_settings, 1); + gtk_print_settings_set_number_up_layout (print_settings, GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM); + + /* These removals are neccessary because cups-* settings have higher priority + * than normal settings. + */ + gtk_print_settings_unset (print_settings, "cups-reverse"); + gtk_print_settings_unset (print_settings, "cups-page-set"); + gtk_print_settings_unset (print_settings, "cups-scale"); + gtk_print_settings_unset (print_settings, "cups-number-up"); + gtk_print_settings_unset (print_settings, "cups-number-up-layout"); + + gtk_print_settings_to_key_file (print_settings, key_file, NULL); + g_object_unref (print_settings); + } page_setup = gtk_print_context_get_page_setup (op->priv->print_context); gtk_page_setup_to_key_file (page_setup, key_file, NULL); |