From: Adrian Johnson Date: Sat, 24 Oct 2009 08:14:02 +0000 (+1030) Subject: [printing] Set page orientation of each page when printing X-Git-Tag: EVINCE_2_29_1~21 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=81a61466af2516daf6ba4b716234c0bcbeee959c;hp=f3d53dc0f9d9454e5b7f6dc0f7a209434bd9adfb;p=evince.git [printing] Set page orientation of each page when printing so that documents with mixed portrait/landscape pages print correctly. Fixes bgo#599470. --- diff --git a/shell/ev-print-operation.c b/shell/ev-print-operation.c index 8dbe6c52..9ea42c1b 100644 --- a/shell/ev-print-operation.c +++ b/shell/ev-print-operation.c @@ -1641,6 +1641,23 @@ print_job_cancelled (EvJobPrint *job, gtk_print_operation_cancel (print->op); } +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, @@ -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); }