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=1821d4f96a94a2343a363ceb6b441748ce9c1e8e;hb=858d08e4a3794e93d7c6178099c78812f130161e;hp=e583dfbfe81d3985b985d6780f5c528ccaa53900;hpb=51d4c0c6de63d78e9df04df525df35351b8bb454;p=evince.git diff --git a/shell/ev-print-operation.c b/shell/ev-print-operation.c index e583dfbf..1821d4f9 100644 --- a/shell/ev-print-operation.c +++ b/shell/ev-print-operation.c @@ -21,7 +21,9 @@ #include "ev-print-operation.h" +#if GTKUNIXPRINT_ENABLED #include +#endif #include #include #include @@ -297,6 +299,7 @@ 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, @@ -322,6 +325,9 @@ ev_print_operation_update_status (EvPrintOperation *op, g_signal_emit (op, signals[STATUS_CHANGED], 0); } +#endif + +#if GTKUNIXPRINT_ENABLED /* Export interface */ #define EV_TYPE_PRINT_OPERATION_EXPORT (ev_print_operation_export_get_type()) @@ -1114,6 +1120,8 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial export->ranges[i].end = export->n_pages - 1; } break; + default: + g_warning ("Unsupported print pages setting\n"); case GTK_PRINT_PAGES_ALL: export->ranges = &export->one_range; @@ -1123,6 +1131,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial break; } + if (export->n_ranges < 1 || !clamp_ranges (export)) { GtkWidget *message_dialog; @@ -1372,6 +1381,8 @@ ev_print_operation_export_class_init (EvPrintOperationExportClass *klass) g_object_class->finalize = ev_print_operation_export_finalize; } +#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()) @@ -1645,18 +1656,28 @@ ev_print_operation_print_class_init (EvPrintOperationPrintClass *klass) 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 */ } /* Factory method */ EvPrintOperation * ev_print_operation_new (EvDocument *document) { - EvPrintOperation *op; + EvPrintOperation *op = NULL; + + 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)) @@ -1664,8 +1685,9 @@ ev_print_operation_new (EvDocument *document) "document", document, NULL)); else #endif +#if GTKUNIXPRINT_ENABLED op = EV_PRINT_OPERATION (g_object_new (EV_TYPE_PRINT_OPERATION_EXPORT, "document", document, NULL)); - +#endif return op; }