mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
Fixes for better workspace notification and to allow shutdown of an app
by an external process. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@21784 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bd8fb5fc53
commit
b5c8c6000c
3 changed files with 57 additions and 7 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2005-10-08 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSWorkspace.m: Provide private method to post a notification
|
||||
to the local workspace center, using the shared workspace app as the
|
||||
notification object. Fix handling of incoming notifications so that
|
||||
they use the new method and are therefore posted locally with the
|
||||
correct notification object.
|
||||
* Source/GSServicesManager.m: Make applications respond to the
|
||||
terminate: method sent from another app, but send a power off
|
||||
notification first, on the assumption that a terminate sent by
|
||||
a remote process is a power off or session manager shutdown or
|
||||
some similar event indicating that the process is likely to be
|
||||
forcably killed if it doesn't close down gracefully.
|
||||
|
||||
2005-10-05 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSCell.m (-setObjectValue:, -setStringValue:): When no
|
||||
|
|
|
@ -156,6 +156,11 @@ NSRegisterServicesProvider(id provider, NSString *name)
|
|||
ASSIGN(providerName, name);
|
||||
}
|
||||
|
||||
|
||||
@interface NSNotificationCenter (NSWorkspacePrivate)
|
||||
- (void) _postLocal: (NSString*)name userInfo: (NSDictionary*)info;
|
||||
@end
|
||||
|
||||
/**
|
||||
* The GSListener class exists as a proxy to forward messages to
|
||||
* service provider objects. It implements very few methods and
|
||||
|
@ -248,12 +253,25 @@ NSRegisterServicesProvider(id provider, NSString *name)
|
|||
SEL aSel = [anInvocation selector];
|
||||
NSString *selName = NSStringFromSelector(aSel);
|
||||
|
||||
/*
|
||||
* If the selector matches the correct form for a services request,
|
||||
* send the message to the services provider.
|
||||
*/
|
||||
if ([selName hasSuffix: @":userData:error:"])
|
||||
if ([selName isEqualToString: @"terminate:"])
|
||||
{
|
||||
NSNotificationCenter *c;
|
||||
|
||||
/*
|
||||
* Send a power off notification before asking app to terminate.
|
||||
*/
|
||||
c = [[NSWorkspace sharedWorkspace] notificationCenter];
|
||||
[c _postLocal: NSWorkspaceWillPowerOffNotification userInfo: nil];
|
||||
|
||||
[anInvocation invokeWithTarget: NSApp];
|
||||
return;
|
||||
}
|
||||
else if ([selName hasSuffix: @":userData:error:"])
|
||||
{
|
||||
/*
|
||||
* The selector matches the correct form for a services request,
|
||||
* so send the message to the services provider.
|
||||
*/
|
||||
if ([servicesProvider respondsToSelector: aSel] == YES)
|
||||
{
|
||||
NSPasteboard *pb;
|
||||
|
@ -329,7 +347,11 @@ NSRegisterServicesProvider(id provider, NSString *name)
|
|||
NSMethodSignature *sig = nil;
|
||||
NSString *selName = NSStringFromSelector(aSelector);
|
||||
|
||||
if ([selName hasSuffix: @":userData:error:"])
|
||||
if ([selName isEqualToString: @"terminate:"])
|
||||
{
|
||||
sig = [NSApp methodSignatureForSelector: aSelector];
|
||||
}
|
||||
else if ([selName hasSuffix: @":userData:error:"])
|
||||
{
|
||||
sig = [servicesProvider methodSignatureForSelector: aSelector];
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ static NSString *GSWorkspaceNotification = @"GSWorkspaceNotification";
|
|||
NSDistributedNotificationCenter *remote;
|
||||
}
|
||||
- (void) _handleRemoteNotification: (NSNotification*)aNotification;
|
||||
- (void) _postLocal: (NSString*)name userInfo: (NSDictionary*)info;
|
||||
@end
|
||||
|
||||
@implementation _GSWorkspaceCenter
|
||||
|
@ -181,9 +182,22 @@ static NSString *GSWorkspaceNotification = @"GSWorkspaceNotification";
|
|||
*/
|
||||
- (void) _handleRemoteNotification: (NSNotification*)aNotification
|
||||
{
|
||||
[super postNotification: aNotification];
|
||||
[self _postLocal: [aNotification name]
|
||||
userInfo: [aNotification userInfo]];
|
||||
}
|
||||
|
||||
/*
|
||||
* Method allowing a notification to be posted locally.
|
||||
*/
|
||||
- (void) _postLocal: (NSString*)name userInfo: (NSDictionary*)info
|
||||
{
|
||||
NSNotification *aNotification;
|
||||
|
||||
aNotification = [NSNotification notificationWithName: name
|
||||
object: self
|
||||
userInfo: info];
|
||||
[super postNotification: aNotification];
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue