Make -doService: handle nil return/send types correctly. Fix calls to NSRunAlertPanel().

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@13803 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2002-06-08 18:11:17 +00:00
parent 895dc385f1
commit 818a27807d
2 changed files with 21 additions and 13 deletions

View file

@ -1,3 +1,10 @@
2002-06-08 Alexander Malmberg <alexander@malmberg.org>
* Source/GSServicesProvider.m (-doService:): Only try to
write/read selection if the send/return type isn't nil.
Fix calls to NSRunAlertPanel() so they don't do printf()
expansion on the message twice.
Thu Jun 6 08:29:42 2002 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSScroller.m ([NSScroller -setFrame:]): Do not add

View file

@ -455,8 +455,6 @@ static NSString *disabledName = @".GNUstepDisabled";
NSWindow *resp = [[_application keyWindow] firstResponder];
id obj = nil;
NSLog(@"doService: called");
for (i = 0; i <= es; i++)
{
NSString *sendType;
@ -476,8 +474,9 @@ static NSString *disabledName = @".GNUstepDisabled";
NSPasteboard *pb;
pb = [NSPasteboard pasteboardWithUniqueName];
if ([obj writeSelectionToPasteboard: pb
types: sendTypes] == NO)
if (sendType
&& [obj writeSelectionToPasteboard: pb
types: sendTypes] == NO)
{
NSRunAlertPanel(nil,
@"object failed to write to pasteboard",
@ -485,7 +484,8 @@ static NSString *disabledName = @".GNUstepDisabled";
}
else if (NSPerformService(title, pb) == YES)
{
if ([obj readSelectionFromPasteboard: pb] == NO)
if (returnType
&& [obj readSelectionFromPasteboard: pb] == NO)
{
NSRunAlertPanel(nil,
@"object failed to read from pasteboard",
@ -1259,8 +1259,9 @@ NSPerformService(NSString *serviceItem, NSPasteboard *pboard)
if (service == nil)
{
NSRunAlertPanel(nil,
[NSString stringWithFormat: @"No service matching '%@'", serviceItem],
@"Continue", nil, nil);
@"No service matching '%@'",
@"Continue", nil, nil,
serviceItem);
return NO; /* No matching service. */
}
@ -1288,9 +1289,9 @@ NSPerformService(NSString *serviceItem, NSPasteboard *pboard)
if (provider == nil)
{
NSRunAlertPanel(nil,
[NSString stringWithFormat:
@"Failed to contact service provider for '%@'", serviceItem],
@"Continue", nil, nil);
@"Failed to contact service provider for '%@'",
@"Continue", nil, nil,
serviceItem);
return NO;
}
@ -1327,9 +1328,9 @@ NSPerformService(NSString *serviceItem, NSPasteboard *pboard)
if (error != nil)
{
NSRunAlertPanel(nil,
[NSString stringWithFormat:
@"Failed to contact service provider for '%@'", serviceItem],
@"Continue", nil, nil);
@"Failed to contact service provider for '%@': %@",
@"Continue", nil, nil,
serviceItem, error);
return NO;
}