Tidied launching

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4049 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-04-08 20:42:46 +00:00
parent a332c8f19c
commit c07241993d
4 changed files with 268 additions and 116 deletions

View file

@ -57,7 +57,6 @@
} }
+ (GSServicesManager*) newWithApplication: (NSApplication*)app; + (GSServicesManager*) newWithApplication: (NSApplication*)app;
+ (GSServicesManager*) manager; + (GSServicesManager*) manager;
- (void) checkServices;
- (void) doService: (NSCell*)item; - (void) doService: (NSCell*)item;
- (BOOL) hasRegisteredTypes: (NSDictionary*)service; - (BOOL) hasRegisteredTypes: (NSDictionary*)service;
- (NSString*) item2title: (NSCell*)item; - (NSString*) item2title: (NSCell*)item;

View file

@ -44,6 +44,7 @@
#include <Foundation/NSUserDefaults.h> #include <Foundation/NSUserDefaults.h>
#include <Foundation/NSSerialization.h> #include <Foundation/NSSerialization.h>
#include <Foundation/NSPortNameServer.h> #include <Foundation/NSPortNameServer.h>
#include <Foundation/NSTask.h>
#include <base/fast.x> #include <base/fast.x>
@ -57,20 +58,16 @@
#include <AppKit/GSServicesManager.h> #include <AppKit/GSServicesManager.h>
#define stringify_it(X) #X
#define prog_path(X,Y) \
stringify_it(X) "/Tools/" GNUSTEP_TARGET_DIR "/" LIBRARY_COMBO
/* /*
* The GNUListener class is for talking to other applications. * The GSListener class is for talking to other applications.
* It is a proxy with some dangerous methods implemented in a * It is a proxy with some dangerous methods implemented in a
* harmless manner to reduce the chances of a malicious app * harmless manner to reduce the chances of a malicious app
* messing with us. This is responsible for forwarding service * messing with us. This is responsible for forwarding service
* requests and other communications with the outside world. * requests and other communications with the outside world.
*/ */
@interface GNUListener : NSObject @interface GSListener : NSObject
+ (id) connectionBecameInvalid: (NSNotification*)notification; + (id) connectionBecameInvalid: (NSNotification*)notification;
+ (GNUListener*) listener; + (GSListener*) listener;
+ (id) servicesProvider; + (id) servicesProvider;
+ (void) setServicesProvider: (id)anObject; + (void) setServicesProvider: (id)anObject;
- (Class) class; - (Class) class;
@ -78,10 +75,20 @@
- (void) release; - (void) release;
- (id) retain; - (id) retain;
- (id) self; - (id) self;
- (BOOL) application: (NSApplication*)theApp
openFile: (NSString*)file;
- (BOOL) application: (NSApplication*)theApp
openFileWithoutUI: (NSString*)file;
- (BOOL) application: (NSApplication*)theApp
openTempFile: (NSString*)file;
- (void) performService: (NSString*)name
withPasteboard: (NSPasteboard*)pb
userData: (NSString*)ud
error: (NSString**)e;
@end @end
static NSConnection *listenerConnection = nil; static NSConnection *listenerConnection = nil;
static GNUListener *listener = nil; static GSListener *listener = nil;
static id servicesProvider = nil; static id servicesProvider = nil;
void void
@ -94,7 +101,7 @@ NSUnregisterServicesProvider(NSString *name)
* the given port name. * the given port name.
*/ */
[[NSPortNameServer defaultPortNameServer] removePortForName: name]; [[NSPortNameServer defaultPortNameServer] removePortForName: name];
[NSNotificationCenter removeObserver: [GNUListener class] [NSNotificationCenter removeObserver: [GSListener class]
name: NSConnectionDidDieNotification name: NSConnectionDidDieNotification
object: listenerConnection]; object: listenerConnection];
[listenerConnection release]; [listenerConnection release];
@ -113,7 +120,7 @@ NSRegisterServicesProvider(id provider, NSString *name)
* the given port name. * the given port name.
*/ */
[[NSPortNameServer defaultPortNameServer] removePortForName: name]; [[NSPortNameServer defaultPortNameServer] removePortForName: name];
[NSNotificationCenter removeObserver: [GNUListener class] [NSNotificationCenter removeObserver: [GSListener class]
name: NSConnectionDidDieNotification name: NSConnectionDidDieNotification
object: listenerConnection]; object: listenerConnection];
[listenerConnection release]; [listenerConnection release];
@ -122,12 +129,12 @@ NSRegisterServicesProvider(id provider, NSString *name)
if (name && provider) if (name && provider)
{ {
listenerConnection = [NSConnection newRegisteringAtName: name listenerConnection = [NSConnection newRegisteringAtName: name
withRootObject: [GNUListener listener]]; withRootObject: [GSListener listener]];
if (listenerConnection) if (listenerConnection)
{ {
[listenerConnection retain]; [listenerConnection retain];
[NotificationDispatcher [NotificationDispatcher
addObserver: [GNUListener class] addObserver: [GSListener class]
selector: @selector(connectionBecameInvalid:) selector: @selector(connectionBecameInvalid:)
name: NSConnectionDidDieNotification name: NSConnectionDidDieNotification
object: listenerConnection]; object: listenerConnection];
@ -140,12 +147,12 @@ NSRegisterServicesProvider(id provider, NSString *name)
} }
/* /*
* The GNUListener class exists as a proxy to forward messages to * The GSListener class exists as a proxy to forward messages to
* service provider objects. It implements very few methods and * service provider objects. It implements very few methods and
* those that it does implement are generally designed to defeat * those that it does implement are generally designed to defeat
* any attack by a malicious program. * any attack by a malicious program.
*/ */
@implementation GNUListener @implementation GSListener
+ (id) connectionBecameInvalid: (NSNotification*)notification + (id) connectionBecameInvalid: (NSNotification*)notification
{ {
@ -160,7 +167,7 @@ NSRegisterServicesProvider(id provider, NSString *name)
return self; return self;
} }
+ (GNUListener*) listener + (GSListener*) listener
{ {
if (listener == nil) if (listener == nil)
{ {
@ -219,6 +226,63 @@ NSRegisterServicesProvider(id provider, NSString *name)
return nil; return nil;
} }
- (BOOL) application: (NSApplication*)theApp
openFile: (NSString*)file
{
NSApplication *app = [NSApplication sharedApplication];
return [app application: theApp openFile: file];
}
- (BOOL) application: (NSApplication*)theApp
openFileWithoutUI: (NSString*)file
{
NSApplication *app = [NSApplication sharedApplication];
return [app application: theApp openFileWithoutUI: file];
}
- (BOOL) application: (NSApplication*)theApp
openTempFile: (NSString*)file
{
NSApplication *app = [NSApplication sharedApplication];
return [app application: theApp openTempFile: file];
}
- (void) performService: (NSString*)name
withPasteboard: (NSPasteboard*)pb
userData: (NSString*)ud
error: (NSString**)e
{
id obj = servicesProvider;
SEL msgSel = NSSelectorFromString(name);
IMP msgImp;
if (obj != nil && [obj respondsToSelector: msgSel])
{
msgImp = [obj methodForSelector: msgSel];
if (msgImp != 0)
{
(*msgImp)(obj, msgSel, pb, ud, e);
return;
}
}
obj = [[NSApplication sharedApplication] delegate];
if (obj != nil && [obj respondsToSelector: msgSel])
{
msgImp = [obj methodForSelector: msgSel];
if (msgImp != 0)
{
(*msgImp)(obj, msgSel, pb, ud, e);
return;
}
}
*e = @"No object available to provide service";
}
- (void) release - (void) release
{ {
} }
@ -232,7 +296,7 @@ NSRegisterServicesProvider(id provider, NSString *name)
{ {
return self; return self;
} }
@end /* GNUListener */ @end /* GSListener */
@ -302,13 +366,6 @@ static NSString *disabledName = @".GNUstepDisabled";
return manager; return manager;
} }
- (void) checkServices
{
system(prog_path(GNUSTEP_INSTALL_PREFIX, "/make_services"));
[self loadServices];
}
- (void) dealloc - (void) dealloc
{ {
NSString *appName; NSString *appName;
@ -860,7 +917,7 @@ static NSString *disabledName = @".GNUstepDisabled";
- (id) servicesProvider - (id) servicesProvider
{ {
return [GNUListener servicesProvider]; return [GSListener servicesProvider];
} }
- (void) setServicesMenu: (NSMenu*)aMenu - (void) setServicesMenu: (NSMenu*)aMenu
@ -871,7 +928,7 @@ static NSString *disabledName = @".GNUstepDisabled";
- (void) setServicesProvider: (id)anObject - (void) setServicesProvider: (id)anObject
{ {
[GNUListener setServicesProvider: anObject]; [GSListener setServicesProvider: anObject];
} }
- (int) setShowsServicesMenuItem: (NSString*)item to: (BOOL)enable - (int) setShowsServicesMenuItem: (NSString*)item to: (BOOL)enable
@ -1195,7 +1252,12 @@ NSPerformService(NSString *serviceItem, NSPasteboard *pboard)
msgImp = get_imp(fastClass(provider), msgSel); msgImp = get_imp(fastClass(provider), msgSel);
NS_DURING NS_DURING
{ {
(*msgImp)(provider, msgSel, pboard, userData, &error); [provider performService: selName
withPasteboard: pboard
userData: userData
error: &error];
// (*msgImp)(provider, msgSel, pboard, userData, &error);
} }
NS_HANDLER NS_HANDLER
{ {

View file

@ -50,6 +50,34 @@
#include <AppKit/NSCursor.h> #include <AppKit/NSCursor.h>
@interface GSWindowView : NSView
{
}
@end
@implementation GSWindowView
- (BOOL) isOpaque
{
return YES;
}
- (void) drawRect: (NSRect)rect
{
NSColor *c = [[self window] backgroundColor];
[c set];
NSRectFill(rect);
}
- (Class) classForCoder: (NSCoder*)aCoder
{
if ([self class] == [GSWindowView class])
return [super class];
return [self class];
}
@end
//***************************************************************************** //*****************************************************************************
// //
@ -71,11 +99,6 @@
} }
} }
+ (NSView *) _windowViewWithFrame: (NSRect)frameRect // create the view at
{ // the root of window's
return nil; // view heirarchy.
} // (backend)
+ (void) removeFrameUsingName: (NSString *)name + (void) removeFrameUsingName: (NSString *)name
{ // Saving and restoring { // Saving and restoring
} // the window's frame } // the window's frame
@ -208,13 +231,14 @@
{ {
NSView *wv; NSView *wv;
if (!aView) // contentview can't be nil // contentview can't be nil
if (!aView)
aView = [[[NSView alloc] initWithFrame: frame] autorelease]; aView = [[[NSView alloc] initWithFrame: frame] autorelease];
// If window view has not
// been created, create it // If window view has not been created, create it
if ((!content_view) || ([content_view superview] == nil)) if ((!content_view) || ([content_view superview] == nil))
{ {
wv = [NSWindow _windowViewWithFrame: frame]; wv = [[GSWindowView allocWithZone: [self zone]] initWithFrame: frame];
[wv viewWillMoveToWindow: self]; [wv viewWillMoveToWindow: self];
} }
else else

View file

@ -40,22 +40,27 @@
#include <Foundation/NSTask.h> #include <Foundation/NSTask.h>
#include <Foundation/NSException.h> #include <Foundation/NSException.h>
#include <Foundation/NSProcessInfo.h> #include <Foundation/NSProcessInfo.h>
#include <Foundation/NSFileManager.h>
#define stringify_it(X) #X #define stringify_it(X) #X
#define prog_path(X,Y) \ #define mkpath(X) stringify_it(X) "/Tools"
stringify_it(X) "/Tools/" GNUSTEP_TARGET_DIR "/" LIBRARY_COMBO
static NSDictionary *applications = nil; static NSDictionary *applications = nil;
@interface NSWorkspace (GNUstep)
- (NSTask*) launchProgram: (NSString *)prog
atPath: (NSString *)path;
@end
@implementation NSWorkspace @implementation NSWorkspace
static NSWorkspace *sharedWorkspace = nil; static NSWorkspace *sharedWorkspace = nil;
static NSNotificationCenter *workspaceCenter = nil; static NSNotificationCenter *workspaceCenter = nil;
static BOOL userDefaultsChanged = NO; static BOOL userDefaultsChanged = NO;
static NSString *appListName = @".GNUstepAppList"; static NSString *appListName = @".GNUstepAppList";
static NSString *appListPath = nil; static NSString *appListPath = nil;
static NSString* gnustep_target_dir = static NSString* gnustep_target_dir =
#ifdef GNUSTEP_TARGET_DIR #ifdef GNUSTEP_TARGET_DIR
@ -85,7 +90,7 @@ static NSString* library_combo =
// //
// Class methods // Class methods
// //
+ (void)initialize + (void) initialize
{ {
if (self == [NSWorkspace class]) if (self == [NSWorkspace class])
{ {
@ -93,7 +98,7 @@ static NSString* library_combo =
NSDictionary *env; NSDictionary *env;
// Initial version // Initial version
[self setVersion:1]; [self setVersion: 1];
[gnustep_global_lock lock]; [gnustep_global_lock lock];
if (beenHere == YES) if (beenHere == YES)
@ -158,7 +163,7 @@ static NSString* library_combo =
// //
// Creating a Workspace // Creating a Workspace
// //
+ (NSWorkspace *)sharedWorkspace + (NSWorkspace *) sharedWorkspace
{ {
if (sharedWorkspace == nil) if (sharedWorkspace == nil)
{ {
@ -213,7 +218,7 @@ static NSString* library_combo =
if (apps == nil || [apps count] == 0) if (apps == nil || [apps count] == 0)
{ {
NSRunAlertPanel(nil, NSRunAlertPanel(nil,
[NSString stringWithFormat: [NSString stringWithFormat:
@"No known applications for file extension '%@'", ext], @"No known applications for file extension '%@'", ext],
@"Continue", nil, nil); @"Continue", nil, nil);
return NO; return NO;
@ -225,31 +230,29 @@ static NSString* library_combo =
return [self openFile: fullPath withApplication: appName]; return [self openFile: fullPath withApplication: appName];
} }
- (BOOL)openFile:(NSString *)fullPath - (BOOL) openFile: (NSString *)fullPath
fromImage:(NSImage *)anImage fromImage: (NSImage *)anImage
at:(NSPoint)point at: (NSPoint)point
inView:(NSView *)aView inView: (NSView *)aView
{ {
/* FIXME - should do animation here */ /* FIXME - should do animation here */
return [self openFile: fullPath]; return [self openFile: fullPath];
} }
- (BOOL)openFile:(NSString *)fullPath - (BOOL) openFile: (NSString *)fullPath
withApplication:(NSString *)appName withApplication: (NSString *)appName
{ {
return [self openFile: fullPath withApplication: appName andDeactivate: YES]; return [self openFile: fullPath withApplication: appName andDeactivate: YES];
} }
- (BOOL)openFile:(NSString *)fullPath - (BOOL) openFile: (NSString *)fullPath
withApplication:(NSString *)appName withApplication: (NSString *)appName
andDeactivate:(BOOL)flag andDeactivate: (BOOL)flag
{ {
NSString *port = [appName stringByDeletingPathExtension]; NSString *port = [appName stringByDeletingPathExtension];
NSDate *finish = [NSDate dateWithTimeIntervalSinceNow: 30.0]; NSDate *finish = [NSDate dateWithTimeIntervalSinceNow: 30.0];
id app; id app;
/* FIXME - should probably deactivate self here. */
/* /*
* Try to connect to the application - launches if necessary. * Try to connect to the application - launches if necessary.
*/ */
@ -257,7 +260,7 @@ static NSString* library_combo =
if (app == nil) if (app == nil)
{ {
NSRunAlertPanel(nil, NSRunAlertPanel(nil,
[NSString stringWithFormat: [NSString stringWithFormat:
@"Failed to contact '%@' to open file", port], @"Failed to contact '%@' to open file", port],
@"Continue", nil, nil); @"Continue", nil, nil);
return NO; return NO;
@ -273,17 +276,20 @@ static NSString* library_combo =
NS_HANDLER NS_HANDLER
{ {
NSRunAlertPanel(nil, NSRunAlertPanel(nil,
[NSString stringWithFormat: [NSString stringWithFormat:
@"Failed to contact '%@' to open file", port], @"Failed to contact '%@' to open file", port],
@"Continue", nil, nil); @"Continue", nil, nil);
return NO; return NO;
} }
NS_ENDHANDLER NS_ENDHANDLER
if (flag)
[[NSApplication sharedApplication] deactivate];
return YES; return YES;
} }
- (BOOL)openTempFile:(NSString *)fullPath - (BOOL) openTempFile: (NSString *)appName
{ {
return NO; return NO;
} }
@ -291,17 +297,17 @@ static NSString* library_combo =
// //
// Manipulating Files // Manipulating Files
// //
- (BOOL)performFileOperation:(NSString *)operation - (BOOL) performFileOperation: (NSString *)operation
source:(NSString *)source source: (NSString *)source
destination:(NSString *)destination destination: (NSString *)destination
files:(NSArray *)files files: (NSArray *)files
tag:(int *)tag tag: (int *)tag
{ {
return NO; return NO;
} }
- (BOOL)selectFile:(NSString *)fullPath - (BOOL) selectFile: (NSString *)fullPath
inFileViewerRootedAtPath:(NSString *)rootFullpath inFileViewerRootedAtPath: (NSString *)rootFullpath
{ {
return NO; return NO;
} }
@ -309,7 +315,7 @@ inFileViewerRootedAtPath:(NSString *)rootFullpath
// //
// Requesting Information about Files // Requesting Information about Files
// //
- (NSString *)fullPathForApplication:(NSString *)appName - (NSString *) fullPathForApplication: (NSString *)appName
{ {
NSString *last = [appName lastPathComponent]; NSString *last = [appName lastPathComponent];
@ -329,34 +335,34 @@ inFileViewerRootedAtPath:(NSString *)rootFullpath
return nil; return nil;
} }
- (BOOL)getFileSystemInfoForPath:(NSString *)fullPath - (BOOL) getFileSystemInfoForPath: (NSString *)fullPath
isRemovable:(BOOL *)removableFlag isRemovable: (BOOL *)removableFlag
isWritable:(BOOL *)writableFlag isWritable: (BOOL *)writableFlag
isUnmountable:(BOOL *)unmountableFlag isUnmountable: (BOOL *)unmountableFlag
description:(NSString **)description description: (NSString **)description
type:(NSString **)fileSystemType type: (NSString **)fileSystemType
{ {
return NO; return NO;
} }
- (BOOL)getInfoForFile:(NSString *)fullPath - (BOOL) getInfoForFile: (NSString *)fullPath
application:(NSString **)appName application: (NSString **)appName
type:(NSString **)type type: (NSString **)type
{ {
return NO; return NO;
} }
- (NSImage *)iconForFile:(NSString *)fullPath - (NSImage *) iconForFile: (NSString *)fullPath
{ {
return nil; return nil;
} }
- (NSImage *)iconForFiles:(NSArray *)pathArray - (NSImage *) iconForFiles: (NSArray *)pathArray
{ {
return nil; return nil;
} }
- (NSImage *)iconForFileType:(NSString *)fileType - (NSImage *) iconForFileType: (NSString *)fileType
{ {
return nil; return nil;
} }
@ -364,23 +370,33 @@ inFileViewerRootedAtPath:(NSString *)rootFullpath
// //
// Tracking Changes to the File System // Tracking Changes to the File System
// //
- (BOOL)fileSystemChanged - (BOOL) fileSystemChanged
{ {
return NO; return NO;
} }
- (void)noteFileSystemChanged - (void) noteFileSystemChanged
{} {
}
// //
// Updating Registered Services and File Types // Updating Registered Services and File Types
// //
- (void) findApplications - (void) findApplications
{ {
NSData *data; static NSString *path = nil;
NSDictionary *newApps; NSData *data;
NSDictionary *newApps;
NSTask *task;
system(prog_path(GNUSTEP_INSTALL_PREFIX, "/make_services")); /*
* Try to locate and run an executable copy of 'make_services'
*/
if (path == nil)
path = [[NSString alloc] initWithCString: mkpath(GNUSTEP_INSTALL_PREFIX)];
task = [self launchProgram: @"make_services" atPath: path];
if (task != nil)
[task waitUntilExit];
data = [NSData dataWithContentsOfFile: appListPath]; data = [NSData dataWithContentsOfFile: appListPath];
if (data) if (data)
@ -395,22 +411,21 @@ inFileViewerRootedAtPath:(NSString *)rootFullpath
// //
// Launching and Manipulating Applications // Launching and Manipulating Applications
// //
- (void)hideOtherApplications - (void) hideOtherApplications
{} {
}
- (BOOL)launchApplication:(NSString *)appName - (BOOL) launchApplication: (NSString *)appName
{ {
return [self launchApplication: appName return [self launchApplication: appName
showIcon: YES showIcon: YES
autolaunch: NO]; autolaunch: NO];
} }
- (BOOL)launchApplication:(NSString *)appName - (BOOL) launchApplication: (NSString *)appName
showIcon:(BOOL)showIcon showIcon: (BOOL)showIcon
autolaunch:(BOOL)autolaunch autolaunch: (BOOL)autolaunch
{ {
NSArray *args;
NSTask *task;
NSString *path; NSString *path;
NSString *file; NSString *file;
NSDictionary *info; NSDictionary *info;
@ -437,28 +452,33 @@ inFileViewerRootedAtPath:(NSString *)rootFullpath
if (path == nil) if (path == nil)
return NO; return NO;
/*
* See if the 'Info-gnustep.plist' specifies the location of the
* executable - if it does, replace our app name with the specified
* value. If the executable name is an absolute path name, we also
* replace the path with that specified.
*/
file = [path stringByAppendingPathComponent: @"Resources/Info-gnustep.plist"]; file = [path stringByAppendingPathComponent: @"Resources/Info-gnustep.plist"];
info = [NSDictionary dictionaryWithContentsOfFile: file]; info = [NSDictionary dictionaryWithContentsOfFile: file];
file = [info objectForKey: @"NSExecutable"]; file = [info objectForKey: @"NSExecutable"];
if (file == nil) if (file != nil)
{ {
file = appName; appName = [file lastPathComponent];
if ([file isAbsolutePath] == YES)
{
path = [file stringByDeletingLastPathComponent];
}
} }
path = [path stringByAppendingPathComponent: gnustep_target_dir];
path = [path stringByAppendingPathComponent: library_combo];
path = [path stringByAppendingPathComponent: appName];
args = [NSArray arrayWithObjects: nil];
task = [NSTask launchedTaskWithLaunchPath: path
arguments: args];
if ([self launchProgram: appName atPath: path] == nil)
return NO;
return YES; return YES;
} }
// //
// Unmounting a Device // Unmounting a Device
// //
- (BOOL)unmountAndEjectDeviceAtPath:(NSString *)path - (BOOL) unmountAndEjectDeviceAtPath: (NSString *)path
{ {
return NO; return NO;
} }
@ -466,15 +486,16 @@ inFileViewerRootedAtPath:(NSString *)rootFullpath
// //
// Tracking Status Changes for Devices // Tracking Status Changes for Devices
// //
- (void)checkForRemovableMedia - (void) checkForRemovableMedia
{} {
}
- (NSArray *)mountNewRemovableMedia - (NSArray *) mountNewRemovableMedia
{ {
return nil; return nil;
} }
- (NSArray *)mountedRemovableMedia - (NSArray *) mountedRemovableMedia
{ {
return nil; return nil;
} }
@ -482,7 +503,7 @@ inFileViewerRootedAtPath:(NSString *)rootFullpath
// //
// Notification Center // Notification Center
// //
- (NSNotificationCenter *)notificationCenter - (NSNotificationCenter *) notificationCenter
{ {
return workspaceCenter; return workspaceCenter;
} }
@ -490,12 +511,12 @@ inFileViewerRootedAtPath:(NSString *)rootFullpath
// //
// Tracking Changes to the User Defaults Database // Tracking Changes to the User Defaults Database
// //
- (void)noteUserDefaultsChanged - (void) noteUserDefaultsChanged
{ {
userDefaultsChanged = YES; userDefaultsChanged = YES;
} }
- (BOOL)userDefaultsChanged - (BOOL) userDefaultsChanged
{ {
BOOL hasChanged = userDefaultsChanged; BOOL hasChanged = userDefaultsChanged;
userDefaultsChanged = NO; userDefaultsChanged = NO;
@ -505,17 +526,63 @@ inFileViewerRootedAtPath:(NSString *)rootFullpath
// //
// Animating an Image // Animating an Image
// //
- (void)slideImage:(NSImage *)image - (void) slideImage: (NSImage *)image
from:(NSPoint)fromPoint from: (NSPoint)fromPoint
to:(NSPoint)toPoint to: (NSPoint)toPoint
{} {
}
// //
// Requesting Additional Time before Power Off or Logout // Requesting Additional Time before Power Off or Logout
// //
- (int)extendPowerOffBy:(int)requested - (int) extendPowerOffBy: (int)requested
{ {
return 0; return 0;
} }
@end @end
@implementation NSWorkspace (GNUstep)
/*
* Attempt to start a program. First look in machine/os/libs directory,
* then in machine/os directory, then at top level.
*/
- (NSTask*) launchProgram: (NSString *)prog
atPath: (NSString *)path
{
NSArray *args;
NSTask *task;
NSString *path0;
NSString *path1;
NSString *path2;
NSFileManager *mgr;
/*
* Try to locate the actual executable file and start it running.
*/
path2 = [path stringByAppendingPathComponent: prog];
path = [path stringByAppendingPathComponent: gnustep_target_dir];
path1 = [path stringByAppendingPathComponent: prog];
path = [path stringByAppendingPathComponent: library_combo];
path0 = [path stringByAppendingPathComponent: prog];
mgr = [NSFileManager defaultManager];
if ([mgr isExecutableFileAtPath: path0])
path = path0;
else if ([mgr isExecutableFileAtPath: path1])
path = path1;
else if ([mgr isExecutableFileAtPath: path2])
path = path2;
else
return nil;
args = [NSArray arrayWithObjects: nil];
task = [NSTask launchedTaskWithLaunchPath: path
arguments: args];
return task;
}
@end