mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-29 22:07:39 +00:00
Basic implemention of [activeApplication] and [launchedApplications].
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16765 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f4f0732b7d
commit
b52b96da8d
1 changed files with 34 additions and 3 deletions
|
@ -44,6 +44,7 @@
|
|||
#include <Foundation/NSConnection.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSURL.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include <AppKit/NSWorkspace.h>
|
||||
#include <AppKit/NSApplication.h>
|
||||
#include <AppKit/NSImage.h>
|
||||
|
@ -1119,6 +1120,34 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (NSDictionary*) activeApplication
|
||||
{
|
||||
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
|
||||
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[processInfo processName], @"NSApplicationName",
|
||||
[[NSBundle mainBundle] bundlePath], @"NSApplicationPath",
|
||||
[NSNumber numberWithInt: [processInfo processIdentifier]],
|
||||
@"NSApplicationProcessIdentifier",
|
||||
nil];
|
||||
}
|
||||
|
||||
- (NSArray*) launchedApplications
|
||||
{
|
||||
NSDictionary *dict;
|
||||
NSString *app;
|
||||
NSMutableArray *apps = [NSMutableArray array];
|
||||
NSEnumerator *enumerator = [_launched keyEnumerator];
|
||||
|
||||
while ((app = [enumerator nextObject]) != nil)
|
||||
{
|
||||
dict = [NSDictionary dictionaryWithObject: app forKey: @"NSApplicationName"];
|
||||
[apps addObject: dict];
|
||||
}
|
||||
|
||||
return apps;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unmounting a Device
|
||||
*/
|
||||
|
@ -1911,9 +1940,11 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
|
|||
* App being launched, send
|
||||
* NSWorkspaceWillLaunchApplicationNotification
|
||||
*/
|
||||
userinfo = [NSDictionary dictionaryWithObject:
|
||||
[[appName lastPathComponent] stringByDeletingPathExtension]
|
||||
forKey: @"NSApplicationName"];
|
||||
userinfo = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[[appName lastPathComponent] stringByDeletingPathExtension],
|
||||
@"NSApplicationName",
|
||||
appName, @"NSApplicationPath",
|
||||
nil];
|
||||
[_workspaceCenter
|
||||
postNotificationName: NSWorkspaceWillLaunchApplicationNotification
|
||||
object: self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue