mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 06:51:08 +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)
|
if (registered == NO)
|
||||||
{
|
{
|
||||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||||
NSString *def = [defs objectForKey: @"NSUseRunningCopy"];
|
if ([defs boolForKey: @"NSUseRunningCopy"] == YES)
|
||||||
int result;
|
{
|
||||||
|
id app;
|
||||||
|
|
||||||
if (def != nil)
|
/*
|
||||||
|
* Try to activate the other app and terminate self.
|
||||||
|
*/
|
||||||
|
app = [NSConnection rootProxyForConnectionWithRegisteredName: appName
|
||||||
|
host: @""];
|
||||||
|
NS_DURING
|
||||||
{
|
{
|
||||||
if ([def boolValue] == YES)
|
[app activateIgnoringOtherApps: YES];
|
||||||
|
}
|
||||||
|
NS_HANDLER
|
||||||
{
|
{
|
||||||
result = NSAlertOtherReturn;
|
/* maybe it terminated. */
|
||||||
|
}
|
||||||
|
NS_ENDHANDLER
|
||||||
|
registered = NO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
result = NSAlertAlternateReturn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = NSRunAlertPanel(appName,
|
|
||||||
@"Application may already be running with this name",
|
|
||||||
@"Continue", @"Abort", @"Rename");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result == NSAlertOtherReturn)
|
|
||||||
{
|
{
|
||||||
unsigned count = 0;
|
unsigned count = 0;
|
||||||
|
|
||||||
|
@ -1093,64 +1092,10 @@ static NSString *disabledName = @".GNUstepDisabled";
|
||||||
}
|
}
|
||||||
NS_ENDHANDLER
|
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)
|
if (registered == NO)
|
||||||
{
|
{
|
||||||
|
int result;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Something is seriously wrong - we can't talk to the
|
* Something is seriously wrong - we can't talk to the
|
||||||
* nameserver, so all interaction with the workspace manager
|
* nameserver, so all interaction with the workspace manager
|
||||||
|
|
Loading…
Reference in a new issue