diff options
author | Hib Eris <hib@hiberis.nl> | 2009-06-09 17:33:21 (GMT) |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2009-06-09 17:33:21 (GMT) |
commit | a6fd45551db35e90ad13c0c483854740aefa312f (patch) | |
tree | e36277cbe4ceeec7176fae63f50282b9905c755b /shell | |
parent | ea6c09ad0a1b74b26329a5f6a64d23c95c9bbd97 (diff) |
[printing] Make use of gtk+-unix-print optional
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ev-print-operation.c | 23 | ||||
-rw-r--r-- | shell/ev-window.c | 5 |
2 files changed, 26 insertions, 2 deletions
diff --git a/shell/ev-print-operation.c b/shell/ev-print-operation.c index e583dfb..9c21a1d 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 <gtk/gtkunixprint.h> +#endif #include <glib/gi18n.h> #include <glib/gstdio.h> #include <unistd.h> @@ -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()) @@ -1372,6 +1378,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 +1653,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 +1682,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; } diff --git a/shell/ev-window.c b/shell/ev-window.c index 7984cab..cb8de7c 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -2989,6 +2989,11 @@ ev_window_print_range (EvWindow *ev_window, ev_window->priv->print_queue = g_queue_new (); op = ev_print_operation_new (ev_window->priv->document); + if (!op) { + g_warning ("%s", "Printing is not supported for document\n"); + return; + } + g_signal_connect (op, "begin_print", G_CALLBACK (ev_window_print_operation_begin_print), (gpointer)ev_window); |