improve user experience with printing and defaults setup

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@22537 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-02-22 10:23:13 +00:00
parent ee80e0169b
commit fda42b0824
4 changed files with 38 additions and 8 deletions

View file

@ -1,3 +1,11 @@
2006-02-22 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSPrintOperation.m: trap exceptions launching previwer
* Documentation/GuiUser/DefaultsSuppary.gsdoc: mention GSLPRPrinters
* Printing/GSLPR/GSLPRPrinter,m: If we set up default printer
config because there was nothing in the user defaults system, save the
new config so we don't have to do it again next time.
2006-02-06 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSMatrix.m (-deselectAllCells): Allow empty selection,

View file

@ -147,6 +147,13 @@
The syntax of keybindings entries and files is documented elsewhere.
</p>
</desc>
<term>GSLPRPrinters</term>
<desc>
<p>
Specifies a dictionary containing printer information for the
GSLPR printer bundle. See the bundle source for details.
</p>
</desc>
<term>GSSavePanelShowProgress</term>
<desc>
<p>

View file

@ -153,7 +153,7 @@
defaults = [NSUserDefaults standardUserDefaults];
printers = [defaults objectForKey: @"GSLPRPrinters"];
printers = [defaults dictionaryForKey: @"GSLPRPrinters"];
if (!printers) //Not set, make a default printer because we are nice.
{
@ -185,6 +185,9 @@
[(NSMutableDictionary*)printers setObject: printerEntry
forKey: @"Unnamed"];
[defaults setObject: printers forKey: @"GSLPRPrinters"];
[defaults synchronize];
if (!didWarn)
{
NSLog(@"Creating a default printer since no printer has been set "

View file

@ -34,6 +34,7 @@
#include <Foundation/NSData.h>
#include <Foundation/NSTask.h>
#include <Foundation/NSException.h>
#include <Foundation/NSUserDefaults.h>
#include "AppKit/NSView.h"
#include "AppKit/NSPrintPanel.h"
@ -138,14 +139,25 @@
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
preview = [def objectForKey: @"NSPreviewApp"];
if (preview == nil || [preview length] == 0)
preview = @"gv";
if (preview == nil || [preview length] == 0)
preview = @"gv";
task = [NSTask new];
[task setLaunchPath: preview];
[task setArguments: [NSArray arrayWithObject: _path]];
[task launch];
AUTORELEASE(task);
NS_DURING
{
task = AUTORELEASE([NSTask new]);
[task setLaunchPath: preview];
[task setArguments: [NSArray arrayWithObject: _path]];
[task launch];
}
NS_HANDLER
{
BOOL result;
result = NSRunAlertPanel(_(@"Preview"),
_(@"Problem running the preview application '%@' perhaps you need to set your NSPreviewApp user default"),
_(@"Dismiss"), nil, nil, preview);
}
NS_ENDHANDLER
}
}
else if ([job isEqual: NSPrintSpoolJob])