X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=shell%2Fev-print-operation.c;h=08c655d4bce6f1100fa9223154c7615723bcc475;hb=00632264c5cb956ee6d66b00d14bbd4ad9f96efd;hp=8dbe6c5218f880a11834b15de7c05f25ea70733e;hpb=f3d53dc0f9d9454e5b7f6dc0f7a209434bd9adfb;p=evince.git diff --git a/shell/ev-print-operation.c b/shell/ev-print-operation.c index 8dbe6c52..08c655d4 100644 --- a/shell/ev-print-operation.c +++ b/shell/ev-print-operation.c @@ -1252,13 +1252,8 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial get_first_and_last_page (export, &first_page, &last_page); - if (file_format) { - export->fc.format = g_ascii_strcasecmp (file_format, "pdf") == 0 ? - EV_FILE_FORMAT_PDF : EV_FILE_FORMAT_PS; - } else { - export->fc.format = gtk_printer_accepts_pdf (printer) ? - EV_FILE_FORMAT_PDF : EV_FILE_FORMAT_PS; - } + export->fc.format = file_format && g_ascii_strcasecmp (file_format, "pdf") == 0 ? + EV_FILE_FORMAT_PDF : EV_FILE_FORMAT_PS; export->fc.filename = export->temp_file; export->fc.first_page = MIN (first_page, last_page); export->fc.last_page = MAX (first_page, last_page); @@ -1641,6 +1636,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 +1739,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); }