From f01ae4b51169460be1bdb8139ce60a56fb9269eb Mon Sep 17 00:00:00 2001 From: Martin Kretzschmar Date: Mon, 25 Jul 2005 20:26:40 +0000 Subject: (using_pdf_printer): new function. (ephy_print_verify_postscript): print a less techy message if someone tries to print to PDF. --- ChangeLog | 6 ++++++ embed/print-dialog.c | 49 +++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1dd4dfe79..5432f0f6d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-07-25 Martin Kretzschmar + + * embed/print-dialog.c (using_pdf_printer): new function. + (ephy_print_verify_postscript): print a less techy message if + someone tries to print to PDF. + 2005-07-25 Christian Persch * lib/ephy-file-helpers.c: (ephy_file_launch_desktop_file): diff --git a/embed/print-dialog.c b/embed/print-dialog.c index ba3dadca2..a67db5f97 100755 --- a/embed/print-dialog.c +++ b/embed/print-dialog.c @@ -207,6 +207,25 @@ ephy_print_dialog_response_cb (GtkDialog *dialog, } } +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) { @@ -226,7 +245,7 @@ using_postscript_printer (GnomePrintConfig *config) else return FALSE; } - else if (transport) + else if (transport) /* these transports default to PostScript */ { if (strcmp ((const gchar *)transport, "CUPS") == 0) return TRUE; @@ -248,15 +267,25 @@ ephy_print_verify_postscript (GnomePrintDialog *print_dialog) if (using_postscript_printer (config)) return TRUE; - 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")); + if (using_pdf_printer (config)) + { + dialog = gtk_message_dialog_new ( + GTK_WINDOW (print_dialog), GTK_DIALOG_MODAL, + GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + _("Generating PDF is not supported")); + } + else + { + 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")); + } if (GTK_WINDOW (print_dialog)->group) gtk_window_group_add_window (GTK_WINDOW (print_dialog)->group, -- cgit v1.2.3