Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2008-02-08 12:48:04 (GMT)
committer Carlos Garcia Campos <carlosgc@src.gnome.org>2008-02-08 12:48:04 (GMT)
commit1ae3aefb3948c59e79989a28797678dd985cd36a (patch)
treef7ddf5bee31041811297465aa7fb62fd694b7f40
parent36c0e159a0421af3b2dfe0e700a75b899a475c2e (diff)
Remove libgnomeprint support. Fixes bug #512370.
2008-02-08 Carlos Garcia Campos <carlosgc@gnome.org> * configure.ac: * shell/Makefile.am: * shell/ev-application.[ch]: * shell/ev-sidebar-links.c: * shell/ev-utils.[ch]: * shell/ev-window.[ch]: Remove libgnomeprint support. Fixes bug #512370. svn path=/trunk/; revision=2895
-rw-r--r--ChangeLog11
-rw-r--r--configure.ac55
-rw-r--r--shell/Makefile.am14
-rw-r--r--shell/ev-application.c7
-rw-r--r--shell/ev-application.h5
-rw-r--r--shell/ev-print-job.c360
-rw-r--r--shell/ev-print-job.h49
-rw-r--r--shell/ev-sidebar-links.c5
-rw-r--r--shell/ev-utils.c94
-rw-r--r--shell/ev-utils.h9
-rw-r--r--shell/ev-window.c185
-rw-r--r--shell/ev-window.h4
12 files changed, 25 insertions, 773 deletions
diff --git a/ChangeLog b/ChangeLog
index bd551cf..29b6c3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-02-08 Carlos Garcia Campos <carlosgc@gnome.org>
+
+ * configure.ac:
+ * shell/Makefile.am:
+ * shell/ev-application.[ch]:
+ * shell/ev-sidebar-links.c:
+ * shell/ev-utils.[ch]:
+ * shell/ev-window.[ch]:
+
+ Remove libgnomeprint support. Fixes bug #512370.
+
2008-02-08 Matthias Clasen <mclasen@redhat.com>
* thumbnailer/evince-thumbnailer.c: (main):
diff --git a/configure.ac b/configure.ac
index 3ba95e4..b94d9a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,16 +52,13 @@ KEYRING_REQUIRED=0.4.0
LIBGNOMEUI_REQUIRED=2.14.0
LIBGNOME_REQUIRED=2.14.0
-LIBGNOMEPRINTUI_REQUIRED=2.6.0
GNOME_ICON_THEME_REQUIRED=2.17.1
LIBXML_REQUIRED=2.5.0
-GTK_PRINT_REQUIRED=2.10.0
-
PKG_CHECK_MODULES(LIB, gtk+-2.0 >= $GTK_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED gio-2.0 >= $GLIB_REQUIRED)
PKG_CHECK_MODULES(BACKEND, gtk+-2.0 >= $GTK_REQUIRED)
PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-2.0 >= $GTK_REQUIRED libglade-2.0 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 libglade-2.0 gconf-2.0)
+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 libglade-2.0 gconf-2.0)
BACKEND_LIBTOOL_FLAGS="-module -avoid-version"
AC_SUBST(BACKEND_LIBTOOL_FLAGS)
@@ -106,55 +103,6 @@ fi
GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
AC_SUBST(GLIB_GENMARSHAL)
-dnl ========= Print support
-AC_ARG_WITH(print,
- [AC_HELP_STRING([--with-print=no/gtk/gnome/auto], [Compile with print support [default=auto]])],
- PRINT=$withval,
- PRINT="auto")
-
-PKG_CHECK_MODULES(GNOME_PRINT,
- libgnomeprintui-2.2 >= $LIBGNOMEPRINTUI_REQUIRED,
- enable_gnome_print=yes, enable_gnome_print=no)
-PKG_CHECK_MODULES(GTK_PRINT,
- gtk+-unix-print-2.0 >= $GTK_PRINT_REQUIRED,
- enable_gtk_print=yes, enable_gtk_print=no)
-enable_print=no
-if test x$PRINT = xgnome -a x$enable_gnome_print = xyes; then
- enable_print=gnome
-else
- if test x$PRINT = xgtk -a x$enable_gtk_print = xyes; then
- enable_print=gtk
- else
- if test x$PRINT = xauto; then
- if test x$enable_gtk_print = xyes; then
- enable_print=gtk
- else
- if test x$enable_gnome_print = xyes; then
- enable_print=gnome
- fi
- fi
- fi
- fi
-fi
-
-if test x$enable_print = xgnome; then
- AC_SUBST(GNOME_PRINT_CFLAGS)
- AC_SUBST(GNOME_PRINT_LIBS)
- AC_DEFINE([WITH_GNOME_PRINT],[1],[Enable GNOME Print Support.])
- AC_DEFINE([WITH_PRINT],[1],[Enable Print Support.])
-fi
-
-if test x$enable_print = xgtk; then
- AC_SUBST(GTK_PRINT_CFLAGS)
- AC_SUBST(GTK_PRINT_LIBS)
- AC_DEFINE([WITH_GTK_PRINT],[1],[Enable GTK Print Support.])
- AC_DEFINE([WITH_PRINT],[1],[Enable Print Support.])
-fi
-
-AM_CONDITIONAL(WITH_GNOME_PRINT, test x$enable_print = xgnome)
-AM_CONDITIONAL(WITH_GTK_PRINT, test x$enable_print = xgtk)
-
-
dnl ========= Check for DBUS
PKG_CHECK_MODULES([DBUS], [dbus-glib-1 >= $DBUS_GLIB_REQUIRED],
[enable_dbus=yes],[enable_dbus=no])
@@ -525,7 +473,6 @@ AC_OUTPUT
echo "
Configure summary:
GNOME Support......: $WITH_GNOME
- Print Support......: $enable_print
Keyring Support....: $WITH_KEYRING
DBUS Support.......: $enable_dbus
Nautilus Plugin....: $HAVE_NAUTILUS
diff --git a/shell/Makefile.am b/shell/Makefile.am
index b5883ed..f4b3e0a 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -11,9 +11,7 @@ INCLUDES= \
-DGNOMEICONDIR=\""$(datadir)/pixmaps"\" \
$(SHELL_CFLAGS) \
$(WARN_CFLAGS) \
- $(DISABLE_DEPRECATED) \
- $(GNOME_PRINT_CFLAGS) \
- $(GTK_PRINT_CFLAGS)
+ $(DISABLE_DEPRECATED)
bin_PROGRAMS=evince
@@ -87,13 +85,6 @@ evince_SOURCES= \
ev-transition-animation.h \
main.c
-if WITH_GNOME_PRINT
-evince_SOURCES+= \
- ev-print-job.c \
- ev-print-job.h
-endif
-
-
evince_LDADD= \
$(top_builddir)/cut-n-paste/zoom-control/libephyzoom.la \
$(top_builddir)/cut-n-paste/toolbar-editor/libtoolbareditor.la \
@@ -101,8 +92,7 @@ evince_LDADD= \
$(top_builddir)/cut-n-paste/gedit-message-area/libgeditmsgarea.la \
$(top_builddir)/properties/libevproperties.la \
$(top_builddir)/libdocument/libevbackend.la \
- $(SHELL_LIBS) \
- $(GNOME_PRINT_LIBS)
+ $(SHELL_LIBS)
BUILT_SOURCES = ev-marshal.h ev-marshal.c
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 6a4b240..d4a1d1f 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -59,12 +59,10 @@ struct _EvApplication {
gchar *last_chooser_uri;
-#ifdef WITH_GTK_PRINT
GtkPrintSettings *print_settings;
#if GTK_CHECK_VERSION (2, 11, 0)
gchar *print_settings_file;
#endif
-#endif
};
struct _EvApplicationClass {
@@ -638,7 +636,6 @@ ev_application_shutdown (EvApplication *application)
application->toolbars_file = NULL;
}
-#ifdef WITH_GTK_PRINT
#if GTK_CHECK_VERSION (2, 11, 0)
if (application->print_settings_file) {
if (application->print_settings) {
@@ -665,7 +662,6 @@ ev_application_shutdown (EvApplication *application)
application->print_settings = NULL;
}
#endif /* GTK 2.11.0 */
-#endif /* WITH_GTK_PRINT */
g_free (application->last_chooser_uri);
g_object_unref (application);
@@ -788,7 +784,6 @@ ev_application_screensaver_disable (EvApplication *application)
totem_scrsaver_disable (application->scr_saver);
}
-#ifdef WITH_GTK_PRINT
GtkPrintSettings *
ev_application_get_print_settings (EvApplication *application)
{
@@ -835,4 +830,4 @@ ev_application_set_print_settings (EvApplication *application,
application->print_settings = g_object_ref (settings);
}
-#endif /* WITH_GTK_PRINT */
+
diff --git a/shell/ev-application.h b/shell/ev-application.h
index 7b7588a..4525590 100644
--- a/shell/ev-application.h
+++ b/shell/ev-application.h
@@ -29,10 +29,7 @@
#include <glib/gerror.h>
#include <glib-object.h>
-
-#ifdef WITH_GTK_PRINT
#include <gtk/gtkprintsettings.h>
-#endif
#include "ev-window.h"
@@ -89,11 +86,9 @@ void ev_application_set_chooser_uri (EvApplication *application,
const gchar *ev_application_get_chooser_uri (EvApplication *application);
void ev_application_screensaver_enable (EvApplication *application);
void ev_application_screensaver_disable (EvApplication *application);
-#ifdef WITH_GTK_PRINT
GtkPrintSettings *ev_application_get_print_settings (EvApplication *application);
void ev_application_set_print_settings (EvApplication *application,
GtkPrintSettings *settings);
-#endif
G_END_DECLS
diff --git a/shell/ev-print-job.c b/shell/ev-print-job.c
deleted file mode 100644
index 39e334b..0000000
--- a/shell/ev-print-job.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/* this file is part of evince, a gnome document viewer
- *
- * Copyright (C) 2004 Martin Kretzschmar
- *
- * Author:
- * Martin Kretzschmar <martink@gnome.org>
- *
- * Evince is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Evince is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include <unistd.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <glib-object.h>
-
-/* for gnome_print_job_set_file */
-#define GNOME_PRINT_UNSTABLE_API
-#include <libgnomeprint/gnome-print-job.h>
-
-#include "ev-file-exporter.h"
-#include "ev-print-job.h"
-#include "ev-page-cache.h"
-
-#define EV_PRINT_JOB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EV_PRINT_JOB, EvPrintJobClass))
-#define EV_IS_PRINT_JOB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EV_PRINT_JOB))
-#define EV_PRINT_JOB_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), EV_PRINT_JOB, EvPrintJobClass))
-
-struct _EvPrintJob {
- GObject parent_instance;
-
- EvDocument *document;
- GnomePrintJob *gnome_print_job;
- EvFileExporterContext fc;
- int copies;
- int collate;
-
- int fd;
- char *temp_file;
- guint idle_id;
- gboolean printing;
- int next_page;
- int copies_done;
- int shift;
-};
-
-struct _EvPrintJobClass {
- GObjectClass parent_class;
-};
-
-enum {
- PROP_0,
- PROP_GNOME_PRINT_JOB,
- PROP_DOCUMENT,
- PROP_PRINT_DIALOG
-};
-
-G_DEFINE_TYPE (EvPrintJob, ev_print_job, G_TYPE_OBJECT);
-
-static void
-ev_print_job_finalize (GObject *object)
-{
- EvPrintJob *job = EV_PRINT_JOB (object);
-
- if (job && job->document) {
- g_object_unref (job->document);
- job->document = NULL;
- }
-
- if (job && job->gnome_print_job) {
- g_object_unref (job->gnome_print_job);
- job->gnome_print_job = NULL;
- }
-
- G_OBJECT_CLASS (ev_print_job_parent_class)->finalize (object);
-}
-
-static void
-ev_print_job_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec)
-{
- EvPrintJob *job;
-
- job = EV_PRINT_JOB (object);
-
- switch (prop_id) {
- case PROP_GNOME_PRINT_JOB:
- ev_print_job_set_gnome_print_job (
- job, GNOME_PRINT_JOB (g_value_get_object (value)));
- break;
- case PROP_DOCUMENT:
- ev_print_job_set_document (job, EV_DOCUMENT (g_value_get_object (value)));
- break;
- case PROP_PRINT_DIALOG:
- ev_print_job_use_print_dialog_settings (
- job, GNOME_PRINT_DIALOG (g_value_get_object (value)));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-
-}
-
-static void
-ev_print_job_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
-{
- EvPrintJob *job;
-
- job = EV_PRINT_JOB (object);
-
- switch (prop_id) {
- case PROP_GNOME_PRINT_JOB:
- g_value_set_object (value, job->gnome_print_job);
- break;
- case PROP_DOCUMENT:
- g_value_set_object (value, job->document);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static void
-ev_print_job_class_init (EvPrintJobClass *ev_print_job_class)
-{
- GObjectClass *g_object_class;
-
- g_object_class = G_OBJECT_CLASS (ev_print_job_class);
-
- g_object_class->finalize = ev_print_job_finalize;
- g_object_class->set_property = ev_print_job_set_property;
- g_object_class->get_property = ev_print_job_get_property;
-
- g_object_class_install_property (g_object_class,
- PROP_GNOME_PRINT_JOB,
- g_param_spec_object ("gnome_print_job",
- "GnomePrintJob",
- "GnomePrintJob",
- GNOME_TYPE_PRINT_JOB,
- G_PARAM_READWRITE));
- g_object_class_install_property (g_object_class,
- PROP_DOCUMENT,
- g_param_spec_object ("document",
- "Document object",
- "Document from which to print",
- G_TYPE_OBJECT, /* EV_TYPE_DOCUMENT, */
- G_PARAM_READWRITE));
- g_object_class_install_property (g_object_class,
- PROP_PRINT_DIALOG,
- g_param_spec_object ("print_dialog",
- "GnomePrintDialog",
- "GnomePrintDialog with user settings",
- GNOME_TYPE_PRINT_DIALOG,
- G_PARAM_WRITABLE));
-
-}
-
-static void
-ev_print_job_init (EvPrintJob *ev_print_job)
-{
- ev_print_job->fc.pages_per_sheet = 1;
-}
-
-void
-ev_print_job_set_gnome_print_job (EvPrintJob *job, GnomePrintJob *gpj)
-{
- g_return_if_fail (EV_IS_PRINT_JOB (job));
-
- if (job->gnome_print_job == gpj)
- return;
-
- if (job->gnome_print_job)
- g_object_unref (job->gnome_print_job);
-
- if (gpj)
- g_object_ref (gpj);
-
- job->gnome_print_job = gpj;
-}
-
-void
-ev_print_job_set_document (EvPrintJob *job, EvDocument *document)
-{
- g_return_if_fail (EV_IS_PRINT_JOB (job));
-
- if (job->document == document)
- return;
-
- if (job->document)
- g_object_ref (job->document);
-
- if (document)
- g_object_ref (document);
-
- job->document = document;
-}
-
-void
-ev_print_job_use_print_dialog_settings (EvPrintJob *job, GnomePrintDialog *dialog)
-{
- GnomePrintConfig *print_config;
- EvPageCache *page_cache = ev_page_cache_get (job->document);
- gint first_page, last_page;
-
- g_return_if_fail (EV_IS_PRINT_JOB (job));
- g_return_if_fail (GNOME_IS_PRINT_DIALOG (dialog));
-
- print_config = gnome_print_dialog_get_config (dialog);
- gnome_print_dialog_get_copies (dialog, &job->copies, &job->collate);
- gnome_print_config_get_page_size (print_config,
- &job->fc.paper_width, &job->fc.paper_height);
- gnome_print_config_get_boolean (print_config,
- (guchar *)GNOME_PRINT_KEY_DUPLEX, &job->fc.duplex);
-
- page_cache = ev_page_cache_get (job->document);
-
- /* get the printing ranges */
- switch (gnome_print_dialog_get_range (dialog)) {
- case GNOME_PRINT_RANGE_ALL:
- first_page = 0;
- last_page = ev_page_cache_get_n_pages (page_cache) - 1;
- break;
- case GNOME_PRINT_RANGE_RANGE:
- gnome_print_dialog_get_range_page (dialog, &first_page, &last_page);
- /* convert 1-based user interface to 0-based internal numbers */
- first_page--;
- last_page--;
- break;
- default:
- g_assert_not_reached ();
- }
-
- job->fc.first_page = MIN (first_page, last_page);
- job->fc.last_page = MAX (first_page, last_page);
-
- gnome_print_config_unref (print_config);
-}
-
-static gboolean
-idle_print_handler (EvPrintJob *job)
-{
- if (!job->printing) {
- ev_document_doc_mutex_lock ();
- ev_file_exporter_begin (EV_FILE_EXPORTER (job->document),
- &(job->fc));
- ev_document_doc_mutex_unlock ();
- job->next_page = job->fc.first_page;
- job->shift = (job->fc.first_page > job->fc.last_page) ? -1 : 1;
- job->printing = TRUE;
- return TRUE;
- }
-
- if ((job->next_page - job->fc.last_page) * job->shift <= 0) {
- EvRenderContext *rc;
-#if 0
- g_printerr ("Printing page %d\n", job->next_page);
-#endif
- rc = ev_render_context_new (0, job->next_page, 1.0);
-
- ev_document_doc_mutex_lock ();
- ev_file_exporter_do_page (EV_FILE_EXPORTER (job->document), rc);
- ev_document_doc_mutex_unlock ();
-
- g_object_unref (rc);
-
- if (job->collate) {
- /* collate must repeat the same page */
- job->copies_done++;
- if(job->copies == job->copies_done) {
- job->next_page += job->shift;
- job->copies_done = 0;
- }
- } else {
- job->next_page += job->shift;
- if ((job->next_page - job->fc.last_page) * job->shift > 0){
- job->copies_done++;
- if(job->copies_done < job->copies) {
- /* more copies to go, restart to the first page */
- job->next_page = job->fc.first_page;
- }
- }
- }
- return TRUE;
- } else { /* no more pages or copies */
- ev_document_doc_mutex_lock ();
- ev_file_exporter_end (EV_FILE_EXPORTER (job->document));
- ev_document_doc_mutex_unlock ();
-
- close (job->fd);
- job->fd = 0;
-
- gnome_print_job_print (job->gnome_print_job);
-
- unlink (job->temp_file);
- g_free (job->temp_file);
-
- g_object_unref (job->gnome_print_job);
- job->gnome_print_job = NULL;
-
- job->printing = FALSE;
- job->idle_id = 0;
- return FALSE;
- }
-}
-
-static void
-print_closure_finalize (EvPrintJob *job, GClosure *closure)
-{
- g_object_unref (job);
-}
-
-void
-ev_print_job_print (EvPrintJob *job, GtkWindow *parent)
-{
- GClosure *closure;
- GSource *idle_source;
-
- g_return_if_fail (EV_IS_PRINT_JOB (job));
- g_return_if_fail (job->document != NULL);
- g_return_if_fail (EV_IS_FILE_EXPORTER (job->document));
-#if 0
- g_printerr ("Printing...\n");
-#endif
-
- job->fd = g_file_open_tmp ("evince_print.ps.XXXXXX", &job->temp_file, NULL);
- if (job->fd <= -1)
- return; /* FIXME use GError */
-
- job->fc.format = EV_FILE_FORMAT_PS;
- job->fc.filename = job->temp_file;
- gnome_print_job_set_file (job->gnome_print_job, job->temp_file);
-
- g_object_ref (job);
- closure = g_cclosure_new (G_CALLBACK (idle_print_handler), job, NULL);
- g_closure_add_finalize_notifier (
- closure, job, (GClosureNotify)print_closure_finalize);
-
- idle_source = g_idle_source_new ();
- g_source_set_closure (idle_source, closure);
- job->idle_id = g_source_attach (idle_source, NULL);
- g_source_unref (idle_source);
-}
diff --git a/shell/ev-print-job.h b/shell/ev-print-job.h
deleted file mode 100644
index 30a1430..0000000
--- a/shell/ev-print-job.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* this file is part of evince, a gnome document viewer
- *
- * Copyright (C) 2004 Martin Kretzschmar
- *
- * Author:
- * Martin Kretzschmar <martink@gnome.org>
- *
- * Evince is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Evince is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * 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.
- */
-
-#ifndef EV_PRINT_JOB_H
-#define EV_PRINT_JOB_H
-
-#include <glib-object.h>
-#include <gtk/gtk.h>
-#include <libgnomeprintui/gnome-print-dialog.h>
-
-#include "ev-document.h"
-
-G_BEGIN_DECLS
-
-typedef struct _EvPrintJob EvPrintJob;
-typedef struct _EvPrintJobClass EvPrintJobClass;
-
-#define EV_TYPE_PRINT_JOB (ev_print_job_get_type())
-#define EV_PRINT_JOB(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_PRINT_JOB, EvPrintJob))
-#define EV_IS_PRINT_JOB(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_PRINT_JOB))
-
-GType ev_print_job_get_type (void);
-void ev_print_job_set_gnome_print_job (EvPrintJob *job, GnomePrintJob *gpj);
-void ev_print_job_set_document (EvPrintJob *job, EvDocument *document);
-void ev_print_job_use_print_dialog_settings (EvPrintJob *job, GnomePrintDialog *dialog);
-void ev_print_job_print (EvPrintJob *job, GtkWindow *parent);
-
-G_END_DECLS
-
-#endif /* !EV_PRINT_JOB_H */
diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c
index cbe19b1..f623f1e 100644
--- a/shell/ev-sidebar-links.c
+++ b/shell/ev-sidebar-links.c
@@ -323,10 +323,7 @@ print_section_cb (GtkWidget *menuitem, EvSidebarLinks *sidebar)
window = gtk_widget_get_toplevel (GTK_WIDGET (sidebar));
if (EV_IS_WINDOW (window)) {
-#ifdef WITH_PRINT
- ev_window_print_range (EV_WINDOW (window),
- first_page, last_page);
-#endif
+ ev_window_print_range (EV_WINDOW (window), first_page, last_page);
}
}
}
diff --git a/shell/ev-utils.c b/shell/ev-utils.c
index 42d81f9..13f1459 100644
--- a/shell/ev-utils.c
+++ b/shell/ev-utils.c
@@ -27,8 +27,6 @@
#include <math.h>
#include <glib/gi18n.h>
-#define PRINT_CONFIG_FILENAME "ev-print-config.xml"
-
typedef struct
{
int size;
@@ -213,98 +211,6 @@ ev_print_region_contents (GdkRegion *region)
g_free (rectangles);
}
-#ifdef WITH_GNOME_PRINT
-gboolean
-using_pdf_printer (GnomePrintConfig *config)
-{
- const guchar *driver;
-
- driver = gnome_print_config_get (
- config, (const guchar *)"Settings.Engine.Backend.Driver");
-
- if (driver) {
- if (!strcmp ((const gchar *)driver, "gnome-print-pdf"))
- return TRUE;
- else
- return FALSE;
- }
-
- return FALSE;
-}
-
-gboolean
-using_postscript_printer (GnomePrintConfig *config)
-{
- const guchar *driver;
- const guchar *transport;
-
- driver = gnome_print_config_get (
- config, (const guchar *)"Settings.Engine.Backend.Driver");
-
- transport = gnome_print_config_get (
- config, (const guchar *)"Settings.Transport.Backend");
-
- if (driver) {
- if (!strcmp ((const gchar *)driver, "gnome-print-ps"))
- return TRUE;
- else
- return FALSE;
- } else if (transport) { /* these transports default to PostScript */
- if (!strcmp ((const gchar *)transport, "CUPS"))
- return TRUE;
- else if (!strcmp ((const gchar *)transport, "LPD"))
- return TRUE;
- else if (!strcmp ((const gchar *)transport, "PAPI"))
- return TRUE;
- }
-
- return FALSE;
-}
-
-GnomePrintConfig *
-load_print_config_from_file (void)
-{
- GnomePrintConfig *print_config = NULL;
- char *file_name, *contents = NULL;
-
- file_name = g_build_filename (ev_dot_dir (), PRINT_CONFIG_FILENAME,
- NULL);
-
- if (g_file_get_contents (file_name, &contents, NULL, NULL)) {
- print_config = gnome_print_config_from_string (contents, 0);
- g_free (contents);
- }
-
- if (print_config == NULL) {
- print_config = gnome_print_config_default ();
- }
-
- g_free (file_name);
-
- return print_config;
-}
-
-void
-save_print_config_to_file (GnomePrintConfig *config)
-{
- char *file_name, *str;
-
- g_return_if_fail (config != NULL);
-
- str = gnome_print_config_to_string (config, 0);
- if (str == NULL) return;
-
- file_name = g_build_filename (ev_dot_dir (),
- PRINT_CONFIG_FILENAME,
- NULL);
-
- g_file_set_contents (file_name, str, -1, NULL);
-
- g_free (file_name);
- g_free (str);
-}
-#endif /* WITH_GNOME_PRINT */
-
static void
ev_gui_sanitise_popup_position (GtkMenu *menu,
GtkWidget *widget,
diff --git a/shell/ev-utils.h b/shell/ev-utils.h
index ed333d2..f7c58a7 100644
--- a/shell/ev-utils.h
+++ b/shell/ev-utils.h
@@ -23,9 +23,6 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
-#ifdef WITH_GNOME_PRINT
-#include <libgnomeprintui/gnome-print-dialog.h>
-#endif
G_BEGIN_DECLS
@@ -40,12 +37,6 @@ void ev_gui_menu_position_tree_selection (GtkMenu *menu,
gboolean *push_in,
gpointer user_data);
-#ifdef WITH_GNOME_PRINT
-GnomePrintConfig* load_print_config_from_file (void);
-void save_print_config_to_file (GnomePrintConfig *config);
-gboolean using_postscript_printer (GnomePrintConfig *config);
-gboolean using_pdf_printer (GnomePrintConfig *config);
-#endif
gint get_num_monitors (GtkWindow * window);
gdouble get_screen_dpi (GtkWindow * window);
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 4684f79..dc8ac94 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -67,14 +67,7 @@
#include "ev-image.h"
#include "ev-message-area.h"
-#ifdef WITH_GNOME_PRINT
-#include "ev-print-job.h"
-#include <libgnomeprintui/gnome-print-dialog.h>
-#endif
-
-#ifdef WITH_GTK_PRINT
#include <gtk/gtkprintunixdialog.h>
-#endif
#ifdef ENABLE_PDF
#include <poppler.h>
@@ -128,9 +121,7 @@ struct _EvWindowPrivate {
/* Dialogs */
GtkWidget *properties;
-#ifdef WITH_PRINT
GtkWidget *print_dialog;
-#endif
GtkWidget *password_dialog;
/* UI Builders */
@@ -174,21 +165,18 @@ struct _EvWindowPrivate {
EvWindowPageMode page_mode;
EvWindowTitle *title;
- EvJob *load_job;
- EvJob *thumbnail_job;
- EvJob *save_job;
-#ifdef WITH_GNOME_PRINT
- GnomePrintJob *print_job;
-#endif
-
-#ifdef WITH_GTK_PRINT
+ EvJob *load_job;
+ EvJob *thumbnail_job;
+ EvJob *save_job;
EvJob *print_job;
+
+ /* Printing */
gboolean print_preview;
GtkPrintJob *gtk_print_job;
GtkPrinter *printer;
GtkPrintSettings *print_settings;
GtkPageSetup *print_page_setup;
-#endif
+
};
#define EV_WINDOW_GET_PRIVATE(object) \
@@ -209,7 +197,6 @@ struct _EvWindowPrivate {
#define THUMBNAILS_SIDEBAR_ID "thumbnails"
#define ATTACHMENTS_SIDEBAR_ID "attachments"
-#ifdef WITH_GTK_PRINT
static const gchar *document_print_settings[] = {
GTK_PRINT_SETTINGS_N_COPIES,
GTK_PRINT_SETTINGS_COLLATE,
@@ -220,7 +207,6 @@ static const gchar *document_print_settings[] = {
GTK_PRINT_SETTINGS_PAGE_RANGES,
GTK_PRINT_SETTINGS_PAGE_SET
};
-#endif /* WITH_GTK_PRINT */
static void ev_window_update_actions (EvWindow *ev_window);
static void ev_window_sidebar_visibility_changed_cb (EvSidebar *ev_sidebar,
@@ -232,10 +218,8 @@ static void ev_window_load_job_cb (EvJobLoad *job,
gpointer data);
static void ev_window_set_icon_from_thumbnail (EvJobThumbnail *job,
EvWindow *ev_window);
-#ifdef WITH_GTK_PRINT
static void ev_window_print_job_cb (EvJobPrint *job,
EvWindow *window);
-#endif
static void ev_window_save_job_cb (EvJobSave *save,
EvWindow *window);
static void ev_window_sizing_mode_changed_cb (EvView *view,
@@ -281,6 +265,7 @@ static void ev_window_cmd_edit_find (GtkAction *actio
static void find_bar_search_changed_cb (EggFindBar *find_bar,
GParamSpec *param,
EvWindow *ev_window);
+static void ev_window_do_preview_print (EvWindow *window);
G_DEFINE_TYPE (EvWindow, ev_window, GTK_TYPE_WINDOW)
@@ -353,24 +338,13 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window)
if (gconf_client_get_bool (client, GCONF_LOCKDOWN_PRINT, NULL)) {
ok_to_print = FALSE;
}
-#ifndef WITH_PRINT
- ok_to_print = FALSE;
-#endif
- g_object_unref (client);
+ g_object_unref (client);
/* File menu */
ev_window_set_action_sensitive (ev_window, "FileOpenCopy", has_document);
ev_window_set_action_sensitive (ev_window, "FileSaveAs", has_document && ok_to_copy);
-
-#ifdef WITH_GTK_PRINT
ev_window_set_action_sensitive (ev_window, "FilePrintSetup", has_pages && ok_to_print);
-#endif
-
-#ifdef WITH_GNOME_PRINT
- ev_window_set_action_sensitive (ev_window, "FilePrintSetup", FALSE);
-#endif
-
ev_window_set_action_sensitive (ev_window, "FilePrint", has_pages && ok_to_print);
ev_window_set_action_sensitive (ev_window, "FileProperties", has_document && has_properties);
@@ -1441,17 +1415,9 @@ ev_window_close_dialogs (EvWindow *ev_window)
gtk_widget_destroy (ev_window->priv->password_dialog);
ev_window->priv->password_dialog = NULL;
-#ifdef WITH_PRINT
if (ev_window->priv->print_dialog)
gtk_widget_destroy (ev_window->priv->print_dialog);
ev_window->priv->print_dialog = NULL;
-#endif
-
-#ifdef WITH_GNOME_PRINT
- if (ev_window->priv->print_job)
- g_object_unref (ev_window->priv->print_job);
- ev_window->priv->print_job = NULL;
-#endif
if (ev_window->priv->properties)
gtk_widget_destroy (ev_window->priv->properties);
@@ -2031,7 +1997,6 @@ ev_window_cmd_save_as (GtkAction *action, EvWindow *ev_window)
gtk_widget_show (fc);
}
-#ifdef WITH_GTK_PRINT
static void
ev_window_print_page_setup_done_cb (GtkPageSetup *page_setup,
EvWindow *window)
@@ -2044,22 +2009,18 @@ ev_window_print_page_setup_done_cb (GtkPageSetup *page_setup,
g_object_unref (window->priv->print_page_setup);
window->priv->print_page_setup = g_object_ref (page_setup);
}
-#endif /* WITH_GTK_PRINT */
static void
ev_window_cmd_file_print_setup (GtkAction *action, EvWindow *ev_window)
{
-#ifdef WITH_GTK_PRINT
gtk_print_run_page_setup_dialog_async (
GTK_WINDOW (ev_window),
ev_window->priv->print_page_setup,
ev_window->priv->print_settings,
(GtkPageSetupDoneFunc) ev_window_print_page_setup_done_cb,
ev_window);
-#endif /* WITH_GTK_PRINT */
}
-#ifdef WITH_GTK_PRINT
static void
ev_window_clear_print_job (EvWindow *window)
{
@@ -2442,124 +2403,6 @@ ev_window_print_range (EvWindow *ev_window, int first_page, int last_page)
gtk_widget_show (dialog);
}
-#endif /* WITH_GTK_PRINT */
-
-#ifdef WITH_GNOME_PRINT
-static gboolean
-ev_window_print_dialog_response_cb (GtkDialog *print_dialog,
- gint response,
- EvWindow *ev_window)
-{
- EvPrintJob *print_job;
- GnomePrintConfig *config;
-
- if (response != GNOME_PRINT_DIALOG_RESPONSE_PRINT) {
- gtk_widget_destroy (GTK_WIDGET (print_dialog));
- ev_window->priv->print_dialog = NULL;
- g_object_unref (ev_window->priv->print_job);
- ev_window->priv->print_job = NULL;
-
- return FALSE;
- }
-
- config = gnome_print_dialog_get_config (GNOME_PRINT_DIALOG (print_dialog));
-
- /* FIXME: Change this when we have the first backend
- * that can print more than postscript
- */
- if (using_pdf_printer (config)) {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (print_dialog), GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
- _("Generating PDF is not supported"));
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-
- return FALSE;
- } else if (!using_postscript_printer (config)) {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (print_dialog), GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
- _("Printing is not supported on this printer."));
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- _("You were trying to print to a printer using the ā€œ%sā€ driver. "
- "This program requires a PostScript printer driver."),
- gnome_print_config_get (config, (guchar *)"Settings.Engine.Backend.Driver"));
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-
- return FALSE;
- }
-
- save_print_config_to_file (config);
-
- print_job = g_object_new (EV_TYPE_PRINT_JOB,
- "gnome_print_job", ev_window->priv->print_job,
- "document", ev_window->priv->document,
- "print_dialog", print_dialog,
- NULL);
-
- if (print_job != NULL) {
- ev_print_job_print (print_job, GTK_WINDOW (ev_window));
- g_object_unref (print_job);
- }
-
- g_object_unref (config);
-
- gtk_widget_destroy (GTK_WIDGET (print_dialog));
- ev_window->priv->print_dialog = NULL;
- g_object_unref (ev_window->priv->print_job);
- ev_window->priv->print_job = NULL;
-
- return FALSE;
-}
-
-void
-ev_window_print_range (EvWindow *ev_window, int first_page, int last_page)
-{
- GnomePrintConfig *config;
- gchar *pages_label;
-
- g_return_if_fail (EV_IS_WINDOW (ev_window));
- g_return_if_fail (ev_window->priv->document != NULL);
-
- config = load_print_config_from_file ();
-
- if (ev_window->priv->print_job == NULL)
- ev_window->priv->print_job = gnome_print_job_new (config);
-
- if (ev_window->priv->print_dialog == NULL) {
- ev_window->priv->print_dialog =
- gnome_print_dialog_new (ev_window->priv->print_job,
- (guchar *) _("Print"),
- (GNOME_PRINT_DIALOG_RANGE |
- GNOME_PRINT_DIALOG_COPIES));
- }
-
- gtk_window_set_transient_for (GTK_WINDOW (ev_window->priv->print_dialog),
- GTK_WINDOW (ev_window));
- g_object_unref (config);
-
- pages_label = g_strconcat (_("Pages"), " ", NULL);
- gnome_print_dialog_construct_range_page (GNOME_PRINT_DIALOG (ev_window->priv->print_dialog),
- GNOME_PRINT_RANGE_ALL |
- GNOME_PRINT_RANGE_RANGE,
- first_page, last_page,
- NULL, (const guchar *)pages_label);
- g_free (pages_label);
-
- gtk_dialog_set_response_sensitive (GTK_DIALOG (ev_window->priv->print_dialog),
- GNOME_PRINT_DIALOG_RESPONSE_PREVIEW,
- FALSE);
-
- g_signal_connect (G_OBJECT (ev_window->priv->print_dialog), "response",
- G_CALLBACK (ev_window_print_dialog_response_cb),
- ev_window);
- gtk_widget_show (ev_window->priv->print_dialog);
-}
-#endif /* WITH_GNOME_PRINT */
static void
ev_window_print (EvWindow *window)
@@ -2570,9 +2413,7 @@ ev_window_print (EvWindow *window)
page_cache = ev_page_cache_get (window->priv->document);
last_page = ev_page_cache_get_n_pages (page_cache);
-#ifdef WITH_PRINT
ev_window_print_range (window, 1, last_page);
-#endif
}
static void
@@ -3338,9 +3179,6 @@ ev_window_cmd_start_presentation (GtkAction *action, EvWindow *window)
ev_window_run_presentation (window);
}
-#ifdef WITH_GTK_PRINT
-static void ev_window_do_preview_print (EvWindow *window);
-
static gboolean
ev_window_enumerate_printer_cb (GtkPrinter *printer,
EvWindow *window)
@@ -3432,12 +3270,9 @@ ev_window_do_preview_print (EvWindow *window)
gtk_widget_hide (GTK_WIDGET (window));
}
-#endif /* WITH_GTK_PRINT */
-
static void
ev_window_cmd_preview_print (GtkAction *action, EvWindow *window)
{
-#ifdef WITH_GTK_PRINT
EvWindowPrivate *priv = window->priv;
GtkPrintSettings *print_settings = NULL;
#if GTK_CHECK_VERSION (2, 11, 0)
@@ -3468,7 +3303,6 @@ ev_window_cmd_preview_print (GtkAction *action, EvWindow *window)
gtk_enumerate_printers ((GtkPrinterFunc) ev_window_enumerate_printer_cb,
window, NULL, FALSE);
-#endif /* WITH_GTK_PRINT */
}
static void
@@ -4165,8 +3999,6 @@ ev_window_dispose (GObject *object)
}
ev_window_close_dialogs (window);
-
-#ifdef WITH_GTK_PRINT
ev_window_clear_print_job (window);
if (window->priv->gtk_print_job) {
@@ -4188,7 +4020,6 @@ ev_window_dispose (GObject *object)
g_object_unref (window->priv->print_page_setup);
window->priv->print_page_setup = NULL;
}
-#endif
if (priv->link) {
g_object_unref (priv->link);
diff --git a/shell/ev-window.h b/shell/ev-window.h
index 863f543..3680bbf 100644
--- a/shell/ev-window.h
+++ b/shell/ev-window.h
@@ -82,12 +82,10 @@ void ev_window_open_uri (EvWindow *ev_window,
gboolean unlink_temp_file,
const gchar *print_settings);
gboolean ev_window_is_empty (const EvWindow *ev_window);
-
-#ifdef WITH_PRINT
void ev_window_print_range (EvWindow *ev_window,
int first_page,
int last_page);
-#endif
+
G_END_DECLS
#endif /* !EV_WINDOW_H */