]> www.fi.muni.cz Git - evince.git/commitdiff
(using_pdf_printer): new function.
authorMartin Kretzschmar <martink@src.gnome.org>
Mon, 25 Jul 2005 20:25:15 +0000 (20:25 +0000)
committerMartin Kretzschmar <martink@src.gnome.org>
Mon, 25 Jul 2005 20:25:15 +0000 (20:25 +0000)
(ev_window_print_range): print a less techy message if someone
tries to print to PDF.

ChangeLog
shell/ev-window.c

index b80c16b8ccafb085b4e7e1b41a41d0dc3ff685f7..dd939138f0e1469c6f0481ce80a133177a00d9ff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-07-25  Martin Kretzschmar  <martink@gnome.org>
+
+       * shell/ev-window.c (using_pdf_printer): new function.
+       (ev_window_print_range): print a less techy message if someone
+       tries to print to PDF.
+
 2005-07-25  Martin Kretzschmar  <martink@gnome.org>
 
        * pdf/ev-poppler.cc (font_type_to_string): Remove trailing space
index 1982f8cb623081380ac5edd687f7e0e04bce1c8b..ea2cf73a547b087f4131b69d20e07d910da46a4f 100644 (file)
@@ -1251,6 +1251,24 @@ ev_window_cmd_save_as (GtkAction *action, EvWindow *ev_window)
        gtk_widget_destroy (fc);
 }
 
+static 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;
+}
+
 static gboolean
 using_postscript_printer (GnomePrintConfig *config)
 {
@@ -1268,7 +1286,7 @@ using_postscript_printer (GnomePrintConfig *config)
                        return TRUE;
                else
                        return FALSE;
-       } else  if (transport) {
+       } else  if (transport) { /* these transports default to PostScript */
                if (!strcmp ((const gchar *)transport, "CUPS"))
                        return TRUE;
                else if (!strcmp ((const gchar *)transport, "LPD"))
@@ -1343,7 +1361,18 @@ ev_window_print_range (EvWindow *ev_window, int first_page, int last_page)
                /* FIXME: Change this when we have the first backend
                 * that can print more than postscript
                 */
-               if (!using_postscript_printer (config)) {
+               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);
+                       
+                       continue;
+               } else if (!using_postscript_printer (config)) {
                        GtkWidget *dialog;
 
                        dialog = gtk_message_dialog_new (