From 81a61466af2516daf6ba4b716234c0bcbeee959c Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Sat, 24 Oct 2009 08:14:02 +0000 Subject: [printing] Set page orientation of each page when printing so that documents with mixed portrait/landscape pages print correctly. Fixes bgo#599470. --- (limited to 'shell') 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); } -- cgit v0.9.1