Get browser from defaults

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14338 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2002-08-27 03:16:54 +00:00
parent 4ee8c3ff31
commit bdd9747e9b
2 changed files with 14 additions and 2 deletions

View file

@ -3,6 +3,10 @@
* Model/GMAppKit.m (-initWithModelUnarchiver:): Don't add ourselves
to the superview if we are the contentView of an NSBox.
* Tools/example.m ([ExampleServices -openURL:userData:error:]):
Get browser from defualts. Use mozilla if non. (Modified patch from
Stefan Urbanek).
2002-08-24 Adam Fedor <fedor@gnu.org>
* Source/NSGraphicsContext.m: More documentation.

View file

@ -33,6 +33,7 @@
#include <Foundation/NSString.h>
#include <Foundation/NSException.h>
#include <Foundation/NSTask.h>
#include <Foundation/NSUserDefaults.h>
#include <AppKit/NSApplication.h>
#include <AppKit/NSPasteboard.h>
@ -62,6 +63,8 @@
NSArray *args;
NSString *path;
NSTask *task;
NSString *browser;
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
types = [pb types];
if (![types containsObject: NSStringPboardType])
@ -77,11 +80,16 @@
return;
}
browser = [defs objectForKey:@"NSWebBrowser"];
if(!browser || [browser isEqualToString:@""])
{
browser = @"mozilla -remote \"openURL(%@,new-window)\"";
}
path = @"/bin/sh";
args = [NSArray arrayWithObjects:
@"-c",
[NSString stringWithFormat:
@"netscape -noraise -remote \"openURL(%@,new-window)\"", url],
[NSString stringWithFormat: browser, url],
nil];
task = [NSTask launchedTaskWithLaunchPath: path