mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 08:20:49 +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>
|
2002-03-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSPasteboard.m: Use NSHost to look for alternative servers.
|
* Source/NSPasteboard.m: Use NSHost to look for alternative servers.
|
||||||
|
|
|
@ -107,6 +107,7 @@ static NSMapTable *mimeMap = NULL;
|
||||||
if (the_server == nil)
|
if (the_server == nil)
|
||||||
{
|
{
|
||||||
NSString *host;
|
NSString *host;
|
||||||
|
NSString *description;
|
||||||
|
|
||||||
host = [[NSUserDefaults standardUserDefaults] stringForKey: @"NSHost"];
|
host = [[NSUserDefaults standardUserDefaults] stringForKey: @"NSHost"];
|
||||||
if (host == nil)
|
if (host == nil)
|
||||||
|
@ -124,14 +125,41 @@ static NSMapTable *mimeMap = NULL;
|
||||||
* indicate that we may start a pasteboard server locally.
|
* indicate that we may start a pasteboard server locally.
|
||||||
*/
|
*/
|
||||||
h = [NSHost hostWithName: host];
|
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 = @"";
|
host = @"";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
host = [h name];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ([host length] == 0)
|
||||||
|
{
|
||||||
|
description = @"local host";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
description = host;
|
||||||
|
}
|
||||||
|
|
||||||
the_server = (id<GSPasteboardSvr>)[NSConnection
|
the_server = (id<GSPasteboardSvr>)[NSConnection
|
||||||
rootProxyForConnectionWithRegisteredName: PBSNAME
|
rootProxyForConnectionWithRegisteredName: PBSNAME host: host];
|
||||||
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)
|
if (RETAIN((id)the_server) != nil)
|
||||||
{
|
{
|
||||||
NSConnection* conn = [(id)the_server connectionForProxy];
|
NSConnection* conn = [(id)the_server connectionForProxy];
|
||||||
|
@ -142,33 +170,43 @@ static NSMapTable *mimeMap = NULL;
|
||||||
name: NSConnectionDidDieNotification
|
name: NSConnectionDidDieNotification
|
||||||
object: conn];
|
object: conn];
|
||||||
}
|
}
|
||||||
else if ([host isEqual: @""] == YES)
|
else
|
||||||
{
|
{
|
||||||
static BOOL recursion = NO;
|
static BOOL recursion = NO;
|
||||||
|
|
||||||
if (recursion)
|
if (recursion)
|
||||||
{
|
{
|
||||||
NSLog(@"Unable to contact pasteboard server - "
|
NSLog(@"Unable to contact pasteboard server - "
|
||||||
@"please ensure that gpbs is running.");
|
@"please ensure that gpbs is running for %@.", description);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
else
|
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)
|
if (cmd == nil)
|
||||||
{
|
{
|
||||||
#ifdef GNUSTEP_BASE_LIBRARY
|
#ifdef GNUSTEP_BASE_LIBRARY
|
||||||
cmd = RETAIN([[NSSearchPathForDirectoriesInDomains(
|
cmd = RETAIN([[NSSearchPathForDirectoriesInDomains(
|
||||||
GSToolsDirectory, NSSystemDomainMask, YES) objectAtIndex: 0]
|
GSToolsDirectory, NSSystemDomainMask, YES) objectAtIndex: 0]
|
||||||
stringByAppendingPathComponent: @"gpbs"]);
|
stringByAppendingPathComponent: @"gpbs"]);
|
||||||
#else
|
#else
|
||||||
cmd = RETAIN([[@GNUSTEP_INSTALL_PREFIX
|
cmd = RETAIN([[@GNUSTEP_INSTALL_PREFIX
|
||||||
stringByAppendingPathComponent: @"Tools"]
|
stringByAppendingPathComponent: @"Tools"]
|
||||||
stringByAppendingPathComponent: @"gpbs"]);
|
stringByAppendingPathComponent: @"gpbs"]);
|
||||||
#endif
|
#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
|
[NSTimer scheduledTimerWithTimeInterval: 5.0
|
||||||
invocation: nil
|
invocation: nil
|
||||||
repeats: NO];
|
repeats: NO];
|
||||||
|
@ -179,18 +217,6 @@ static NSMapTable *mimeMap = NULL;
|
||||||
recursion = NO;
|
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;
|
return the_server;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue