[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
User specified browser in example service
From: |
Stefan Urbanek |
Subject: |
User specified browser in example service |
Date: |
Sun, 25 Aug 2002 10:13:43 +0100 |
Hi,
Here is a patch for core/gui/Tools/example.m to support user specified browser.
You may specify your browser in defaults:
defaults write NSGlobalDomain NSWebBrowser 'mozilla -remote
"openURL(%@,new-window)"'
--- example.old.m Sun Aug 25 11:02:52 2002
+++ example.m Sun Aug 25 11:05:24 2002
@@ -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>
@@ -57,6 +58,8 @@
userData: (NSString*)ud
error: (NSString**)err
{
+ NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
+ NSString *browser;
NSString *url;
NSArray *types;
NSArray *args;
@@ -77,11 +80,18 @@
return;
}
+ browser = [defs objectForKey:@"NSWebBrowser"];
+ + if(!browser || [browser isEqualToString:@""])
+ {
+ browser = @"netscape -noraise -remote \"openURL(%@,new-window)\"";
+ }
+
path = @"/bin/sh";
args = [NSArray arrayWithObjects:
@"-c",
[NSString stringWithFormat:
- @"netscape -noraise -remote \"openURL(%@,new-window)\"", url],
+ browser, url],
nil];
task = [NSTask launchedTaskWithLaunchPath: path
---
have fun,
stefan
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- User specified browser in example service,
Stefan Urbanek <=