// // P4Client.h // MBMenuExtra // // Created by Michael Bishop on 12/18/09. // Copyright 2009 Perforce Software. All rights reserved. // #import "P4User.h" #import "P4SpecManager.h" #import "NGAUtilities.h" @implementation P4User -(NSSet*)clients { // TODO: The code here that pulls the clients from the server should be put in // the fetched property implementation. In addition, the date stamp should be stored // so it doesn't fetch all the time. NSFetchRequest * fetchRequest = [self.manager fetchRequestForType:@"client"]; NSPredicate * predicate = [NSComparisonPredicate predicateWithLeftExpression:[NSExpression expressionForKeyPath:@"owner"] rightExpression:[NSExpression expressionForConstantValue:self.identifier] modifier:NSDirectPredicateModifier type:NSEqualToPredicateOperatorType options:0]; [fetchRequest setPredicate:predicate]; if ( _isLoadingClients || (_lastRefreshDate && [_lastRefreshDate timeIntervalSinceNow] < [self refreshInterval]) ) return _clients; _isLoadingClients = YES; [_clients release]; NSArray * clientArray = [self.manager executeFetchRequest:fetchRequest incrementalUpdateBlock:nil completionBlock:^(NSArray * speclist, NSError * error){ _isLoadingClients = NO; if ( error ) return; [_lastRefreshDate release]; _lastRefreshDate = [[NSDate date] retain]; [self willChangeValueForKey:@"clients"]; [_clients release]; _clients = [NSSet setWithArray:speclist]; [_clients retain]; [self didChangeValueForKey:@"clients"]; }]; _clients = [NSSet setWithArray:clientArray]; [_clients retain]; return _clients; } -(void)refresh:(id)sender { RELEASE(_clients); RELEASE(_lastRefreshDate); [super refresh:sender]; } @end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 20722 | jdputsch | initial branch, prep for -Zapp= support | ||
//guest/michael_bishop/MacMenu/src/P4ObjectLayer/P4User.m | |||||
#1 | 8331 | Matt Attaway |
Adding initial version of MacMenu for Perforce MacMenu is a helpful Perforce client that sits in your toolbar. It allows you to run standard Perforce operations on the document that is open the currently active editor/viewer. |