diff dwt/printing/Printer.d @ 211:00180515eb65

Update to SWT 3.3.2
author Frank Benoit <benoit@tionex.de>
date Wed, 19 Mar 2008 21:36:28 +0100
parents 08789b28bdf3
children 997624cece6a
line wrap: on
line diff
--- a/dwt/printing/Printer.d	Wed Mar 19 20:14:48 2008 +0100
+++ b/dwt/printing/Printer.d	Wed Mar 19 21:36:28 2008 +0100
@@ -75,6 +75,8 @@
 
     static const char[] GTK_LPR_BACKEND = "GtkPrintBackendLpr"; //$NON-NLS-1$
 
+    static const bool disablePrinting = false;// System.getProperty("dwt.internal.gtk.disablePrinting") !is null; //$NON-NLS-1$
+
 /**
  * Returns an array of <code>PrinterData</code> objects
  * representing all available printers.
@@ -83,7 +85,7 @@
  */
 public static PrinterData[] getPrinterList() {
     printerList = new PrinterData [0];
-    if (OS.GTK_VERSION < OS.buildVERSION (2, 10, 0)) {
+    if (OS.GTK_VERSION < OS.buildVERSION (2, 10, 0) || disablePrinting) {
         return printerList;
     }
     OS.gtk_enumerate_printers(&GtkPrinterFunc_List, null, null, true);
@@ -119,7 +121,7 @@
  */
 public static PrinterData getDefaultPrinterData() {
     printerList = new PrinterData [1];
-    if (OS.GTK_VERSION < OS.buildVERSION (2, 10, 0)) {
+    if (OS.GTK_VERSION < OS.buildVERSION (2, 10, 0) || disablePrinting) {
         return null;
     }
     OS.gtk_enumerate_printers(&GtkPrinterFunc_Default, null, null, true);
@@ -632,7 +634,7 @@
  */
 protected override void create(DeviceData deviceData) {
     this.data = cast(PrinterData)deviceData;
-    if (OS.GTK_VERSION < OS.buildVERSION (2, 10, 0)) DWT.error(DWT.ERROR_NO_HANDLES);
+    if (OS.GTK_VERSION < OS.buildVERSION (2, 10, 0) || disablePrinting) DWT.error(DWT.ERROR_NO_HANDLES);
     printer = gtkPrinterFromPrinterData();
     if (printer is null) DWT.error(DWT.ERROR_NO_HANDLES);
 }
@@ -698,7 +700,7 @@
             paper_size = OS.gtk_paper_size_new(name.ptr);
         }
         OS.gtk_page_setup_set_paper_size(pageSetup, paper_size);
-        OS.g_free(paper_size);
+        OS.gtk_paper_size_free(paper_size);
     }
 
     /* Set values of settings from PrinterData. */