diff options
Diffstat (limited to 'libview/ev-print-operation.c')
-rw-r--r-- | libview/ev-print-operation.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/libview/ev-print-operation.c b/libview/ev-print-operation.c index 9449dd37..be258b76 100644 --- a/libview/ev-print-operation.c +++ b/libview/ev-print-operation.c @@ -397,7 +397,7 @@ struct _EvPrintOperationExport { gboolean embed_page_setup; guint idle_id; - + /* Context */ EvFileExporterContext fc; gint n_pages_to_print; @@ -486,7 +486,7 @@ ev_print_queue_pop (EvDocument *document) queue = g_hash_table_lookup (print_queue, document); if (!queue || g_queue_is_empty (queue)) return NULL; - + op = g_queue_pop_tail (queue); g_object_unref (op); @@ -512,7 +512,7 @@ ev_print_operation_export_set_current_page (EvPrintOperation *op, EvPrintOperationExport *export = EV_PRINT_OPERATION_EXPORT (op); g_return_if_fail (current_page < export->n_pages); - + export->current_page = current_page; } @@ -619,7 +619,7 @@ clamp_ranges (EvPrintOperationExport *export) for (i = 0; i < export->n_ranges; i++) { gint n_pages; - + if ((export->ranges[i].start >= 0) && (export->ranges[i].start < export->n_pages) && (export->ranges[i].end >= 0) && @@ -639,7 +639,7 @@ clamp_ranges (EvPrintOperationExport *export) export->ranges[num_of_correct_ranges] = export->ranges[i]; num_of_correct_ranges++; } - + n_pages = export->ranges[i].end - export->ranges[i].start + 1; if (export->page_set == GTK_PAGE_SET_ALL) { n_pages_to_print += n_pages; @@ -648,13 +648,13 @@ clamp_ranges (EvPrintOperationExport *export) } else if (export->page_set == GTK_PAGE_SET_EVEN) { if (n_pages==1 && export->ranges[i].start % 2 == 0) null_flag = TRUE; - else + else n_pages_to_print += export->ranges[i].start % 2 == 0 ? n_pages / 2 : (n_pages / 2) + 1; } else if (export->page_set == GTK_PAGE_SET_ODD) { - if (n_pages==1 && export->ranges[i].start % 2 != 0) + if (n_pages==1 && export->ranges[i].start % 2 != 0) null_flag = TRUE; - else + else n_pages_to_print += export->ranges[i].start % 2 == 0 ? (n_pages / 2) + 1 : n_pages / 2; } @@ -775,7 +775,7 @@ ev_print_operation_export_run_next (EvPrintOperationExport *export) /* First pop the current job */ document = op->document; ev_print_queue_pop (document); - + next = ev_print_queue_peek (document); if (next) ev_print_operation_export_begin (EV_PRINT_OPERATION_EXPORT (next)); @@ -813,7 +813,7 @@ export_print_done (EvPrintOperationExport *export) GError *error = NULL; g_assert (export->temp_file != NULL); - + /* Some printers take into account some print settings, * and others don't. However we have exported the document * to a ps or pdf file according to such print settings. So, @@ -855,12 +855,12 @@ export_print_done (EvPrintOperationExport *export) data = g_key_file_to_data (key_file, &data_len, &error); if (data) { gint fd; - + fd = g_file_open_tmp ("print-settingsXXXXXX", &print_settings_file, &error); if (!error) g_file_set_contents (print_settings_file, data, data_len, &error); close (fd); - + g_free (data); } @@ -908,7 +908,7 @@ export_print_done (EvPrintOperationExport *export) } } else { GtkPrintJob *job; - + job = gtk_print_job_new (export->job_name, export->printer, settings, @@ -992,7 +992,7 @@ export_cancel (EvPrintOperationExport *export) g_object_unref (export->job_export); export->job_export = NULL; } - + if (export->fd != -1) { close (export->fd); export->fd = -1; @@ -1105,7 +1105,7 @@ export_print_page (EvPrintOperationExport *export) ev_job_scheduler_push_job (export->job_export, EV_JOB_PRIORITY_NONE); update_progress (export); - + return FALSE; } @@ -1116,7 +1116,7 @@ ev_print_operation_export_begin (EvPrintOperationExport *export) if (!export->temp_file) return; /* cancelled */ - + ev_document_doc_mutex_lock (); ev_file_exporter_begin (EV_FILE_EXPORTER (op->document), &export->fc); ev_document_doc_mutex_unlock (); @@ -1124,7 +1124,7 @@ ev_print_operation_export_begin (EvPrintOperationExport *export) export->idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, (GSourceFunc)export_print_page, export, - (GDestroyNotify)export_print_page_idle_finished); + (GDestroyNotify)export_print_page_idle_finished); } static void @@ -1145,7 +1145,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial gchar *filename; GError *error = NULL; EvPrintOperation *op = EV_PRINT_OPERATION (export); - + if (response != GTK_RESPONSE_OK && response != GTK_RESPONSE_APPLY) { gtk_widget_destroy (GTK_WIDGET (dialog)); @@ -1155,7 +1155,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial } export->print_preview = (response == GTK_RESPONSE_APPLY); - + printer = gtk_print_unix_dialog_get_selected_printer (GTK_PRINT_UNIX_DIALOG (dialog)); ev_print_operation_export_set_printer (export, printer); @@ -1167,24 +1167,24 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial if (!gtk_printer_accepts_ps (export->printer)) { gtk_widget_destroy (GTK_WIDGET (dialog)); - + g_set_error_literal (&export->error, GTK_PRINT_ERROR, GTK_PRINT_ERROR_GENERAL, _("Printing is not supported on this printer.")); g_signal_emit (op, signals[DONE], 0, GTK_PRINT_OPERATION_RESULT_ERROR); - + return; } file_format = gtk_print_settings_get (print_settings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT); - + filename = g_strdup_printf ("atril_print.%s.XXXXXX", file_format != NULL ? file_format : ""); export->fd = g_file_open_tmp (filename, &export->temp_file, &error); g_free (filename); if (export->fd <= -1) { gtk_widget_destroy (GTK_WIDGET (dialog)); - + g_set_error_literal (&export->error, GTK_PRINT_ERROR, GTK_PRINT_ERROR_GENERAL, @@ -1198,19 +1198,19 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial export->current_page = gtk_print_unix_dialog_get_current_page (GTK_PRINT_UNIX_DIALOG (dialog)); export->page_set = gtk_print_settings_get_page_set (print_settings); print_pages = gtk_print_settings_get_print_pages (print_settings); - + switch (print_pages) { case GTK_PRINT_PAGES_CURRENT: export->ranges = &export->one_range; - + export->ranges[0].start = export->current_page; export->ranges[0].end = export->current_page; export->n_ranges = 1; - + break; case GTK_PRINT_PAGES_RANGES: { gint i; - + export->ranges = gtk_print_settings_get_page_ranges (print_settings, &export->n_ranges); for (i = 0; i < export->n_ranges; i++) if (export->ranges[i].end == -1 || export->ranges[i].end >= export->n_pages) @@ -1225,7 +1225,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial export->ranges[0].start = 0; export->ranges[0].end = export->n_pages - 1; export->n_ranges = 1; - + break; } @@ -1247,7 +1247,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial return; } else ev_print_operation_update_status (op, -1, -1, 0.0); - + width = gtk_page_setup_get_paper_width (page_setup, GTK_UNIT_POINTS); height = gtk_page_setup_get_paper_height (page_setup, GTK_UNIT_POINTS); scale = gtk_print_settings_get_scale (print_settings) * 0.01; @@ -1257,7 +1257,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial } export->pages_per_sheet = MAX (1, gtk_print_settings_get_number_up (print_settings)); - + export->copies = gtk_print_settings_get_n_copies (print_settings); export->collate = gtk_print_settings_get_collate (print_settings); export->reverse = gtk_print_settings_get_reverse (print_settings); @@ -1300,7 +1300,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial ev_print_queue_push (op); g_signal_emit (op, signals[BEGIN_PRINT], 0); - + gtk_widget_destroy (GTK_WIDGET (dialog)); } @@ -1320,7 +1320,7 @@ ev_print_operation_export_run (EvPrintOperation *op, /* translators: Title of the print dialog */ dialog = gtk_print_unix_dialog_new (_("Print"), parent); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); - + capabilities = GTK_PRINT_CAPABILITY_PREVIEW | ev_file_exporter_get_capabilities (EV_FILE_EXPORTER (op->document)); gtk_print_unix_dialog_set_manual_capabilities (GTK_PRINT_UNIX_DIALOG (dialog), @@ -1331,10 +1331,10 @@ ev_print_operation_export_run (EvPrintOperation *op, gtk_print_unix_dialog_set_current_page (GTK_PRINT_UNIX_DIALOG (dialog), export->current_page); - + gtk_print_unix_dialog_set_settings (GTK_PRINT_UNIX_DIALOG (dialog), export->print_settings); - + if (export->page_setup) gtk_print_unix_dialog_set_page_setup (GTK_PRINT_UNIX_DIALOG (dialog), export->page_setup); @@ -1400,7 +1400,7 @@ ev_print_operation_export_finalize (GObject *object) close (export->fd); export->fd = -1; } - + if (export->ranges) { if (export->ranges != &export->one_range) g_free (export->ranges); @@ -1469,7 +1469,7 @@ ev_print_operation_export_constructor (GType type, GObject *object; EvPrintOperationExport *export; EvPrintOperation *op; - + object = G_OBJECT_CLASS (ev_print_operation_export_parent_class)->constructor (type, n_construct_properties, construct_params); |