mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 05:00:38 +00:00
More server improvements.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@13069 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e49b327939
commit
a1174f8129
2 changed files with 54 additions and 23 deletions
|
@ -1,3 +1,8 @@
|
|||
2002-03-10 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSPasteboard.m: Start gpbs for other server automatically.
|
||||
Improve log messages.
|
||||
|
||||
2002-03-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSPasteboard.m: Use NSHost to look for alternative servers.
|
||||
|
|
|
@ -107,6 +107,7 @@ static NSMapTable *mimeMap = NULL;
|
|||
if (the_server == nil)
|
||||
{
|
||||
NSString *host;
|
||||
NSString *description;
|
||||
|
||||
host = [[NSUserDefaults standardUserDefaults] stringForKey: @"NSHost"];
|
||||
if (host == nil)
|
||||
|
@ -124,14 +125,41 @@ static NSMapTable *mimeMap = NULL;
|
|||
* indicate that we may start a pasteboard server locally.
|
||||
*/
|
||||
h = [NSHost hostWithName: host];
|
||||
if ([h isEqual: [NSHost currentHost]] == YES)
|
||||
if (h == nil)
|
||||
{
|
||||
NSLog(@"Unknown NSHost (%@) ignored", host);
|
||||
host = @"";
|
||||
}
|
||||
else if ([h isEqual: [NSHost currentHost]] == YES)
|
||||
{
|
||||
host = @"";
|
||||
}
|
||||
else
|
||||
{
|
||||
host = [h name];
|
||||
}
|
||||
}
|
||||
|
||||
if ([host length] == 0)
|
||||
{
|
||||
description = @"local host";
|
||||
}
|
||||
else
|
||||
{
|
||||
description = host;
|
||||
}
|
||||
|
||||
the_server = (id<GSPasteboardSvr>)[NSConnection
|
||||
rootProxyForConnectionWithRegisteredName: PBSNAME
|
||||
host: host];
|
||||
rootProxyForConnectionWithRegisteredName: PBSNAME host: host];
|
||||
if (the_server == nil && [host length] > 0)
|
||||
{
|
||||
NSString *service;
|
||||
|
||||
service = [PBSNAME stringByAppendingFormat: @"-%@", host];
|
||||
the_server = (id<GSPasteboardSvr>)[NSConnection
|
||||
rootProxyForConnectionWithRegisteredName: service host: @"*"];
|
||||
}
|
||||
|
||||
if (RETAIN((id)the_server) != nil)
|
||||
{
|
||||
NSConnection* conn = [(id)the_server connectionForProxy];
|
||||
|
@ -142,33 +170,43 @@ static NSMapTable *mimeMap = NULL;
|
|||
name: NSConnectionDidDieNotification
|
||||
object: conn];
|
||||
}
|
||||
else if ([host isEqual: @""] == YES)
|
||||
else
|
||||
{
|
||||
static BOOL recursion = NO;
|
||||
|
||||
if (recursion)
|
||||
{
|
||||
NSLog(@"Unable to contact pasteboard server - "
|
||||
@"please ensure that gpbs is running.");
|
||||
@"please ensure that gpbs is running for %@.", description);
|
||||
return nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
static NSString *cmd = nil;
|
||||
static NSString *cmd = nil;
|
||||
static NSArray *args = nil;
|
||||
|
||||
NSLog(@"\nI couldn't contact the pasteboard server for %@ -\n"
|
||||
@"so I'm attempting to to start one - which will take a few seconds.\n"
|
||||
@"It is recommended that you start the pasteboard server (gpbs) either at\n"
|
||||
@"login or (better) when your computer is started up.\n", description);
|
||||
if (cmd == nil)
|
||||
{
|
||||
#ifdef GNUSTEP_BASE_LIBRARY
|
||||
cmd = RETAIN([[NSSearchPathForDirectoriesInDomains(
|
||||
GSToolsDirectory, NSSystemDomainMask, YES) objectAtIndex: 0]
|
||||
stringByAppendingPathComponent: @"gpbs"]);
|
||||
GSToolsDirectory, NSSystemDomainMask, YES) objectAtIndex: 0]
|
||||
stringByAppendingPathComponent: @"gpbs"]);
|
||||
#else
|
||||
cmd = RETAIN([[@GNUSTEP_INSTALL_PREFIX
|
||||
stringByAppendingPathComponent: @"Tools"]
|
||||
stringByAppendingPathComponent: @"gpbs"]);
|
||||
stringByAppendingPathComponent: @"Tools"]
|
||||
stringByAppendingPathComponent: @"gpbs"]);
|
||||
#endif
|
||||
if ([host length] > 0)
|
||||
{
|
||||
args = [[NSArray alloc] initWithObjects:
|
||||
@"-NSHost", host, nil];
|
||||
}
|
||||
}
|
||||
[NSTask launchedTaskWithLaunchPath: cmd arguments: nil];
|
||||
[NSTask launchedTaskWithLaunchPath: cmd arguments: args];
|
||||
[NSTimer scheduledTimerWithTimeInterval: 5.0
|
||||
invocation: nil
|
||||
repeats: NO];
|
||||
|
@ -179,18 +217,6 @@ static NSMapTable *mimeMap = NULL;
|
|||
recursion = NO;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
the_server = (id<GSPasteboardSvr>)[NSConnection
|
||||
rootProxyForConnectionWithRegisteredName:
|
||||
[PBSNAME stringByAppendingFormat: @"-%@", host] host: @"*"];
|
||||
if (the_server == nil)
|
||||
{
|
||||
NSLog(@"Unable to contact pasteboard server for %@ - "
|
||||
@"please ensure that gpbs is running.", host);
|
||||
}
|
||||
RETAIN(the_server);
|
||||
}
|
||||
}
|
||||
return the_server;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue