mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 21:31:56 +00:00
Run make_services if necessary
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3234 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
de2073c0fe
commit
f10bee0395
2 changed files with 88 additions and 27 deletions
|
@ -38,10 +38,20 @@
|
||||||
# Flags dealing with compiling and linking
|
# Flags dealing with compiling and linking
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# GNUSTEP_INSTALL_PREFIX must be defined here and not in config.h because
|
||||||
|
# the installing person may set it on the `make' command line.
|
||||||
|
GNUSTEP_INSTALL_PREFIX=$(GNUSTEP_SYSTEM_ROOT)
|
||||||
|
|
||||||
# Additional flags to pass to the preprocessor
|
# Additional flags to pass to the preprocessor
|
||||||
GNUSTEP_INSTALL_LIBDIR=$(GNUSTEP_LIBRARIES_ROOT)
|
GNUSTEP_INSTALL_LIBDIR=$(GNUSTEP_LIBRARIES_ROOT)
|
||||||
ADDITIONAL_CPPFLAGS = -DGNUSTEP_INSTALL_LIBDIR=\"$(GNUSTEP_INSTALL_LIBDIR)\" \
|
ADDITIONAL_CPPFLAGS = -DGNUSTEP_INSTALL_LIBDIR=\"$(GNUSTEP_INSTALL_LIBDIR)\" \
|
||||||
${DPS_DEFINE}
|
${DPS_DEFINE} \
|
||||||
|
-DGNUSTEP_INSTALL_PREFIX=$(GNUSTEP_INSTALL_PREFIX) \
|
||||||
|
-DGNUSTEP_TARGET_DIR=\"$(GNUSTEP_TARGET_DIR)\" \
|
||||||
|
-DGNUSTEP_TARGET_CPU=\"$(GNUSTEP_TARGET_CPU)\" \
|
||||||
|
-DGNUSTEP_TARGET_OS=\"$(GNUSTEP_TARGET_OS)\" \
|
||||||
|
-DLIBRARY_COMBO=\"$(LIBRARY_COMBO)\"
|
||||||
|
|
||||||
|
|
||||||
# Additional flags to pass to the Objective-C compiler
|
# Additional flags to pass to the Objective-C compiler
|
||||||
ADDITIONAL_OBJCFLAGS = -g -Wall
|
ADDITIONAL_OBJCFLAGS = -g -Wall
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include <gnustep/gui/config.h>
|
#include <gnustep/gui/config.h>
|
||||||
#include <AppKit/NSPasteboard.h>
|
#include <AppKit/NSPasteboard.h>
|
||||||
|
#include <AppKit/NSApplication.h>
|
||||||
#include "../Tools/PasteboardServer.h"
|
#include "../Tools/PasteboardServer.h"
|
||||||
#include <Foundation/NSArray.h>
|
#include <Foundation/NSArray.h>
|
||||||
#include <Foundation/NSData.h>
|
#include <Foundation/NSData.h>
|
||||||
|
@ -38,10 +39,15 @@
|
||||||
#include <Foundation/NSNotification.h>
|
#include <Foundation/NSNotification.h>
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <Foundation/NSLock.h>
|
#include <Foundation/NSLock.h>
|
||||||
|
#include <Foundation/NSPortNameServer.h>
|
||||||
#include <Foundation/NSProcessInfo.h>
|
#include <Foundation/NSProcessInfo.h>
|
||||||
#include <Foundation/NSSerialization.h>
|
#include <Foundation/NSSerialization.h>
|
||||||
#include <Foundation/NSUserDefaults.h>
|
#include <Foundation/NSUserDefaults.h>
|
||||||
|
|
||||||
|
#define stringify_it(X) #X
|
||||||
|
#define prog_path(X,Y) \
|
||||||
|
stringify_it(X) "/Tools/" GNUSTEP_TARGET_DIR "/" LIBRARY_COMBO Y
|
||||||
|
|
||||||
@interface NSPasteboard (Private)
|
@interface NSPasteboard (Private)
|
||||||
+ (id<PasteboardServer>) _pbs;
|
+ (id<PasteboardServer>) _pbs;
|
||||||
+ (NSPasteboard*) _pasteboardWithTarget: (id<PasteboardObject>)aTarget
|
+ (NSPasteboard*) _pasteboardWithTarget: (id<PasteboardObject>)aTarget
|
||||||
|
@ -84,30 +90,47 @@ static id<PasteboardServer> the_server = nil;
|
||||||
|
|
||||||
+ (id<PasteboardServer>) _pbs
|
+ (id<PasteboardServer>) _pbs
|
||||||
{
|
{
|
||||||
if (the_server == nil) {
|
if (the_server == nil)
|
||||||
NSString* host;
|
{
|
||||||
|
NSString* host;
|
||||||
|
|
||||||
host = [[NSUserDefaults standardUserDefaults] stringForKey: @"NSHost"];
|
host = [[NSUserDefaults standardUserDefaults] stringForKey: @"NSHost"];
|
||||||
if (host == nil) {
|
if (host == nil)
|
||||||
host = [[NSProcessInfo processInfo] hostName];
|
{
|
||||||
}
|
host = [[NSProcessInfo processInfo] hostName];
|
||||||
the_server = (id<PasteboardServer>)[NSConnection
|
}
|
||||||
rootProxyForConnectionWithRegisteredName: PBSNAME
|
the_server = (id<PasteboardServer>)[NSConnection
|
||||||
host: host];
|
rootProxyForConnectionWithRegisteredName: PBSNAME
|
||||||
if ([(id)the_server retain]) {
|
host: host];
|
||||||
NSConnection* conn = [(id)the_server connectionForProxy];
|
if ([(id)the_server retain])
|
||||||
|
{
|
||||||
|
NSConnection* conn = [(id)the_server connectionForProxy];
|
||||||
|
|
||||||
[NSNotificationCenter
|
[NSNotificationCenter addObserver: self
|
||||||
addObserver: self
|
selector: @selector(_lostServer:)
|
||||||
selector: @selector(_lostServer:)
|
name: NSConnectionDidDieNotification
|
||||||
name: NSConnectionDidDieNotification
|
object: conn];
|
||||||
object: conn];
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static BOOL recursion = NO;
|
||||||
|
|
||||||
|
if (recursion)
|
||||||
|
{
|
||||||
|
NSLog(@"Unable to contact pasteboard server - "
|
||||||
|
@"please ensure that gpbs is running.\n");
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
system(prog_path(GNUSTEP_INSTALL_PREFIX, "/gpbs &"));
|
||||||
|
sleep(5);
|
||||||
|
recursion = YES;
|
||||||
|
[self _pbs];
|
||||||
|
recursion = NO;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
NSLog(@"Unable to contact pasteboard server - "
|
|
||||||
@"please ensure that gpbs is running.\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return the_server;
|
return the_server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +155,7 @@ static id<PasteboardServer> the_server = nil;
|
||||||
* If this is the case, our proxy for the object on the server will be
|
* If this is the case, our proxy for the object on the server will be
|
||||||
* out of date, so we swap it for the newly created one.
|
* out of date, so we swap it for the newly created one.
|
||||||
*/
|
*/
|
||||||
if (p->target != aTarget) {
|
if (p->target != (id)aTarget) {
|
||||||
[p->target autorelease];
|
[p->target autorelease];
|
||||||
p->target = [(id)aTarget retain];
|
p->target = [(id)aTarget retain];
|
||||||
}
|
}
|
||||||
|
@ -660,17 +683,20 @@ provideDataForType:(NSString *)type
|
||||||
static NSString* contentsPrefix = @"NSTypedFileContentsPboardType:";
|
static NSString* contentsPrefix = @"NSTypedFileContentsPboardType:";
|
||||||
static NSString* namePrefix = @"NSTypedFilenamesPboardType:";
|
static NSString* namePrefix = @"NSTypedFilenamesPboardType:";
|
||||||
|
|
||||||
NSString *NSCreateFileContentsPboardType(NSString *fileType)
|
NSString*
|
||||||
|
NSCreateFileContentsPboardType(NSString *fileType)
|
||||||
{
|
{
|
||||||
return [NSString stringWithFormat:@"%@%@", contentsPrefix, fileType];
|
return [NSString stringWithFormat:@"%@%@", contentsPrefix, fileType];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *NSCreateFilenamePboardType(NSString *filename)
|
NSString*
|
||||||
|
NSCreateFilenamePboardType(NSString *filename)
|
||||||
{
|
{
|
||||||
return [NSString stringWithFormat:@"%@%@", namePrefix, filename];
|
return [NSString stringWithFormat:@"%@%@", namePrefix, filename];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *NSGetFileType(NSString *pboardType)
|
NSString*
|
||||||
|
NSGetFileType(NSString *pboardType)
|
||||||
{
|
{
|
||||||
if ([pboardType hasPrefix: contentsPrefix]) {
|
if ([pboardType hasPrefix: contentsPrefix]) {
|
||||||
return [pboardType substringFromIndex: [contentsPrefix length]];
|
return [pboardType substringFromIndex: [contentsPrefix length]];
|
||||||
|
@ -681,7 +707,8 @@ NSString *NSGetFileType(NSString *pboardType)
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSArray *NSGetFileTypes(NSArray *pboardTypes)
|
NSArray*
|
||||||
|
NSGetFileTypes(NSArray *pboardTypes)
|
||||||
{
|
{
|
||||||
NSMutableArray *a = [NSMutableArray arrayWithCapacity: [pboardTypes count]];
|
NSMutableArray *a = [NSMutableArray arrayWithCapacity: [pboardTypes count]];
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -699,5 +726,29 @@ NSArray *NSGetFileTypes(NSArray *pboardTypes)
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NSUpdateDynamicServices()
|
||||||
|
{
|
||||||
|
system(prog_path(GNUSTEP_INSTALL_PREFIX, "/make_services"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static NSConnection *listener = nil;
|
||||||
|
|
||||||
|
void
|
||||||
|
NSRegisterServicesProvider(id provider, NSString *name)
|
||||||
|
{
|
||||||
|
if (listener)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Ensure there is no previous listener and nothing else using
|
||||||
|
* the given port name.
|
||||||
|
*/
|
||||||
|
[[NSPortNameServer defaultPortNameServer] removePortForName: name];
|
||||||
|
[listener release];
|
||||||
|
}
|
||||||
|
listener = [NSConnection newRegisteringAtName: name
|
||||||
|
withRootObject: provider];
|
||||||
|
[listener retain];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue