Application launch fixes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4996 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-10-12 18:20:22 +00:00
parent c27b641394
commit 1334dec400
3 changed files with 52 additions and 3 deletions

View file

@ -1,4 +1,4 @@
/*
/*
NSWorkspace.m
Description...
@ -597,6 +597,7 @@ extIconForApp(NSWorkspace *ws, NSString *appName, NSDictionary *typeInfo)
{
NSString *port = [appName stringByDeletingPathExtension];
id app = nil;
NSDictionary *userinfo = nil;
/*
* Try to contact a running application.
@ -626,6 +627,16 @@ extIconForApp(NSWorkspace *ws, NSString *appName, NSDictionary *typeInfo)
@"Continue", nil, nil);
return NO;
}
userinfo = [NSDictionary dictionaryWithObject: appName
forKey: @"NSApplicationName"];
// App being launched, raise NSWorkspaceWillLaunchApplicationNotification
[workspaceCenter
postNotificationName: NSWorkspaceWillLaunchApplicationNotification
object: self
userInfo: userinfo];
args = [NSArray arrayWithObjects: @"-GSFilePath", fullPath, nil];
if ([NSTask launchedTaskWithLaunchPath: path arguments: args] == nil)
{
@ -635,6 +646,12 @@ extIconForApp(NSWorkspace *ws, NSString *appName, NSDictionary *typeInfo)
@"Continue", nil, nil);
return NO;
}
[workspaceCenter
postNotificationName: NSWorkspaceDidLaunchApplicationNotification
object: self
userInfo: userinfo];
return YES;
}
else
@ -935,12 +952,31 @@ inFileViewerRootedAtPath: (NSString *)rootFullpath
autolaunch: (BOOL)autolaunch
{
NSString *path;
NSDictionary *userinfo;
path = [self locateApplicationBinary: appName];
if (path == nil)
return NO;
userinfo = [NSDictionary dictionaryWithObject: appName
forKey: @"NSApplicationName"];
// App being launched, raise NSWorkspaceWillLaunchApplicationNotification
[workspaceCenter
postNotificationName: NSWorkspaceWillLaunchApplicationNotification
object: self
userInfo: userinfo];
if ([NSTask launchedTaskWithLaunchPath: path arguments: nil] == nil)
return NO;
// App has been launched raise NSWorkspaceDidLaunchApplicationNotification
[workspaceCenter
postNotificationName: NSWorkspaceDidLaunchApplicationNotification
object: self
userInfo: userinfo];
return YES;
}