From f758b19b0418cdda008b6823146e99ff2649d0c0 Mon Sep 17 00:00:00 2001 From: richard Date: Tue, 12 Oct 1999 18:43:57 +0000 Subject: [PATCH] Tidied git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4997 72102866-910b-0410-8b05-ffd578937521 --- Source/NSApplication.m | 9 +++++++++ Source/NSWorkspace.m | 25 +++++++------------------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/Source/NSApplication.m b/Source/NSApplication.m index 2f3f0de18..872e152a8 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -61,6 +61,7 @@ #include #include #include +#include #include #include #include @@ -173,6 +174,7 @@ NSApplication *NSApp = nil; NSString *appIconFile; NSUserDefaults *defs = [NSUserDefaults standardUserDefaults]; NSString *filePath; + NSDictionary *userInfo; mainModelFile = [infoDict objectForKey: @"NSMainNibFile"]; if (mainModelFile && ![mainModelFile isEqual: @""]) @@ -238,6 +240,13 @@ NSApplication *NSApp = nil; [[NSDocumentController sharedDocumentController] openDocumentWithContentsOfFile:filePath display:YES]; } } + + userInfo = [NSDictionary dictionaryWithObject: + [[NSProcessInfo processInfo] processName] forKey: @"NSApplicationName"]; + [[[NSWorkspace sharedWorkspace] notificationCenter] + postNotificationName: NSWorkspaceDidLaunchApplicationNotification + object: self + userInfo: userInfo]; } - (void) dealloc diff --git a/Source/NSWorkspace.m b/Source/NSWorkspace.m index ea3588c9f..207ddb0c3 100644 --- a/Source/NSWorkspace.m +++ b/Source/NSWorkspace.m @@ -597,7 +597,6 @@ extIconForApp(NSWorkspace *ws, NSString *appName, NSDictionary *typeInfo) { NSString *port = [appName stringByDeletingPathExtension]; id app = nil; - NSDictionary *userinfo = nil; /* * Try to contact a running application. @@ -617,6 +616,7 @@ extIconForApp(NSWorkspace *ws, NSString *appName, NSDictionary *typeInfo) { NSString *path; NSArray *args; + NSDictionary *userinfo = nil; path = [self locateApplicationBinary: appName]; if (path == nil) @@ -628,10 +628,10 @@ extIconForApp(NSWorkspace *ws, NSString *appName, NSDictionary *typeInfo) return NO; } - userinfo = [NSDictionary dictionaryWithObject: appName - forKey: @"NSApplicationName"]; - // App being launched, raise NSWorkspaceWillLaunchApplicationNotification + userinfo = [NSDictionary dictionaryWithObject: port + forKey: @"NSApplicationName"]; + [workspaceCenter postNotificationName: NSWorkspaceWillLaunchApplicationNotification object: self @@ -647,11 +647,6 @@ extIconForApp(NSWorkspace *ws, NSString *appName, NSDictionary *typeInfo) return NO; } - [workspaceCenter - postNotificationName: NSWorkspaceDidLaunchApplicationNotification - object: self - userInfo: userinfo]; - return YES; } else @@ -959,10 +954,10 @@ inFileViewerRootedAtPath: (NSString *)rootFullpath if (path == nil) return NO; - userinfo = [NSDictionary dictionaryWithObject: appName - forKey: @"NSApplicationName"]; - // App being launched, raise NSWorkspaceWillLaunchApplicationNotification + userinfo = [NSDictionary dictionaryWithObject: + [[appName lastPathComponent] stringByDeletingPathExtension] + forKey: @"NSApplicationName"]; [workspaceCenter postNotificationName: NSWorkspaceWillLaunchApplicationNotification object: self @@ -971,12 +966,6 @@ inFileViewerRootedAtPath: (NSString *)rootFullpath if ([NSTask launchedTaskWithLaunchPath: path arguments: nil] == nil) return NO; - // App has been launched raise NSWorkspaceDidLaunchApplicationNotification - [workspaceCenter - postNotificationName: NSWorkspaceDidLaunchApplicationNotification - object: self - userInfo: userinfo]; - return YES; }