AC_MSG_RESULT([$os_win32])
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
-dnl Check dependencies
-
-# LIB_CFLAGS for helpers and generic widgets. (libdocument, cut-and-paste)
-# BACKEND_CFLAGS for backend implementations.
-# FRONTEND_CFLAGS for frontend implementations. (properties, thumbnailer)
-# FRONTEND_LIBS
-# SHELL_CFLAGS for shell implementation.
-# SHELL_LIBS
-
+dnl Specify required versions of dependencies
DBUS_GLIB_REQUIRED=0.70
GTK_REQUIRED=2.14.0
GLIB_REQUIRED=2.18.0
GNOME_ICON_THEME_REQUIRED=2.17.1
LIBXML_REQUIRED=2.5.0
+dnl Check dependencies
+
+# LIB_CFLAGS for helpers and generic widgets. (libdocument, cut-and-paste)
+# BACKEND_CFLAGS for backend implementations.
+# FRONTEND_CFLAGS for frontend implementations. (properties, thumbnailer)
+# FRONTEND_LIBS
+# SHELL_CFLAGS for shell implementation.
+# SHELL_LIBS
+
PKG_CHECK_MODULES(LIBDOCUMENT, gtk+-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED)
PKG_CHECK_MODULES(LIBVIEW, gtk+-2.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
PKG_CHECK_MODULES(BACKEND, gtk+-2.0 >= $GTK_REQUIRED)
PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-2.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
-PKG_CHECK_MODULES(PREVIEWER, gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
-PKG_CHECK_MODULES(SHELL_CORE, libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gthread-2.0)
+PKG_CHECK_MODULES(PREVIEWER, gtk+-2.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
+PKG_CHECK_MODULES(SHELL_CORE, libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gthread-2.0)
if test "$os_win32" = no; then
PKG_CHECK_MODULES(SMCLIENT, gtk+-2.0 gthread-2.0 sm >= 1.0.0)
AC_CHECK_FUNCS(cairo_format_stride_for_width)
LIBS=$evince_save_LIBS
+dnl ========= Check for gtk+-unix-print
+
+if test "$os_win32" = yes; then
+ with_gtk_unix_print_default=no
+else
+ with_gtk_unix_print_default=yes
+fi
+
+AC_MSG_CHECKING([whether gtk+-unix-print support is requested])
+AC_ARG_WITH([gtk-unix-print],
+ [AS_HELP_STRING([--without-gtk-unix-print],[disable the use of gtk-unix-print])],
+ [],[with_gtk_unix_print=$with_gtk_unix_print_default])
+AC_MSG_RESULT([$with_gtk_unix_print])
+
+if test "$with_gtk_unix_print" = "yes"; then
+ PKG_CHECK_MODULES(GTKUNIXPRINT, [gtk+-unix-print-2.0 >= $GTK_REQUIRED])
+ AC_DEFINE([GTKUNIXPRINT_ENABLED], [1], [Define if gtk+-unix-print is enabled.])
+fi
+
dnl ========= Check for Keyring
AC_ARG_WITH(keyring,
AC_HELP_STRING([--without-keyring],[disable the use of gnome-keyring]),
AC_SUBST(BACKEND_CFLAGS)
AC_SUBST(BACKEND_LIBS)
-SHELL_CFLAGS="$SHELL_CORE_CFLAGS $DBUS_CFLAGS $KEYRING_CFLAGS $GCONF_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE $DEBUG_FLAGS"
-SHELL_LIBS="$SHELL_CORE_LIBS $DBUS_LIBS $KEYRING_LIBS $GCONF_LIBS -lz"
+SHELL_CFLAGS="$SHELL_CORE_CFLAGS $GTKUNIXPRINT_CFLAGS $DBUS_CFLAGS $KEYRING_CFLAGS $GCONF_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE $DEBUG_FLAGS"
+SHELL_LIBS="$SHELL_CORE_LIBS $GTKUNIXPRINT_CFLAGS $DBUS_LIBS $KEYRING_LIBS $GCONF_LIBS -lz"
AC_SUBST(SHELL_CFLAGS)
AC_SUBST(SHELL_LIBS)
esac],
[ENABLE_PREVIEWER=yes]) dnl Default value
if test x$ENABLE_PREVIEWER = "xyes" ; then
- PKG_CHECK_MODULES(PREVIEWER, gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED,
+ PKG_CHECK_MODULES(PREVIEWER, gtk+-2.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED,
[ENABLE_PREVIEWER=yes],[ENABLE_PREVIEWER=no])
- if test x$ENABLE_PREVIEWER = "xno" ; then
- AC_MSG_WARN([Previewer support is disabled since gtk+-unix-print $GTK_REQUIRED or higher was not found])
- fi
fi
AM_CONDITIONAL(ENABLE_PREVIEWER, test x$ENABLE_PREVIEWER = "xyes")
-PREVIEWER_CFLAGS="$PREVIEWER_CFLAGS $DEBUG_FLAGS"
-PREVIEWER_LIBS="$PREVIEWER_LIBS -lz"
+PREVIEWER_CFLAGS="$PREVIEWER_CFLAGS $GTKUNIXPRINT_CFLAGS $DEBUG_FLAGS"
+PREVIEWER_LIBS="$PREVIEWER_LIBS $GTKUNIXPRINT_LIBS -lz"
AC_SUBST(PREVIEWER_CFLAGS)
AC_SUBST(PREVIEWER_LIBS)
echo "
Configure summary:
GConf Support......: $with_gconf
+ GTK+ Unix Print....: $with_gtk_unix_print
Keyring Support....: $WITH_KEYRING
DBUS Support.......: $enable_dbus
Nautilus Plugin....: $HAVE_NAUTILUS
#include <config.h>
+#if GTKUNIXPRINT_ENABLED
#include <gtk/gtkunixprint.h>
+#endif
#include <glib/gi18n.h>
#include <evince-view.h>
#include "ev-page-action.h"
/* Printing */
GtkPrintSettings *print_settings;
GtkPageSetup *print_page_setup;
+#if GTKUNIXPRINT_ENABLED
GtkPrinter *printer;
+#endif
gchar *print_job_title;
gchar *source_file;
};
hsb_requisition.height + scrollbar_spacing);
}
+#if GTKUNIXPRINT_ENABLED
static void
ev_previewer_window_error_dialog_run (EvPreviewerWindow *window,
GError *error)
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
+#endif
static void
ev_previewer_window_previous_page (GtkAction *action,
gtk_widget_grab_focus (GTK_WIDGET (window->view));
}
+#if GTKUNIXPRINT_ENABLED
static void
ev_previewer_window_print_finished (GtkPrintJob *print_job,
EvPreviewerWindow *window,
(GDestroyNotify)ev_previewer_window_enumerate_finished,
FALSE);
}
+#endif
static const GtkActionEntry action_entries[] = {
{ "GoPreviousPage", GTK_STOCK_GO_UP, N_("_Previous Page"), "<control>Page_Up",
{ "ViewZoomOut", GTK_STOCK_ZOOM_OUT, NULL, "<control>minus",
N_("Shrink the document"),
G_CALLBACK (ev_previewer_window_zoom_out) },
+#if GTKUNIXPRINT_ENABLED
{ "PreviewPrint", GTK_STOCK_PRINT, N_("Print"), NULL,
N_("Print this document"),
G_CALLBACK (ev_previewer_window_print) }
+#endif
};
static const GtkToggleActionEntry toggle_action_entries[] = {
window->print_page_setup = NULL;
}
+#if GTKUNIXPRINT_ENABLED
if (window->printer) {
g_object_unref (window->printer);
window->printer = NULL;
}
+#endif
if (window->print_job_title) {
g_free (window->print_job_title);
#include "ev-print-operation.h"
+#if GTKUNIXPRINT_ENABLED
#include <gtk/gtkunixprint.h>
+#endif
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <unistd.h>
return op->progress;
}
+#if GTK_CHECK_VERSION (2, 17, 1) | GTKUNIXPRINT_ENABLED
static void
ev_print_operation_update_status (EvPrintOperation *op,
gint page,
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())
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())
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))
"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;
}
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);