mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 23:31:02 +00:00
Fixup to behave like MacOS-X on duplicate launch.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@22134 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bd69452e95
commit
beb8fdb1fe
1 changed files with 16 additions and 71 deletions
|
@ -1048,28 +1048,27 @@ static NSString *disabledName = @".GNUstepDisabled";
|
|||
if (registered == NO)
|
||||
{
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
NSString *def = [defs objectForKey: @"NSUseRunningCopy"];
|
||||
int result;
|
||||
if ([defs boolForKey: @"NSUseRunningCopy"] == YES)
|
||||
{
|
||||
id app;
|
||||
|
||||
if (def != nil)
|
||||
{
|
||||
if ([def boolValue] == YES)
|
||||
/*
|
||||
* Try to activate the other app and terminate self.
|
||||
*/
|
||||
app = [NSConnection rootProxyForConnectionWithRegisteredName: appName
|
||||
host: @""];
|
||||
NS_DURING
|
||||
{
|
||||
result = NSAlertOtherReturn;
|
||||
[app activateIgnoringOtherApps: YES];
|
||||
}
|
||||
else
|
||||
NS_HANDLER
|
||||
{
|
||||
result = NSAlertAlternateReturn;
|
||||
/* maybe it terminated. */
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
registered = NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = NSRunAlertPanel(appName,
|
||||
@"Application may already be running with this name",
|
||||
@"Continue", @"Abort", @"Rename");
|
||||
}
|
||||
|
||||
if (result == NSAlertOtherReturn)
|
||||
{
|
||||
unsigned count = 0;
|
||||
|
||||
|
@ -1093,64 +1092,10 @@ static NSString *disabledName = @".GNUstepDisabled";
|
|||
}
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
}
|
||||
|
||||
if (result == NSAlertDefaultReturn)
|
||||
{
|
||||
id app;
|
||||
|
||||
/*
|
||||
* Try to terminate the other app and run using normal name.
|
||||
*/
|
||||
app = [NSConnection rootProxyForConnectionWithRegisteredName: appName
|
||||
host: @""];
|
||||
NS_DURING
|
||||
{
|
||||
[app terminate: nil];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
/* maybe it terminated. */
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
NSRegisterServicesProvider(self, appName);
|
||||
registered = YES;
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
registered = NO;
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
|
||||
if (result == NSAlertAlternateReturn)
|
||||
{
|
||||
id app;
|
||||
|
||||
/*
|
||||
* Try to activate the other app and terminate self.
|
||||
*/
|
||||
app = [NSConnection rootProxyForConnectionWithRegisteredName: appName
|
||||
host: @""];
|
||||
NS_DURING
|
||||
{
|
||||
[app activateIgnoringOtherApps: YES];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
/* maybe it terminated. */
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
registered = NO;
|
||||
}
|
||||
|
||||
if (result == NSAlertDefaultReturn || result == NSAlertOtherReturn)
|
||||
{
|
||||
if (registered == NO)
|
||||
{
|
||||
int result;
|
||||
|
||||
/*
|
||||
* Something is seriously wrong - we can't talk to the
|
||||
* nameserver, so all interaction with the workspace manager
|
||||
|
|
Loading…
Reference in a new issue