X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=libview%2Fev-print-operation.c;h=04e327d0327df57bc6bec72dbfa8327d1612773c;hb=85e52a86b17e550c5a85ceb88f2fb81a2d178da4;hp=555d4bf982bccf8cea38a144002e1d51b264b64f;hpb=b08dd5d93e1c8dd1b68263e130b73476b766a0cf;p=evince.git diff --git a/libview/ev-print-operation.c b/libview/ev-print-operation.c index 555d4bf9..04e327d0 100644 --- a/libview/ev-print-operation.c +++ b/libview/ev-print-operation.c @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include @@ -285,27 +285,21 @@ void ev_print_operation_set_embed_page_setup (EvPrintOperation *op, gboolean embed) { -#if GTK_CHECK_VERSION (2, 17, 4) EvPrintOperationClass *class = EV_PRINT_OPERATION_GET_CLASS (op); g_return_if_fail (EV_IS_PRINT_OPERATION (op)); class->set_embed_page_setup (op, embed); -#endif } gboolean ev_print_operation_get_embed_page_setup (EvPrintOperation *op) { -#if GTK_CHECK_VERSION (2, 17, 4) EvPrintOperationClass *class = EV_PRINT_OPERATION_GET_CLASS (op); g_return_val_if_fail (EV_IS_PRINT_OPERATION (op), FALSE); return class->get_embed_page_setup (op); -#else - return FALSE; -#endif } const gchar * @@ -324,7 +318,6 @@ ev_print_operation_get_progress (EvPrintOperation *op) return op->progress; } -#if GTK_CHECK_VERSION (2, 17, 1) | GTKUNIXPRINT_ENABLED static void ev_print_operation_update_status (EvPrintOperation *op, gint page, @@ -338,11 +331,11 @@ ev_print_operation_update_status (EvPrintOperation *op, if (page == -1) { /* Initial state */ - op->status = g_strdup (_("Preparing to print ...")); + op->status = g_strdup (_("Preparing to print…")); } else if (page > n_pages) { - op->status = g_strdup (_("Finishing...")); + op->status = g_strdup (_("Finishing…")); } else { - op->status = g_strdup_printf (_("Printing page %d of %d..."), + op->status = g_strdup_printf (_("Printing page %d of %d…"), page, n_pages); } @@ -350,7 +343,6 @@ ev_print_operation_update_status (EvPrintOperation *op, g_signal_emit (op, signals[STATUS_CHANGED], 0); } -#endif #if GTKUNIXPRINT_ENABLED @@ -1234,7 +1226,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial "%s", _("Invalid page selection")); gtk_window_set_title (GTK_WINDOW (message_dialog), _("Warning")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog), - "%s", _("Your print range selection does not include any page")); + "%s", _("Your print range selection does not include any pages")); g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); @@ -1319,10 +1311,9 @@ ev_print_operation_export_run (EvPrintOperation *op, ev_file_exporter_get_capabilities (EV_FILE_EXPORTER (op->document)); gtk_print_unix_dialog_set_manual_capabilities (GTK_PRINT_UNIX_DIALOG (dialog), capabilities); -#if GTK_CHECK_VERSION (2, 17, 4) + gtk_print_unix_dialog_set_embed_page_setup (GTK_PRINT_UNIX_DIALOG (dialog), export->embed_page_setup); -#endif gtk_print_unix_dialog_set_current_page (GTK_PRINT_UNIX_DIALOG (dialog), export->current_page); @@ -1368,11 +1359,9 @@ static void ev_print_operation_export_set_embed_page_setup (EvPrintOperation *op, gboolean embed) { -#if GTK_CHECK_VERSION (2, 17, 4) EvPrintOperationExport *export = EV_PRINT_OPERATION_EXPORT (op); export->embed_page_setup = embed; -#endif } static gboolean @@ -1502,7 +1491,6 @@ ev_print_operation_export_class_init (EvPrintOperationExportClass *klass) #endif /* GTKUNIXPRINT_ENABLED */ -#if GTK_CHECK_VERSION (2, 17, 1) /* Print to cairo interface */ #define EV_TYPE_PRINT_OPERATION_PRINT (ev_print_operation_print_get_type()) #define EV_PRINT_OPERATION_PRINT(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_PRINT_OPERATION_PRINT, EvPrintOperationPrint)) @@ -1650,23 +1638,17 @@ static void ev_print_operation_print_set_embed_page_setup (EvPrintOperation *op, gboolean embed) { -#if GTK_CHECK_VERSION (2, 17, 4) EvPrintOperationPrint *print = EV_PRINT_OPERATION_PRINT (op); gtk_print_operation_set_embed_page_setup (print->op, embed); -#endif } static gboolean ev_print_operation_print_get_embed_page_setup (EvPrintOperation *op) { -#if GTK_CHECK_VERSION (2, 17, 4) EvPrintOperationPrint *print = EV_PRINT_OPERATION_PRINT (op); return gtk_print_operation_get_embed_page_setup (print->op); -#else - return FALSE; -#endif } static void @@ -1697,13 +1679,11 @@ ev_print_operation_print_done (EvPrintOperationPrint *print, static void ev_print_operation_print_status_changed (EvPrintOperationPrint *print) { -#ifdef HAVE_GTK_PRINT_OPERATION_GET_N_PAGES_TO_PRINT GtkPrintStatus status; status = gtk_print_operation_get_status (print->op); if (status == GTK_PRINT_STATUS_GENERATING_DATA) print->n_pages_to_print = gtk_print_operation_get_n_pages_to_print (print->op); -#endif } static void @@ -1713,12 +1693,11 @@ print_job_finished (EvJobPrint *job, EvPrintOperation *op = EV_PRINT_OPERATION (print); gtk_print_operation_draw_page_finish (print->op); -#ifdef HAVE_GTK_PRINT_OPERATION_GET_N_PAGES_TO_PRINT + print->total++; ev_print_operation_update_status (op, print->total, print->n_pages_to_print, print->total / (gdouble)print->n_pages_to_print); -#endif ev_job_print_set_cairo (job, NULL); } @@ -1764,22 +1743,12 @@ _print_context_get_hard_margins (GtkPrintContext *context, gdouble *left, gdouble *right) { -#if GTK_CHECK_VERSION (2, 19, 2) if (!gtk_print_context_get_hard_margins (context, top, bottom, left, right)) { *top = 0; *bottom = 0; *left = 0; *right = 0; } -#else - GtkPageSetup *page_setup; - - page_setup = gtk_print_context_get_page_setup (context); - *top = gtk_page_setup_get_top_margin (page_setup, GTK_UNIT_POINTS); - *bottom = gtk_page_setup_get_bottom_margin (page_setup, GTK_UNIT_POINTS); - *left = gtk_page_setup_get_left_margin (page_setup, GTK_UNIT_POINTS); - *right = gtk_page_setup_get_right_margin (page_setup, GTK_UNIT_POINTS); -#endif } static void @@ -1877,7 +1846,7 @@ ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print, gboolean use_source_size; settings = gtk_print_operation_get_print_settings (print->op); - page_scale = gtk_print_settings_get_int_with_default (settings, EV_PRINT_SETTING_PAGE_SCALE, 0); + page_scale = gtk_print_settings_get_int_with_default (settings, EV_PRINT_SETTING_PAGE_SCALE, 1); autorotate = gtk_print_settings_has_key (settings, EV_PRINT_SETTING_AUTOROTATE) ? gtk_print_settings_get_bool (settings, EV_PRINT_SETTING_AUTOROTATE) : TRUE; @@ -1892,10 +1861,10 @@ ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print, gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); gtk_widget_show (label); - print->scale_combo = gtk_combo_box_new_text (); - gtk_combo_box_append_text (GTK_COMBO_BOX (print->scale_combo), _("None")); - gtk_combo_box_append_text (GTK_COMBO_BOX (print->scale_combo), _("Shrink to Printable Area")); - gtk_combo_box_append_text (GTK_COMBO_BOX (print->scale_combo), _("Fit to Printable Area")); + print->scale_combo = gtk_combo_box_text_new (); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (print->scale_combo), _("None")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (print->scale_combo), _("Shrink to Printable Area")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (print->scale_combo), _("Fit to Printable Area")); gtk_combo_box_set_active (GTK_COMBO_BOX (print->scale_combo), page_scale); gtk_widget_set_tooltip_text (print->scale_combo, _("Scale document pages to fit the selected printer page. Select from one of the following:\n" @@ -1903,7 +1872,7 @@ ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print, "• \"None\": No page scaling is performed.\n" "\n" "• \"Shrink to Printable Area\": Document pages larger than the printable area" - " are reduced fit the printable area of the printer page.\n" + " are reduced to fit the printable area of the printer page.\n" "\n" "• \"Fit to Printable Area\": Document pages are enlarged or reduced as" " required to fit the printable area of the printer page.\n")); @@ -2026,22 +1995,14 @@ ev_print_operation_print_class_init (EvPrintOperationPrintClass *klass) g_object_class->finalize = ev_print_operation_print_finalize; } -#endif /* GTK_CHECK_VERSION (2, 17, 1) */ -gboolean ev_print_operation_exists_for_document (EvDocument *document) +gboolean +ev_print_operation_exists_for_document (EvDocument *document) { #if GTKUNIXPRINT_ENABLED -#if GTK_CHECK_VERSION (2, 17, 1) return (EV_IS_FILE_EXPORTER(document) || EV_IS_DOCUMENT_PRINT(document)); #else - return EV_IS_FILE_EXPORTER(document); -#endif -#else /* ! GTKUNIXPRINT_ENABLED */ -#if GTK_CHECK_VERSION (2, 17, 1) return EV_IS_DOCUMENT_PRINT(document); -#else - return FALSE; -#endif #endif /* GTKUNIXPRINT_ENABLED */ } @@ -2053,15 +2014,15 @@ ev_print_operation_new (EvDocument *document) g_return_val_if_fail (ev_print_operation_exists_for_document (document), NULL); -#if GTK_CHECK_VERSION (2, 17, 1) if (EV_IS_DOCUMENT_PRINT (document)) op = EV_PRINT_OPERATION (g_object_new (EV_TYPE_PRINT_OPERATION_PRINT, "document", document, NULL)); else -#endif #if GTKUNIXPRINT_ENABLED op = EV_PRINT_OPERATION (g_object_new (EV_TYPE_PRINT_OPERATION_EXPORT, "document", document, NULL)); +#else + op = NULL; #endif return op; }