Revision cfc17d33 pithos-macos/PithosObjectNode.m
b/pithos-macos/PithosObjectNode.m | ||
---|---|---|
46 | 46 |
#import "PithosObjectNodeInfoController.h" |
47 | 47 |
|
48 | 48 |
@implementation PithosObjectNode |
49 |
@synthesize pithos, pithosContainer, pithosObject; |
|
49 |
@synthesize pithos, pithosContainer, pithosObject, versions;
|
|
50 | 50 |
@synthesize isPublic; |
51 | 51 |
|
52 | 52 |
#pragma mark - |
... | ... | |
65 | 65 |
} |
66 | 66 |
|
67 | 67 |
- (void)dealloc { |
68 |
[refreshVersionsObjectRequest clearDelegatesAndCancel]; |
|
69 |
[refreshVersionsObjectRequest release]; |
|
68 | 70 |
[refreshMetadataObjectRequest clearDelegatesAndCancel]; |
69 | 71 |
[refreshMetadataObjectRequest release]; |
70 | 72 |
[applyMetadataObjectRequest clearDelegatesAndCancel]; |
... | ... | |
180 | 182 |
[refreshMetadataObjectRequest release]; |
181 | 183 |
refreshMetadataObjectRequest = nil; |
182 | 184 |
} |
185 |
} else if ([request isEqualTo:refreshVersionsObjectRequest]) { |
|
186 |
[[pithosNodeInfoController window] makeFirstResponder:nil]; |
|
187 |
self.versions = [refreshVersionsObjectRequest versions]; |
|
188 |
@synchronized(self) { |
|
189 |
[refreshVersionsObjectRequest release]; |
|
190 |
refreshVersionsObjectRequest = nil; |
|
191 |
} |
|
183 | 192 |
} |
184 | 193 |
[pool drain]; |
185 | 194 |
} |
... | ... | |
200 | 209 |
[refreshMetadataObjectRequest release]; |
201 | 210 |
refreshMetadataObjectRequest = newRequest; |
202 | 211 |
} |
212 |
} else if ([request isEqualTo:refreshVersionsObjectRequest]) { |
|
213 |
@synchronized(self) { |
|
214 |
[refreshVersionsObjectRequest release]; |
|
215 |
refreshVersionsObjectRequest = newRequest; |
|
216 |
} |
|
203 | 217 |
} |
204 | 218 |
[[PithosUtilities prepareRequest:newRequest priority:[[newRequest.userInfo objectForKey:@"priority"] integerValue]] startAsynchronous]; |
205 | 219 |
} else { |
... | ... | |
219 | 233 |
[refreshMetadataObjectRequest release]; |
220 | 234 |
refreshMetadataObjectRequest = nil; |
221 | 235 |
} |
236 |
} else if ([request isEqualTo:refreshVersionsObjectRequest]) { |
|
237 |
dispatch_async(dispatch_get_main_queue(), ^{ |
|
238 |
[PithosUtilities httpRequestErrorAlertWithRequest:refreshVersionsObjectRequest]; |
|
239 |
}); |
|
240 |
@synchronized(self) { |
|
241 |
[refreshVersionsObjectRequest release]; |
|
242 |
refreshVersionsObjectRequest = nil; |
|
243 |
} |
|
222 | 244 |
} |
223 | 245 |
} |
224 | 246 |
[pool drain]; |
... | ... | |
290 | 312 |
[[PithosUtilities prepareRequest:refreshMetadataObjectRequest priority:NSOperationQueuePriorityHigh] startAsynchronous]; |
291 | 313 |
} |
292 | 314 |
} |
315 |
[self refreshVersions]; |
|
316 |
} |
|
317 |
|
|
318 |
#pragma mark - |
|
319 |
#pragma mark Versions |
|
320 |
|
|
321 |
- (void)refreshVersions { |
|
322 |
@synchronized(self) { |
|
323 |
if (refreshVersionsObjectRequest == nil) { |
|
324 |
refreshVersionsObjectRequest = [[ASIPithosObjectRequest objectVersionsRequestWithPithos:pithos |
|
325 |
containerName:pithosContainer.name |
|
326 |
objectName:pithosObject.name] retain]; |
|
327 |
if (sharingAccount) |
|
328 |
[refreshVersionsObjectRequest setRequestUserFromDefaultTo:sharingAccount withPithos:pithos]; |
|
329 |
refreshVersionsObjectRequest.delegate = self; |
|
330 |
refreshVersionsObjectRequest.didFinishSelector = @selector(performRequestFinishedDelegateInBackground:); |
|
331 |
refreshVersionsObjectRequest.didFailSelector = @selector(performRequestFailedDelegateInBackground:); |
|
332 |
refreshVersionsObjectRequest.userInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys: |
|
333 |
[NSNumber numberWithInteger:NSOperationQueuePriorityHigh], @"priority", |
|
334 |
[NSNumber numberWithUnsignedInteger:10], @"retries", |
|
335 |
NSStringFromSelector(@selector(objectRequestFinished:)), @"didFinishSelector", |
|
336 |
NSStringFromSelector(@selector(objectRequestFailed:)), @"didFailSelector", |
|
337 |
nil]; |
|
338 |
refreshVersionsObjectRequest.downloadCache = [ASIDownloadCache sharedCache]; |
|
339 |
[[PithosUtilities prepareRequest:refreshVersionsObjectRequest priority:NSOperationQueuePriorityHigh] startAsynchronous]; |
|
340 |
} |
|
341 |
} |
|
293 | 342 |
} |
294 | 343 |
|
295 | 344 |
#pragma mark - |
Also available in: Unified diff