mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 01:31:08 +00:00
Add init
This commit is contained in:
parent
09268f3e17
commit
8f3f8c08df
2 changed files with 22 additions and 5 deletions
|
@ -74,13 +74,8 @@ DEFINE_BLOCK_TYPE(GSBatchAccessorCompositeBlock, void, GSBatchAccessorCompletion
|
|||
|
||||
@interface NSFileCoordinator : NSObject
|
||||
{
|
||||
id _accessArbiter;
|
||||
id _fileReactor;
|
||||
id _purposeIdentifier;
|
||||
NSURL *_recentFilePresenterURL;
|
||||
id _accessClaimIDOrIDs;
|
||||
BOOL _isCancelled;
|
||||
NSMutableDictionary *_movedItems;
|
||||
}
|
||||
|
||||
+ (NSArray *) filePresenters;
|
||||
|
|
|
@ -29,9 +29,12 @@
|
|||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSFilePresenter.h>
|
||||
#import <Foundation/NSOperation.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
static NSMutableArray *__presenters = nil;
|
||||
static NSMutableDictionary *__presenterMap = nil;
|
||||
static unsigned int __pid = 0;
|
||||
static NSMutableDictionary *__presenterIdDict = nil;
|
||||
|
||||
@implementation NSFileAccessIntent
|
||||
- (instancetype) init
|
||||
|
@ -80,6 +83,7 @@ static NSMutableDictionary *__presenterMap = nil;
|
|||
{
|
||||
__presenters = [[NSMutableArray alloc] init];
|
||||
__presenterMap = [[NSMutableDictionary alloc] init];
|
||||
__presenterIdDict = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,12 +96,29 @@ static NSMutableDictionary *__presenterMap = nil;
|
|||
{
|
||||
[__presenters addObject: presenter];
|
||||
[__presenterMap setObject: presenter forKey: [presenter presentedItemURL]];
|
||||
[__presenterIdDict setObject: presenter forKey: [presenter purposeIdentifier]];
|
||||
}
|
||||
|
||||
+ (void) removeFilePresenter: (id)presenter
|
||||
{
|
||||
[__presenters removeObject: presenter];
|
||||
[__presenterMap removeObjectForKey: [presenter presentedItemURL]];
|
||||
[__presenterIdDict removeObjectForKey: [presenter purposeIdentifier]];
|
||||
}
|
||||
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [super init];
|
||||
if(self != nil)
|
||||
{
|
||||
NSString *p = nil;
|
||||
|
||||
__pid++;
|
||||
p = [NSString stringWithFormat: @"%d",__pid];
|
||||
_purposeIdentifier = RETAIN(p);
|
||||
_isCancelled = NO;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *) purposeIdentifier
|
||||
|
@ -120,6 +141,7 @@ static NSMutableDictionary *__presenterMap = nil;
|
|||
NSOperationQueue *q = [o presentedItemOperationQueue];
|
||||
[q cancelAllOperations];
|
||||
}
|
||||
_isCancelled = YES;
|
||||
}
|
||||
|
||||
- (void)coordinateAccessWithIntents: (NSArray *)intents
|
||||
|
|
Loading…
Reference in a new issue