[gtk+/gtk-2-24] Set "accepts-pdf" property to true only if supported by the print backend



commit 7de568a2aec5c8d4edb5d1319ed10cfe6280c99c
Author: Adrian Johnson <ajohnson redneon com>
Date:   Wed Dec 29 01:18:02 2010 +1030

    Set "accepts-pdf" property to true only if supported by the print backend

 gtk/gtkprinter.c                                 |    4 ++--
 modules/printbackends/cups/gtkprintercups.c      |   10 +++++++++-
 modules/printbackends/file/gtkprintbackendfile.c |    1 +
 3 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkprinter.c b/gtk/gtkprinter.c
index 1ffaaf5..0f0541f 100644
--- a/gtk/gtkprinter.c
+++ b/gtk/gtkprinter.c
@@ -131,7 +131,7 @@ gtk_printer_class_init (GtkPrinterClass *class)
                                    g_param_spec_boolean ("accepts-pdf",
 							 P_("Accepts PDF"),
 							 P_("TRUE if this printer can accept PDF"),
-							 TRUE,
+							 FALSE,
 							 GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
   g_object_class_install_property (G_OBJECT_CLASS (class),
                                    PROP_ACCEPTS_PS,
@@ -240,7 +240,7 @@ gtk_printer_init (GtkPrinter *printer)
   priv->is_accepting_jobs = TRUE;
   priv->is_new = TRUE;
   priv->has_details = FALSE;
-  priv->accepts_pdf = TRUE;
+  priv->accepts_pdf = FALSE;
   priv->accepts_ps = TRUE;
 
   priv->state_message = NULL;  
diff --git a/modules/printbackends/cups/gtkprintercups.c b/modules/printbackends/cups/gtkprintercups.c
index 09818c3..8b3f85c 100644
--- a/modules/printbackends/cups/gtkprintercups.c
+++ b/modules/printbackends/cups/gtkprintercups.c
@@ -127,11 +127,19 @@ gtk_printer_cups_new (const char      *name,
 		      GtkPrintBackend *backend)
 {
   GObject *result;
-  
+  gboolean accepts_pdf;
+
+#if (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2) || CUPS_VERSION_MAJOR > 1
+  accepts_pdf = TRUE;
+#else
+  accepts_pdf = FALSE;
+#endif
+
   result = g_object_new (GTK_TYPE_PRINTER_CUPS,
 			 "name", name,
 			 "backend", backend,
 			 "is-virtual", FALSE,
+			 "accepts-pdf", accepts_pdf,
                          NULL);
 
   return (GtkPrinterCups *) result;
diff --git a/modules/printbackends/file/gtkprintbackendfile.c b/modules/printbackends/file/gtkprintbackendfile.c
index 2d86bd5..2731fea 100644
--- a/modules/printbackends/file/gtkprintbackendfile.c
+++ b/modules/printbackends/file/gtkprintbackendfile.c
@@ -493,6 +493,7 @@ gtk_print_backend_file_init (GtkPrintBackendFile *backend)
 			  "name", _("Print to File"),
 			  "backend", backend,
 			  "is-virtual", TRUE,
+			  "accepts-pdf", TRUE,
 			  NULL); 
 
   gtk_printer_set_has_details (printer, TRUE);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]