Revision 919cb043 pithos-macos/PithosSharingAccountsNode.m
b/pithos-macos/PithosSharingAccountsNode.m | ||
---|---|---|
2 | 2 |
// PithosAccountNode.m |
3 | 3 |
// pithos-macos |
4 | 4 |
// |
5 |
// Copyright 2011 GRNET S.A. All rights reserved. |
|
5 |
// Copyright 2011-2012 GRNET S.A. All rights reserved.
|
|
6 | 6 |
// |
7 | 7 |
// Redistribution and use in source and binary forms, with or |
8 | 8 |
// without modification, are permitted provided that the following |
... | ... | |
38 | 38 |
#import "PithosSharingAccountsNode.h" |
39 | 39 |
#import "PithosAccountNode.h" |
40 | 40 |
#import "ASIPithosRequest.h" |
41 |
#import "ASIPithos.h" |
|
41 | 42 |
#import "ASIPithosAccount.h" |
42 | 43 |
#import "ASIDownloadCache.h" |
43 | 44 |
#import "PithosUtilities.h" |
44 | 45 |
#import "PithosActivityFacility.h" |
45 | 46 |
|
46 | 47 |
@implementation PithosSharingAccountsNode |
48 |
@synthesize pithos; |
|
47 | 49 |
|
48 | 50 |
#pragma mark - |
49 | 51 |
#pragma mark Object Lifecycle |
50 | 52 |
|
51 |
- (id)init { |
|
53 |
- (id)initWithPithos:(ASIPithos *)aPithos {
|
|
52 | 54 |
if ((self = [super init])) { |
55 |
self.pithos = aPithos; |
|
53 | 56 |
self.sharingAccount = @""; |
54 | 57 |
} |
55 | 58 |
return self; |
... | ... | |
59 | 62 |
[sharingAccountsRequest clearDelegatesAndCancel]; |
60 | 63 |
[sharingAccountsRequest release]; |
61 | 64 |
[sharingAccounts release]; |
65 |
[pithos release]; |
|
62 | 66 |
[super dealloc]; |
63 | 67 |
} |
64 | 68 |
|
... | ... | |
67 | 71 |
|
68 | 72 |
- (NSString *)url { |
69 | 73 |
if (url == nil) |
70 |
url = [[ASIPithosRequest storageURLPrefix] copy];
|
|
74 |
url = [pithos.storageURLPrefix copy];
|
|
71 | 75 |
return url; |
72 | 76 |
} |
73 | 77 |
|
... | ... | |
78 | 82 |
break; |
79 | 83 |
case PithosNodeStateRefreshNeeded: |
80 | 84 |
freshness = PithosNodeStateRefreshing; |
81 |
sharingAccountsRequest = [[ASIPithosRequest listSharingAccountsRequestWithLimit:0 |
|
82 |
marker:nil] retain]; |
|
85 |
sharingAccountsRequest = [[ASIPithosRequest listSharingAccountsRequestWithPithos:pithos limit:0 marker:nil] retain]; |
|
83 | 86 |
sharingAccountsRequest.delegate = self; |
84 | 87 |
sharingAccountsRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:); |
85 | 88 |
sharingAccountsRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:); |
... | ... | |
170 | 173 |
newChildren = [[NSMutableArray alloc] init]; |
171 | 174 |
NSMutableIndexSet *keptNodes = [NSMutableIndexSet indexSet]; |
172 | 175 |
for (ASIPithosAccount *account in sharingAccounts) { |
173 |
if (![account.name isEqualToString:[ASIPithosRequest authUser]]) {
|
|
176 |
if (![account.name isEqualToString:pithos.authUser]) {
|
|
174 | 177 |
PithosAccountNode *node = [[[PithosAccountNode alloc] init] autorelease]; |
175 | 178 |
node.parent = self; |
176 | 179 |
node.shared = shared; |
... | ... | |
207 | 210 |
} else { |
208 | 211 |
[sharingAccountsRequest release]; |
209 | 212 |
// Do an additional request to fetch more objects |
210 |
sharingAccountsRequest = [[ASIPithosRequest listSharingAccountsRequestWithLimit:0 |
|
211 |
marker:[[someSharingAccounts lastObject] name]] retain]; |
|
213 |
sharingAccountsRequest = [[ASIPithosRequest listSharingAccountsRequestWithPithos:pithos |
|
214 |
limit:0 |
|
215 |
marker:[[someSharingAccounts lastObject] name]] retain]; |
|
212 | 216 |
sharingAccountsRequest.delegate = self; |
213 | 217 |
sharingAccountsRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:); |
214 | 218 |
sharingAccountsRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:); |
Also available in: Unified diff