Minor fix in last mod.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16406 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2003-04-09 16:34:49 +00:00
parent a4ace9f14b
commit 4261e94931

View file

@ -58,9 +58,7 @@
#include <AppKit/GSServicesManager.h> #include <AppKit/GSServicesManager.h>
@interface NSDocumentController (ApplicationPrivate) static GSServicesManager *manager = nil;
+ (BOOL) isDocumentBasedApplication;
@end
/* /*
* The GSListener class is for talking to other applications. * The GSListener class is for talking to other applications.
@ -227,6 +225,14 @@ NSRegisterServicesProvider(id provider, NSString *name)
if ([delegate respondsToSelector: aSel] == YES) if ([delegate respondsToSelector: aSel] == YES)
return [delegate performv: aSel :frame]; return [delegate performv: aSel :frame];
/*
* If the selector matches the correct form for a file operaqtion
* send the message to the manager.
*/
if ([selName hasPrefix: @"application:"] == YES
&& [manager respondsToSelector: aSel] == YES)
return [(id)manager performv: aSel :frame];
[NSException raise: NSGenericException [NSException raise: NSGenericException
format: @"method %@ not implemented", selName]; format: @"method %@ not implemented", selName];
return nil; return nil;
@ -258,6 +264,17 @@ NSRegisterServicesProvider(id provider, NSString *name)
return; return;
} }
/*
* If the selector matches the correct form for a file operaqtion
* send the message to the manager.
*/
if ([selName hasPrefix: @"application:"] == YES
&& [manager respondsToSelector: aSel] == YES)
{
[anInvocation invokeWithTarget: manager];
return;
}
[NSException raise: NSGenericException [NSException raise: NSGenericException
format: @"method %@ not implemented", selName]; format: @"method %@ not implemented", selName];
} }
@ -322,7 +339,6 @@ NSRegisterServicesProvider(id provider, NSString *name)
@implementation GSServicesManager @implementation GSServicesManager
static GSServicesManager *manager = nil;
static NSString *servicesName = @".GNUstepServices"; static NSString *servicesName = @".GNUstepServices";
static NSString *disabledName = @".GNUstepDisabled"; static NSString *disabledName = @".GNUstepDisabled";
@ -390,20 +406,16 @@ static NSString *disabledName = @".GNUstepDisabled";
id del = [NSApp delegate]; id del = [NSApp delegate];
BOOL result = NO; BOOL result = NO;
[NSApp activateIgnoringOtherApps: YES];
if ([del respondsToSelector: _cmd]) if ([del respondsToSelector: _cmd])
{ {
[NSApp activateIgnoringOtherApps: YES];
result = [del application: theApp openFile: file]; result = [del application: theApp openFile: file];
} }
else if ([NSDocumentController isDocumentBasedApplication] == YES) else if ([[NSDocumentController sharedDocumentController]
{
[NSApp activateIgnoringOtherApps: YES];
if ([[NSDocumentController sharedDocumentController]
openDocumentWithContentsOfFile: file display: YES] != nil) openDocumentWithContentsOfFile: file display: YES] != nil)
{ {
result = YES; result = YES;
} }
}
return result; return result;
} }
@ -417,14 +429,11 @@ static NSString *disabledName = @".GNUstepDisabled";
{ {
result = [del application: theApp openFileWithoutUI: file]; result = [del application: theApp openFileWithoutUI: file];
} }
else if ([NSDocumentController isDocumentBasedApplication] == YES) else if ([[NSDocumentController sharedDocumentController]
{
if ([[NSDocumentController sharedDocumentController]
openDocumentWithContentsOfFile: file display: NO] != nil) openDocumentWithContentsOfFile: file display: NO] != nil)
{ {
result = YES; result = YES;
} }
}
return result; return result;
} }