printerList = new PrinterData [0];
if (OS.GTK_VERSION < OS.VERSION (2, 10, 0) || disablePrinting) {
return printerList;
}
gtk_init();
Callback printerCallback = new Callback(Printer.class, "GtkPrinterFunc_List", 2); //$NON-NLS-1$
long /*int*/ GtkPrinterFunc_List = printerCallback.getAddress();
if (GtkPrinterFunc_List == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
OS.gtk_enumerate_printers(GtkPrinterFunc_List, 0, 0, true);
/*
* This call to gdk_threads_leave() is a temporary work around
* to avoid deadlocks when gdk_threads_init() is called by native
* code outside of SWT (i.e AWT, etc). It ensures that the current
* thread leaves the GTK lock acquired by the function above.
*/
OS.gdk_threads_leave();
printerCallback.dispose ();
return printerList;
}