Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2009-10-24 08:14:02 (GMT)
committer Carlos Garcia Campos <carlosgc@gnome.org>2009-10-25 12:14:55 (GMT)
commit81a61466af2516daf6ba4b716234c0bcbeee959c (patch)
treebddc1a902c26f2bec680d01a847e5a703a8a098f /shell
parentf3d53dc0f9d9454e5b7f6dc0f7a209434bd9adfb (diff)
[printing] Set page orientation of each page when printing
so that documents with mixed portrait/landscape pages print correctly. Fixes bgo#599470.
Diffstat (limited to 'shell')
-rw-r--r--shell/ev-print-operation.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/shell/ev-print-operation.c b/shell/ev-print-operation.c
index 8dbe6c5..9ea42c1 100644
--- a/shell/ev-print-operation.c
+++ b/shell/ev-print-operation.c
@@ -1642,6 +1642,23 @@ print_job_cancelled (EvJobPrint *job,
}
static void
+ev_print_operation_print_request_page_setup (EvPrintOperationPrint *print,
+ GtkPrintContext *context,
+ gint page_nr,
+ GtkPageSetup *setup)
+{
+ EvPrintOperation *op = EV_PRINT_OPERATION (print);
+ gdouble width, height;
+
+ ev_document_get_page_size (op->document, page_nr,
+ &width, &height);
+ if (width > height)
+ gtk_page_setup_set_orientation (setup, GTK_PAGE_ORIENTATION_LANDSCAPE);
+ else
+ gtk_page_setup_set_orientation (setup, GTK_PAGE_ORIENTATION_PORTRAIT);
+}
+
+static void
ev_print_operation_print_draw_page (EvPrintOperationPrint *print,
GtkPrintContext *context,
gint page)
@@ -1727,6 +1744,9 @@ ev_print_operation_print_init (EvPrintOperationPrint *print)
g_signal_connect_swapped (print->op, "status_changed",
G_CALLBACK (ev_print_operation_print_status_changed),
print);
+ g_signal_connect_swapped (print->op, "request_page_setup",
+ G_CALLBACK (ev_print_operation_print_request_page_setup),
+ print);
gtk_print_operation_set_allow_async (print->op, TRUE);
}