From f2511820a5499da40ae972bc833616a176d78f8f Mon Sep 17 00:00:00 2001 From: Nickolay V. Shmyrev Date: Fri, 10 Feb 2006 04:36:12 +0000 Subject: Make printing support optional. Patch from Eduardo de Barros Lima * configure.ac: * shell/Makefile.am: * shell/ev-sidebar-links.c: (print_section_cb): * shell/ev-utils.c: * shell/ev-utils.h: * shell/ev-window.c: (update_action_sensitivity), (ev_window_close_dialogs), (ev_window_print): * shell/ev-window.h: Make printing support optional. Patch from Eduardo de Barros Lima for the bug #330546. --- (limited to 'shell') diff --git a/shell/Makefile.am b/shell/Makefile.am index 0fed805..26b195e 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -10,7 +10,8 @@ INCLUDES= \ -DGNOMELOCALEDIR=\"$(datadir)/locale\" \ -DGNOMEICONDIR=\""$(datadir)/pixmaps"\" \ $(SHELL_CFLAGS) \ - $(WARN_CFLAGS) + $(WARN_CFLAGS) \ + $(GNOME_PRINT_CFLAGS) bin_PROGRAMS=evince @@ -41,8 +42,6 @@ evince_SOURCES= \ ev-password-view.c \ ev-pixbuf-cache.c \ ev-pixbuf-cache.h \ - ev-print-job.c \ - ev-print-job.h \ ev-properties-dialog.c \ ev-properties-dialog.h \ ev-properties-fonts.c \ @@ -70,13 +69,21 @@ evince_SOURCES= \ ev-stock-icons.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/recent-files/librecent.la \ $(top_builddir)/cut-n-paste/zoom-control/libephyzoom.la \ $(top_builddir)/cut-n-paste/toolbar-editor/libtoolbareditor.la \ $(top_builddir)/properties/libevproperties.la \ - $(top_builddir)/lib/libev.la \ - $(SHELL_LIBS) + $(top_builddir)/lib/libev.la \ + $(SHELL_LIBS) \ + $(GNOME_PRINT_LIBS) BUILT_SOURCES = ev-marshal.h ev-marshal.c diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c index ac728ed..386cdd5 100644 --- a/shell/ev-sidebar-links.c +++ b/shell/ev-sidebar-links.c @@ -299,8 +299,10 @@ print_section_cb (GtkWidget *menuitem, EvSidebarLinks *sidebar) window = gtk_widget_get_toplevel (GTK_WIDGET (sidebar)); if (EV_IS_WINDOW (window)) { +#ifdef WITH_GNOME_PRINT ev_window_print_range (EV_WINDOW (window), first_page, last_page); +#endif } } } diff --git a/shell/ev-utils.c b/shell/ev-utils.c index 7508786..3dc849c 100644 --- a/shell/ev-utils.c +++ b/shell/ev-utils.c @@ -420,6 +420,7 @@ ev_file_set_contents (const gchar *filename, #endif /* HAVE_G_FILE_SET_CONTENTS */ +#ifdef WITH_GNOME_PRINT gboolean using_pdf_printer (GnomePrintConfig *config) { @@ -511,5 +512,6 @@ save_print_config_to_file (GnomePrintConfig *config) g_free (file_name); g_free (str); } +#endif /* WITH_GNOME_PRINT */ diff --git a/shell/ev-utils.h b/shell/ev-utils.h index fbacb0f..1d7e882 100644 --- a/shell/ev-utils.h +++ b/shell/ev-utils.h @@ -23,7 +23,9 @@ #include #include +#ifdef WITH_GNOME_PRINT #include +#endif G_BEGIN_DECLS @@ -32,11 +34,12 @@ GdkPixbuf* ev_pixbuf_add_shadow (GdkPixbuf *src, int size, void ev_print_region_contents (GdkRegion *region); - +#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 G_END_DECLS diff --git a/shell/ev-window.c b/shell/ev-window.c index 5424c6a..60479ba 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -37,7 +37,6 @@ #include "ev-view.h" #include "ev-password.h" #include "ev-password-view.h" -#include "ev-print-job.h" #include "ev-properties-dialog.h" #include "ev-ps-exporter.h" #include "ev-document-thumbnails.h" @@ -65,12 +64,16 @@ #include "ev-utils.h" #include "ev-debug.h" +#ifdef WITH_GNOME_PRINT +#include "ev-print-job.h" +#include +#endif + #include #include #include #include -#include #include #include @@ -108,7 +111,9 @@ struct _EvWindowPrivate { /* Dialogs */ GtkWidget *properties; +#ifdef WITH_GNOME_PRINT GtkWidget *print_dialog; +#endif GtkWidget *password_dialog; /* UI Builders */ @@ -139,7 +144,9 @@ struct _EvWindowPrivate { /* Job used to load document */ EvJob *xfer_job; EvJob *load_job; +#ifdef WITH_GNOME_PRINT GnomePrintJob *print_job; +#endif }; static const GtkTargetEntry ev_drop_types[] = { @@ -275,6 +282,10 @@ update_action_sensitivity (EvWindow *ev_window) ok_to_copy_text = ev_view_get_has_selection (view); } +#ifndef WITH_GNOME_PRINT + ok_to_print = FALSE; +#endif + /* File menu */ /* "FileOpen": always sensitive */ set_action_sensitive (ev_window, "FileSaveAs", has_document && ok_to_copy); @@ -1047,12 +1058,14 @@ ev_window_close_dialogs (EvWindow *ev_window) gtk_widget_destroy (ev_window->priv->password_dialog); ev_window->priv->password_dialog = NULL; +#ifdef WITH_GNOME_PRINT if (ev_window->priv->print_dialog) { gtk_widget_destroy (ev_window->priv->print_dialog); g_object_unref (ev_window->priv->print_job); } ev_window->priv->print_dialog = NULL; ev_window->priv->print_job = NULL; +#endif if (ev_window->priv->properties) gtk_widget_destroy (ev_window->priv->properties); @@ -1261,10 +1274,13 @@ 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_GNOME_PRINT ev_window_print_range (window, 1, last_page); +#endif } +#ifdef WITH_GNOME_PRINT static gboolean ev_window_print_dialog_response_cb (GtkDialog *print_dialog, gint response, gpointer data) { @@ -1368,6 +1384,7 @@ ev_window_print_range (EvWindow *ev_window, int first_page, int last_page) gtk_widget_show (ev_window->priv->print_dialog); return; } +#endif /* WITH_GNOME_PRINT */ static void ev_window_cmd_file_print (GtkAction *action, EvWindow *ev_window) diff --git a/shell/ev-window.h b/shell/ev-window.h index 0368f80..fb6234d 100644 --- a/shell/ev-window.h +++ b/shell/ev-window.h @@ -59,9 +59,11 @@ void ev_window_open_uri (EvWindow *ev_window, void ev_window_open_page_label (EvWindow *ev_window, const char *label); gboolean ev_window_is_empty (const EvWindow *ev_window); +#ifdef WITH_GNOME_PRINT void ev_window_print_range (EvWindow *ev_window, int first_page, int last_page); +#endif G_END_DECLS #endif /* !EV_WINDOW_H */ -- cgit v0.9.1