openbsd-ports/www/firefox35/patches/patch-gfx_src_psshared_nsPSPrinters_cpp
dcoppa 729f3f4f79 Apply the cups fix to the rest of Mozilla apps (mozilla-thunderbird,
sunbird, firefox35, seamonkey).

Ok & tested by landry@
2011-01-05 08:22:30 +00:00

54 lines
1.8 KiB
Plaintext

$OpenBSD: patch-gfx_src_psshared_nsPSPrinters_cpp,v 1.1 2011/01/05 08:22:30 dcoppa Exp $
--- gfx/src/psshared/nsPSPrinters.cpp.orig Tue Nov 30 14:49:19 2010
+++ gfx/src/psshared/nsPSPrinters.cpp Mon Jan 3 16:24:18 2011
@@ -45,6 +45,7 @@
#include "nsPrintfCString.h"
#include "nsPSPrinters.h"
#include "nsReadableUtils.h" // StringBeginsWith()
+#include "nsCUPSShim.h"
#include "prlink.h"
#include "prenv.h"
@@ -56,6 +57,8 @@
/* dummy printer name for the gfx/src/ps driver */
#define NS_POSTSCRIPT_DRIVER_NAME "PostScript/"
+nsCUPSShim gCupsShim;
+
/* Initialize the printer manager object */
nsresult
nsPSPrinterList::Init()
@@ -70,8 +73,8 @@ nsPSPrinterList::Init()
// Should we try cups?
PRBool useCups = PR_TRUE;
rv = mPref->GetBoolPref("postscript.cups.enabled", &useCups);
- if (useCups)
- mCups.Init();
+ if (useCups && !gCupsShim.IsInitialized())
+ gCupsShim.Init();
return NS_OK;
}
@@ -99,10 +102,10 @@ nsPSPrinterList::GetPrinterList(nsCStringArray& aList)
// Query CUPS for a printer list. The default printer goes to the
// head of the output list; others are appended.
- if (mCups.IsInitialized()) {
+ if (gCupsShim.IsInitialized()) {
cups_dest_t *dests;
- int num_dests = (mCups.mCupsGetDests)(&dests);
+ int num_dests = (gCupsShim.mCupsGetDests)(&dests);
if (num_dests) {
for (int i = 0; i < num_dests; i++) {
nsCAutoString fullName(NS_CUPS_PRINTER);
@@ -117,7 +120,7 @@ nsPSPrinterList::GetPrinterList(nsCStringArray& aList)
aList.AppendCString(fullName);
}
}
- (mCups.mCupsFreeDests)(num_dests, dests);
+ (gCupsShim.mCupsFreeDests)(num_dests, dests);
}
// Build the "classic" list of printers -- those accessed by running