From 25f09a190781d812350c7364aa424a1c4300f976 Mon Sep 17 00:00:00 2001 From: rfm Date: Wed, 22 Feb 2006 10:23:13 +0000 Subject: [PATCH] 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 --- ChangeLog | 8 +++++++ Documentation/GuiUser/DefaultsSummary.gsdoc | 7 ++++++ Printing/GSLPR/GSLPRPrinter.m | 5 +++- Source/GSPrintOperation.m | 26 +++++++++++++++------ 4 files changed, 38 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3969161f8..d54cefe60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-02-22 Richard Frith-Macdonald + + * 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 * Source/NSMatrix.m (-deselectAllCells): Allow empty selection, diff --git a/Documentation/GuiUser/DefaultsSummary.gsdoc b/Documentation/GuiUser/DefaultsSummary.gsdoc index 017a44972..3d9a498ce 100644 --- a/Documentation/GuiUser/DefaultsSummary.gsdoc +++ b/Documentation/GuiUser/DefaultsSummary.gsdoc @@ -147,6 +147,13 @@ The syntax of keybindings entries and files is documented elsewhere.

+ GSLPRPrinters + +

+ Specifies a dictionary containing printer information for the + GSLPR printer bundle. See the bundle source for details. +

+
GSSavePanelShowProgress

diff --git a/Printing/GSLPR/GSLPRPrinter.m b/Printing/GSLPR/GSLPRPrinter.m index a83c4b51d..9a8c4379e 100644 --- a/Printing/GSLPR/GSLPRPrinter.m +++ b/Printing/GSLPR/GSLPRPrinter.m @@ -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 " diff --git a/Source/GSPrintOperation.m b/Source/GSPrintOperation.m index 48dac2292..cd6936044 100644 --- a/Source/GSPrintOperation.m +++ b/Source/GSPrintOperation.m @@ -34,6 +34,7 @@ #include #include +#include #include #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])