mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 18:21:08 +00:00
Use other CUPS functions to determine the default printer.
Patch by Mark Tracy <tracy454@concentric.net>. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26019 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
49399cb0c5
commit
fe88cda478
2 changed files with 28 additions and 13 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2008-02-01 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Printing/GSCUPS/GSCUPSPrintInfo.m (-defaultPrinter): Use other
|
||||||
|
CUPS functions to determine the default printer.
|
||||||
|
Patch by Mark Tracy <tracy454@concentric.net>.
|
||||||
|
|
||||||
2008-01-26 Fred Kiefer <FredKiefer@gmx.de>
|
2008-01-26 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSTextView.m (-copySelection, -pasteSelection): Add new X
|
* Source/NSTextView.m (-copySelection, -pasteSelection): Add new X
|
||||||
|
|
|
@ -66,24 +66,33 @@
|
||||||
|
|
||||||
+(NSPrinter*) defaultPrinter
|
+(NSPrinter*) defaultPrinter
|
||||||
{
|
{
|
||||||
const char *defaultName;
|
NSString *defaultName;
|
||||||
|
int numDests;
|
||||||
defaultName = cupsGetDefault();
|
cups_dest_t* dests;
|
||||||
NSDebugLLog(@"GSCUPS", @"The default printer name is %s", defaultName);
|
cups_dest_t* dest = NULL;
|
||||||
|
|
||||||
if (defaultName)
|
numDests = cupsGetDests( &dests );
|
||||||
|
if (dests)
|
||||||
{
|
{
|
||||||
return [NSPrinter printerWithName:
|
// use NULL to request the default printer
|
||||||
[NSString stringWithCString: defaultName]];
|
dest = cupsGetDest( NULL, NULL, numDests, dests );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
if (dest)
|
||||||
return [NSPrinter printerWithName: GSCUPSDummyPrinterName];
|
{
|
||||||
}
|
defaultName = [NSString stringWithCString: dest->name];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
defaultName = GSCUPSDummyPrinterName;
|
||||||
|
}
|
||||||
|
NSDebugLLog(@"GSCUPS", @"The default printer name is %@", defaultName);
|
||||||
|
cupsFreeDests( numDests, dests );
|
||||||
|
|
||||||
|
return [NSPrinter printerWithName: defaultName];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+ (void)setDefaultPrinter:(NSPrinter *)printer
|
+ (void)setDefaultPrinter:(NSPrinter *)printer
|
||||||
{
|
{
|
||||||
NSString* name;
|
NSString* name;
|
||||||
|
|
Loading…
Reference in a new issue