[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CUPS Support
From: |
Fred Kiefer |
Subject: |
Re: CUPS Support |
Date: |
Thu, 22 Apr 2004 01:23:16 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040220 |
On Sunday, April 4, 2004, at 09:58 PM, Chad Hardin wrote:
My time constraints are really tight so I haven't been able to
work on the DirectFB backend in quite a while. I couldn't get
enough contiguous spare time to work on it. The result was that I
was constantly reviewing my previous work and never accomplishing
anything worthwhile.
If anyone else want to tackle this go for it!
Anyhow, I've decided to grapple something a bit easier, something I
can work on in small chucks. That thing is support for CUPS.
I'm making a GSCUPS framework. Later will come a GSCUPSGui
framework, and finally some apps for managing CUPS will come forth.
Sounds good?
Sure! What about adding CUPS support to NSPrinter as well? Or some
way for NSPrinter to use your framework.
I have been thinking about a CUPS printing backend for GNUstep GUI
myself some time ago. The results of my tinkering are attached. The
basic idea was to split off just the finding of the PPD file and the
transfer of the file to the printer. (As a side effect this would allow
us to remove the full set of PPD files currently delivered with GNUstep.
Perhaps we should put them in a separate ressources package anyway?)
As I never did find the time to really work on this, it is more a
starting point for further brainstorming than a real implementation.
/* -*- mode:ObjC -*-
XGPrinter - CUPS printer interface for GNUstep
Copyright (C) 2003 Free Software Foundation, Inc.
Written by: Fred Kiefer <address@hidden>
Date: Sep 2003
This file is part of the GNU Objective C User Interface Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#include <cups/cups.h>
- (NSArray*) printerNames
{
NSArray *allPrinters;
NSString *printer;
int numPrinters;
char **printers;
numPrinters = cupsGetPrinters(&printers);
allPrinters = [NSMutableArray arrayWithCapacity: numPrinters];
for (i = 0; i < numPrinters; i++)
{
[allPrinters setObject: [NSString stringWithCString: printers[i]]
atIndex: i];
}
free(printers);
return allPrinters;
}
- (NSArray*) printerTypes
{
}
- (NSString*) ppdFileForPrinter: (NSString*)printer
{
const char *filename;
filename = cupsGetPPD([printer cString]);
return [NSString stringWithCString: filename];
}
- (void) printFile: (NSString*) filename
toPrinter: (NSString*) printer
withOptions: (NSDictionary*)options
{
int result;
int num_options = 0;
cups_option_t cupsOptions[[options count]];
result = cupsPrintFile([printer cString], [filename cString],
"GNUstep printing",
num_options, cupsOptions);
}