sharingAccountsNode = [[PithosSharingAccountsNode alloc] initWithPithos:self.pithos];
sharingAccountsNode.childrenUpdatedNotificationName = nil;
sharingAccountsNode.inheritChildrenUpdatedNotificationName = YES;
+ sharingAccountsNode.pithosAccountManager = self;
}
return sharingAccountsNode;
}
}
- (NSString *)displayName {
- if (displayName == nil)
- return [NSString stringWithString:(sharingAccount ? sharingAccount : @"account")];
+ if (displayName == nil) {
+ if (!sharingAccount) {
+ return @"account";
+ } else if (pithosAccountManager) {
+ return [pithosAccountManager displaynameForUUID:sharingAccount safe:YES];
+ } else {
+ return [sharingAccount copy];
+ }
+ }
return [displayName copy];
}
node.shared = shared;
node.sharingAccount = sharingAccount;
node.inheritChildrenUpdatedNotificationName = inheritChildrenUpdatedNotificationName;
+ node.pithosAccountManager = pithosAccountManager;
if (children) {
NSUInteger oldIndex = [children indexOfObject:node];
if (oldIndex != NSNotFound) {
#import <Cocoa/Cocoa.h>
#import "PithosActivityFacility.h"
@class ASIPithos;
+@class PithosAccount;
@class PithosNode;
@class PithosAccountNode;
@class PithosSharingAccountsNode;
ASIPithos *pithos;
+ PithosAccount *__unsafe_unretained pithosAccountManager;
PithosNode *rootNode;
PithosAccountNode *accountNode;
PithosEmptyNode *containersNode;
@property (nonatomic, strong) ASIPithos *pithos;
+@property (nonatomic, unsafe_unretained) PithosAccount *pithosAccountManager;
@property (nonatomic, strong) PithosAccountNode *accountNode;
@property (nonatomic, unsafe_unretained) IBOutlet NSSplitView *verticalSplitView;
@implementation PithosBrowserController
@synthesize pithos;
-@synthesize accountNode;
+@synthesize pithosAccountManager, accountNode;
@synthesize verticalSplitView, horizontalSplitView, leftTopView, leftBottomView, outlineView, browser, outlineViewMenu, browserMenu;
@synthesize draggedNodes, draggedParentNode;
@synthesize clipboardNodes, clipboardParentNode, clipboardCopy;
activityFacility = [PithosActivityFacility defaultPithosActivityFacility];
self.accountNode = [[PithosAccountNode alloc] initWithPithos:pithos];
+ accountNode.pithosAccountManager = pithosAccountManager;
containersNode = [[PithosEmptyNode alloc] initWithDisplayName:@"CONTAINERS" icon:nil];
containersNodeChildren = [[NSMutableArray alloc] init];
sharedNode = [[PithosEmptyNode alloc] initWithDisplayName:@"SHARED" icon:nil];
mySharedNode = [[PithosAccountNode alloc] initWithPithos:pithos];
+ mySharedNode.pithosAccountManager = pithosAccountManager;
mySharedNode.displayName = @"shared by me";
mySharedNode.shared = YES;
mySharedNode.icon = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kUserIcon)];
othersSharedNode = [[PithosSharingAccountsNode alloc] initWithPithos:pithos];
+ othersSharedNode.pithosAccountManager = pithosAccountManager;
othersSharedNode.displayName = @"shared with me";
othersSharedNode.icon = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGroupIcon)];
[downloadCallbackQueue setSuspended:NO];
accountNode.pithos = pithos;
+ accountNode.pithosAccountManager = pithosAccountManager;
[accountNode forceRefresh];
mySharedNode.pithos = pithos;
+ mySharedNode.pithosAccountManager = pithosAccountManager;
[mySharedNode forceRefresh];
othersSharedNode.pithos = pithos;
+ othersSharedNode.pithosAccountManager = pithosAccountManager;
[othersSharedNode forceRefresh];
// [activityFacility reset];
node.shared = shared;
node.sharingAccount = sharingAccount;
node.inheritChildrenUpdatedNotificationName = inheritChildrenUpdatedNotificationName;
+ node.pithosAccountManager = pithosAccountManager;
if (children) {
NSUInteger oldIndex = [children indexOfObject:node];
if (oldIndex != NSNotFound) {
node.shared = shared;
node.sharingAccount = sharingAccount;
node.inheritChildrenUpdatedNotificationName = inheritChildrenUpdatedNotificationName;
+ node.pithosAccountManager = pithosAccountManager;
if (children) {
NSUInteger oldIndex = [children indexOfObject:node];
if (oldIndex != NSNotFound) {
node.shared = shared;
node.sharingAccount = sharingAccount;
node.inheritChildrenUpdatedNotificationName = inheritChildrenUpdatedNotificationName;
+ node.pithosAccountManager = pithosAccountManager;
if (children) {
NSUInteger oldIndex = [children indexOfObject:node];
if (oldIndex != NSNotFound) {
#import "ASIPithos.h"
#import "ASIPithosAccount.h"
#import "ASIDownloadCache.h"
+#import "PithosAccount.h"
#import "PithosUtilities.h"
#import "PithosActivityFacility.h"
DLog(@"using newChildren");
newChildren = [[NSMutableArray alloc] init];
NSMutableIndexSet *keptNodes = [NSMutableIndexSet indexSet];
+ NSMutableArray *sharingAccountsNames = [NSMutableArray arrayWithCapacity:sharingAccounts.count];
for (ASIPithosAccount *account in sharingAccounts) {
+ [sharingAccountsNames addObject:account.name];
if (![account.name isEqualToString:pithos.authUser]) {
PithosAccountNode *node = [[PithosAccountNode alloc] initWithPithos:pithos];
node.parent = self;
node.shared = shared;
node.sharingAccount = account.name;
node.inheritChildrenUpdatedNotificationName = inheritChildrenUpdatedNotificationName;
+ node.pithosAccountManager = pithosAccountManager;
if (children) {
NSUInteger oldIndex = [children indexOfObject:node];
if (oldIndex != NSNotFound) {
[newChildren addObject:node];
}
}
+ [pithosAccountManager updateUserCatalogForForDisplaynames:nil UUIDs:sharingAccountsNames];
[[children objectsAtIndexes:
[[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [children count])] indexesPassingTest:^(NSUInteger idx, BOOL *stop){
if ([keptNodes containsIndex:idx])
if (currentPithosAccount.active) {
[self savePithosAccounts:self];
+ self.pithosBrowserController.pithosAccountManager = currentPithosAccount;
[self showPithosBrowser:self];
self.pithosBrowserController.pithos = currentPithosAccount.pithos;
} else {
for (PithosAccount *pithosAccount in pithosAccounts) {
if (pithosAccount.active) {
self.currentPithosAccount = pithosAccount;
+ self.pithosBrowserController.pithosAccountManager = currentPithosAccount;
self.pithosBrowserController.pithos = currentPithosAccount.pithos;
break;
}
return;
}
self.currentPithosAccount = pithosAccount;
+ self.pithosBrowserController.pithosAccountManager = currentPithosAccount;
[self showPithosBrowser:self];
self.pithosBrowserController.pithos = currentPithosAccount.pithos;
}