Use user catalog displayname when displaying an account node
[pithos-macos] / pithos-macos / PithosSharingAccountsNode.m
index a04650d..b03192d 100644 (file)
@@ -41,6 +41,7 @@
 #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])