Close node info windows when changing accounts in the browser
[pithos-macos] / pithos-macos / PithosBrowserController.m
index d9e8aa2..e8f0743 100644 (file)
 @interface PithosBrowserController (Private)
 - (BOOL)uploadFiles:(NSArray *)filenames toNode:(PithosNode *)destinationNode;
 - (BOOL)moveNodes:(NSArray *)nodes toNode:(PithosNode *)destinationNode;
-- (BOOL)copyNodes:(NSArray *)nodes toNode:(PithosNode *)destinationNode;
+- (BOOL)cpyNodes:(NSArray *)nodes toNode:(PithosNode *)destinationNode;
 @end
 
 @implementation PithosBrowserController
 @synthesize pithos;
-@synthesize accountNode;
-@synthesize verticalSplitView, horizontalSplitView, leftTopView, leftBottomView, outlineView, browser, outlineViewMenu, browserMenu;
+@synthesize pithosAccountManager, accountNode;
 @synthesize draggedNodes, draggedParentNode;
 @synthesize clipboardNodes, clipboardParentNode, clipboardCopy;
-@synthesize activityTextField, activityProgressIndicator;
 
 #pragma mark -
 #pragma Object Lifecycle
     [activityProgressIndicator setMaxValue:1.0];
     activityFacility = [PithosActivityFacility defaultPithosActivityFacility];
     
-    self.accountNode = [[[PithosAccountNode alloc] initWithPithos:pithos] autorelease];
+    self.accountNode = [[PithosAccountNode alloc] initWithPithosAccountManager:pithosAccountManager andPithos:pithos];
     containersNode = [[PithosEmptyNode alloc] initWithDisplayName:@"CONTAINERS" icon:nil];
     containersNodeChildren = [[NSMutableArray alloc] init];
     sharedNode = [[PithosEmptyNode alloc] initWithDisplayName:@"SHARED" icon:nil];
-    mySharedNode = [[PithosAccountNode alloc] initWithPithos:pithos];
+    mySharedNode = [[PithosAccountNode alloc] initWithPithosAccountManager:pithosAccountManager andPithos:pithos];
     mySharedNode.displayName = @"shared by me";
     mySharedNode.shared = YES;
     mySharedNode.icon = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kUserIcon)];
-    othersSharedNode = [[PithosSharingAccountsNode alloc] initWithPithos:pithos];
-    othersSharedNode.displayName = @"shared to me";
+    othersSharedNode = [[PithosSharingAccountsNode alloc] initWithPithosAccountManager:pithosAccountManager andPithos:pithos];
+    othersSharedNode.displayName = @"shared with me";
     othersSharedNode.icon = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGroupIcon)];
     
-    [[[outlineView tableColumns] objectAtIndex:0] setDataCell:[[[PithosOutlineViewCell alloc] init] autorelease]];
+    [[[outlineView tableColumns] objectAtIndex:0] setDataCell:[[PithosOutlineViewCell alloc] init]];
     
     // Register for updates
     // PithosAccountNode accountNode updates outlineView container nodes 
     // Request for browser refresh 
     [[NSNotificationCenter defaultCenter] addObserver:self 
                                              selector:@selector(pithosBrowserRefreshNeeded:) 
-                                                 name:@"PithosBrowserRefreshNeeeded" 
+                                                 name:@"PithosBrowserRefreshNeeded" 
                                                object:nil];
 }
 
     }
 
     [refreshTimer invalidate];
-    [refreshTimer release];
     
     [moveNetworkQueue reset];
     [copyNetworkQueue reset];
     [downloadCallbackQueue cancelAllOperations];
     [downloadCallbackQueue setSuspended:YES];
 
+    [accountNode pithosNodeWillBeRemoved];
+    [mySharedNode pithosNodeWillBeRemoved];
+    [othersSharedNode pithosNodeWillBeRemoved];
+    
     rootNode = nil;
     [browser loadColumnZero];
     [containersNodeChildren removeAllObjects];
     [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];
     activityFacility.delegate = self;
             
-    refreshTimer = [[NSTimer scheduledTimerWithTimeInterval:REFRESH_TIMER_INTERVAL 
+    refreshTimer = [NSTimer scheduledTimerWithTimeInterval:REFRESH_TIMER_INTERVAL 
                                                      target:self 
                                                    selector:@selector(forceRefresh:) 
                                                    userInfo:self 
-                                                    repeats:YES] retain];
+                                                    repeats:YES];
     @synchronized(self) {
         browserActive = YES;
     }
 - (void)dealloc {
     [[NSNotificationCenter defaultCenter] removeObserver:self];
     [self resetBrowser];
-    [moveQueue release];
-    [copyQueue release];
-    [deleteQueue release];
-    [uploadQueue release];
-    [downloadQueue release];
-    [moveNetworkQueue release];
-    [copyNetworkQueue release];
-    [deleteNetworkQueue release];
-    [uploadNetworkQueue release];
-    [downloadNetworkQueue release];
-    [clipboardParentNode release];
-    [clipboardNodes release];
-    [draggedParentNode release];
-    [draggedNodes release];
-    [sharedPreviewController release];
-    [othersSharedNode release];
-    [mySharedNode release];
-    [sharedNode release];
-    [containersNodeChildren release];
-    [containersNode release];
-    [accountNode release];
-    [rootNode release];
-    [pithos release];
-    [super dealloc];
 }
 
 - (void)setPithos:(ASIPithos *)aPithos {
             ![aPithos.storageURLPrefix isEqualToString:pithos.storageURLPrefix] ||
             ![aPithos.publicURLPrefix isEqualToString:pithos.publicURLPrefix]) {
             [self resetBrowser];
-            [pithos release];
-            pithos = [aPithos retain];
+            pithos = aPithos;
             [self startBrowser];
         } else {
             [self startBrowser];
 #pragma mark Observers
 
 - (void)pithosNodeChildrenUpdated:(NSNotification *)notification {
+    if (![NSThread isMainThread]) {
+        [self performSelectorOnMainThread:@selector(pithosNodeChildrenUpdated:) withObject:notification waitUntilDone:NO];
+        return;
+    }
     PithosNode *node = (PithosNode *)[notification object];
     if ((node == accountNode) || ![node.pithos isEqualTo:pithos])
         return;
 }
 
 - (void)pithosAccountNodeChildrenUpdated:(NSNotification *)notification {
+    if (![NSThread isMainThread]) {
+        [self performSelectorOnMainThread:@selector(pithosAccountNodeChildrenUpdated:) withObject:notification waitUntilDone:NO];
+        return;
+    }
     BOOL containerPithosFound = NO;
     BOOL containerTrashFound = NO;
     NSMutableIndexSet *removedContainersNodeChildren = [NSMutableIndexSet indexSet];
         // Create pithos node
         ASIPithosContainerRequest *containerRequest = [ASIPithosContainerRequest createOrUpdateContainerRequestWithPithos:pithos 
                                                                                                             containerName:@"pithos"];
-        ASINetworkQueue *networkQueue = [ASINetworkQueue queue];
-        [networkQueue go];
-        [networkQueue addOperations:[NSArray arrayWithObject:[PithosUtilities prepareRequest:containerRequest]] waitUntilFinished:YES];
+        [PithosUtilities startAndWaitForRequest:containerRequest];
         if ([containerRequest error]) {
             [PithosUtilities httpRequestErrorAlertWithRequest:containerRequest];
         } else {
         // Create trash node
         ASIPithosContainerRequest *containerRequest = [ASIPithosContainerRequest createOrUpdateContainerRequestWithPithos:pithos 
                                                                                                             containerName:@"trash"];
-        ASINetworkQueue *networkQueue = [ASINetworkQueue queue];
-        [networkQueue go];
-        [networkQueue addOperations:[NSArray arrayWithObject:[PithosUtilities prepareRequest:containerRequest]] waitUntilFinished:YES];
+        [PithosUtilities startAndWaitForRequest:containerRequest];
         if ([containerRequest error]) {
             [PithosUtilities httpRequestErrorAlertWithRequest:containerRequest];
         } else {
 #pragma mark Actions
 
 - (IBAction)forceRefresh:(id)sender {
+    if (![NSThread isMainThread]) {
+        [self performSelectorOnMainThread:@selector(forceRefresh:) withObject:sender waitUntilDone:NO];
+        return;
+    }
     if (editingItem)
         return;
     if (sender)
 }
 
 - (IBAction)refresh:(id)sender {
+    if (![NSThread isMainThread]) {
+        [self performSelectorOnMainThread:@selector(refresh:) withObject:sender waitUntilDone:NO];
+        return;
+    }
     if (editingItem)
         return;
     if ([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask) {
                                               isDirectory:&isDirectory 
                                            sharingAccount:nil]) {
                     dispatch_async(dispatch_get_main_queue(), ^{
-                        NSAlert *alert = [[[NSAlert alloc] init] autorelease];
+                        NSAlert *alert = [[NSAlert alloc] init];
                         [alert setMessageText:@"Name Taken"];
                         [alert setInformativeText:[NSString stringWithFormat:@"The name '%@' is already taken. Please choose a different name", newName]];
                         [alert addButtonWithTitle:@"OK"];
                                               isDirectory:&isDirectory 
                                            sharingAccount:nil]) {
                     dispatch_async(dispatch_get_main_queue(), ^{
-                        NSAlert *alert = [[[NSAlert alloc] init] autorelease];
+                        NSAlert *alert = [[NSAlert alloc] init];
                         [alert setMessageText:@"Name Taken"];
                         [alert setInformativeText:[NSString stringWithFormat:@"The name '%@' is already taken. Please choose a different name", newName]];
                         [alert addButtonWithTitle:@"OK"];
@@ -801,7 +792,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
         [names addObject:node.displayName];
         // If the node is a subdir ask if the whole tree should be downloaded
         if ([node class] == [PithosSubdirNode class]) {
-            NSAlert *alert = [[[NSAlert alloc] init] autorelease];
+            NSAlert *alert = [[NSAlert alloc] init];
             [alert setMessageText:@"Download directory"];
             [alert setInformativeText:[NSString stringWithFormat:@"'%@' is a directory, do you want to download its contents?", node.displayName]];
             [alert addButtonWithTitle:@"OK"];
@@ -918,7 +909,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
             if ([info draggingSourceOperationMask] & NSDragOperationMove)
                 return [self moveNodes:draggedNodes toNode:node];
             else if ([info draggingSourceOperationMask] & NSDragOperationCopy)
-                return [self copyNodes:draggedNodes toNode:node];
+                return [self cpyNodes:draggedNodes toNode:node];
         }
     }
     return NO;
@@ -942,7 +933,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
     } else {
         [menuNodes addObject:[browser itemAtIndexPath:clickedNodeIndexPath]];
     }
-    NSMenuItem *menuItem = [[[NSMenuItem alloc] init] autorelease];
+    NSMenuItem *menuItem = [[NSMenuItem alloc] init];
     menuItem.representedObject = menuNodes;
     [self menuDownload:menuItem];
 }
@@ -1076,9 +1067,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
     if ((destinationNode.pithosContainer.blockHash == nil) || (destinationNode.pithosContainer.blockSize == 0)) {
         ASIPithosContainerRequest *containerRequest = [ASIPithosContainerRequest containerMetadataRequestWithPithos:pithos 
                                                                                                       containerName:containerName];
-        ASINetworkQueue *networkQueue = [ASINetworkQueue queue];
-        [networkQueue go];
-        [networkQueue addOperations:[NSArray arrayWithObject:[PithosUtilities prepareRequest:containerRequest]] waitUntilFinished:YES];
+        [PithosUtilities startAndWaitForRequest:containerRequest];
         if ([containerRequest error]) {
             [PithosUtilities httpRequestErrorAlertWithRequest:containerRequest];
             return NO;
@@ -1166,7 +1155,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
                 [uploadQueue addOperation:operation];
             } else {
                 // Upload directory, confirm first
-                NSAlert *alert = [[[NSAlert alloc] init] autorelease];
+                NSAlert *alert = [[NSAlert alloc] init];
                 [alert setMessageText:@"Upload directory"];
                 [alert setInformativeText:[NSString stringWithFormat:@"'%@' is a directory, do you want to upload it and its contents?", filePath]];
                 [alert addButtonWithTitle:@"OK"];
@@ -1401,7 +1390,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
     return YES;
 }
 
-- (BOOL)copyNodes:(NSArray *)nodes toNode:(PithosNode *)destinationNode {    
+- (BOOL)cpyNodes:(NSArray *)nodes toNode:(PithosNode *)destinationNode {    
     if ((([destinationNode class] != [PithosSubdirNode class]) && ([destinationNode class] != [PithosContainerNode class])) ||
         (([destinationNode class] == [PithosSubdirNode class]) && !destinationNode.pithosObject.subdir && [destinationNode.pithosObject.name hasSuffix:@"/"])) 
         return NO;
@@ -1432,7 +1421,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
                     }
                     if (operation.isCancelled)
                         return;
-                    ASIPithosObjectRequest *objectRequest = [PithosUtilities copyObjectRequestWithPithos:pithos
+                    ASIPithosObjectRequest *objectRequest = [PithosUtilities cpyObjectRequestWithPithos:pithos
                                                                                            containerName:node.pithosContainer.name 
                                                                                               objectName:node.pithosObject.name 
                                                                                 destinationContainerName:containerName 
@@ -1488,7 +1477,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
                     }
                     if (operation.isCancelled)
                         return;
-                    NSArray *objectRequests = [PithosUtilities copyObjectRequestsForSubdirWithPithos:pithos
+                    NSArray *objectRequests = [PithosUtilities cpyObjectRequestsForSubdirWithPithos:pithos
                                                                                        containerName:node.pithosContainer.name 
                                                                                           objectName:node.pithosObject.name 
                                                                             destinationContainerName:containerName 
@@ -1562,9 +1551,9 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
         return;
     }
     // Add an operation to the callbackQueue with a completionBlock for the case of cancellation
-    NSInvocationOperation *operation = [[[NSInvocationOperation alloc] initWithTarget:self 
+    NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self 
                                                                              selector:NSSelectorFromString([request.userInfo objectForKey:@"didFinishSelector"]) 
-                                                                               object:request] autorelease];
+                                                                               object:request];
     operation.completionBlock = ^{
         @autoreleasepool {
             if ([[request.userInfo objectForKey:@"operation"] isCancelled]) {
@@ -1606,9 +1595,9 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
             return;
         }
         // Add an operation to the callbackQueue with a completionBlock for the case of cancellation
-        NSInvocationOperation *operation = [[[NSInvocationOperation alloc] initWithTarget:self 
+        NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self 
                                                                                  selector:NSSelectorFromString([request.userInfo objectForKey:@"didFailSelector"]) 
-                                                                                   object:request] autorelease];
+                                                                                   object:request];
         operation.completionBlock = ^{
             @autoreleasepool {
                 if ([[request.userInfo objectForKey:@"operation"] isCancelled]) {
@@ -1639,7 +1628,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
         }
         NSUInteger retries = [[request.userInfo objectForKey:@"retries"] unsignedIntegerValue];
         if (retries > 0) {
-            ASIPithosRequest *newRequest = (ASIPithosRequest *)[[PithosUtilities copyRequest:request] autorelease];
+            ASIPithosRequest *newRequest = (ASIPithosRequest *)[PithosUtilities copyRequest:request];
             [(NSMutableDictionary *)(newRequest.userInfo)setObject:[NSNumber numberWithUnsignedInteger:(--retries)] forKey:@"retries"];
             [(NSMutableDictionary *)(newRequest.userInfo)setObject:[NSNumber numberWithBool:NO] forKey:@"unexpectedResponseStatus"];
             [[newRequest.userInfo objectForKey:@"networkQueue"] addOperation:[PithosUtilities prepareRequest:newRequest priority:[[newRequest.userInfo objectForKey:@"priority"] integerValue]]];
@@ -1680,7 +1669,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
                 if (![fileManager fileExistsAtPath:filePath]) {
                     if (![fileManager createFileAtPath:filePath contents:nil attributes:nil]) {
                         dispatch_async(dispatch_get_main_queue(), ^{
-                            NSAlert *alert = [[[NSAlert alloc] init] autorelease];
+                            NSAlert *alert = [[NSAlert alloc] init];
                             [alert setMessageText:@"Create File Error"];
                             [alert setInformativeText:[NSString stringWithFormat:@"Cannot create zero length file at %@", filePath]];
                             [alert addButtonWithTitle:@"OK"];
@@ -1770,7 +1759,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
                 dispatch_async(dispatch_get_main_queue(), ^{
                     [activityFacility endActivity:activity 
                                       withMessage:[objectRequest.userInfo objectForKey:@"failedActivityMessage"]]; 
-                    NSAlert *alert = [[[NSAlert alloc] init] autorelease];
+                    NSAlert *alert = [[NSAlert alloc] init];
                     [alert setMessageText:@"Upload Timeout"];
                     [alert setInformativeText:[NSString stringWithFormat:@"Upload iteration limit reached for object with path '%@'", 
                                                [objectRequest.userInfo objectForKey:@"objectName"]]];
@@ -1972,9 +1961,9 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
 
 - (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMinimumPosition ofSubviewAt:(NSInteger)dividerIndex {
     if (splitView == verticalSplitView)
-        return 120;
+        return 140;
     else
-        return ([horizontalSplitView bounds].size.height - 108);
+        return ([horizontalSplitView bounds].size.height - 142);
 }
 
 - (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMaximumPosition ofSubviewAt:(NSInteger)dividerIndex {
@@ -1984,17 +1973,12 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
         return ([horizontalSplitView bounds].size.height - 108);
 }
 
-- (CGFloat)splitView:(NSSplitView *)splitView constrainSplitPosition:(CGFloat)proposedPosition ofSubviewAt:(NSInteger)dividerIndex {
-    if (splitView == verticalSplitView) {
-        if (proposedPosition < 120)
-            return 120;
-        else if (proposedPosition > 220)
-            return 220;
-        else
-            return proposedPosition;
-    } else {
-        return ([horizontalSplitView bounds].size.height - 108);
+- (BOOL)splitView:(NSSplitView *)splitView shouldAdjustSizeOfSubview:(NSView *)view {
+    if (((splitView == verticalSplitView) && (view == leftView)) ||
+        ((splitView == horizontalSplitView) && (view == leftBottomView))) {
+        return NO;
     }
+    return YES;
 }
 
 #pragma mark -
@@ -2079,7 +2063,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
                 ([info draggingSourceOperationMask] & NSDragOperationMove))
                 return [self moveNodes:draggedNodes toNode:node];
             else if ([info draggingSourceOperationMask] & NSDragOperationCopy)
-                return [self copyNodes:draggedNodes toNode:node];
+                return [self cpyNodes:draggedNodes toNode:node];
         }
     }
     return NO;
@@ -2175,19 +2159,19 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
             return;
         // New Folder
         if (!menuNode.shared && !menuNode.sharingAccount) {
-            menuItem = [[[NSMenuItem alloc] initWithTitle:@"New Folder" action:@selector(menuNewFolder:) keyEquivalent:@""] autorelease];
+            menuItem = [[NSMenuItem alloc] initWithTitle:@"New Folder" action:@selector(menuNewFolder:) keyEquivalent:@""];
             [menuItem setRepresentedObject:menuNode];
             [menu addItem:menuItem];
             [menu addItem:[NSMenuItem separatorItem]];
         }
         // Refresh
-        menuItem = [[[NSMenuItem alloc] initWithTitle:@"Refresh" action:@selector(refresh:) keyEquivalent:@""] autorelease];
+        menuItem = [[NSMenuItem alloc] initWithTitle:@"Refresh" action:@selector(refresh:) keyEquivalent:@""];
         [menu addItem:menuItem];
         [menu addItem:[NSMenuItem separatorItem]];
         // Get Info
-        menuItem = [[[NSMenuItem alloc] initWithTitle:(([menuNode class] == [PithosContainerNode class]) ? @"Info" : @"Info and Sharing") 
+        menuItem = [[NSMenuItem alloc] initWithTitle:(([menuNode class] == [PithosContainerNode class]) ? @"Info" : @"Info and Sharing") 
                                                action:@selector(menuGetInfo:) 
-                                        keyEquivalent:@""] autorelease];
+                                        keyEquivalent:@""];
         [menuItem setRepresentedObject:[NSArray arrayWithObject:menuNode]];
         [menu addItem:menuItem];
         // Paste
@@ -2204,7 +2188,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
                 else
                     menuItemTitle = @"Paste Items";
                 [menu addItem:[NSMenuItem separatorItem]];
-                menuItem = [[[NSMenuItem alloc] initWithTitle:menuItemTitle action:@selector(menuPaste:) keyEquivalent:@""] autorelease];
+                menuItem = [[NSMenuItem alloc] initWithTitle:menuItemTitle action:@selector(menuPaste:) keyEquivalent:@""];
                 [menuItem setRepresentedObject:menuNode];
                 [menu addItem:menuItem];
             }
@@ -2215,7 +2199,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
         PithosNode *firstMenuNode = [menuNodes objectAtIndex:0];
         // Download
         if (([firstMenuNode class] != [PithosContainerNode class]) && ([firstMenuNode class] != [PithosAccountNode class])) {
-            menuItem = [[[NSMenuItem alloc] initWithTitle:@"Download" action:@selector(menuDownload:) keyEquivalent:@""] autorelease];
+            menuItem = [[NSMenuItem alloc] initWithTitle:@"Download" action:@selector(menuDownload:) keyEquivalent:@""];
             [menuItem setRepresentedObject:menuNodes];
             [menu addItem:menuItem];
             [menu addItem:[NSMenuItem separatorItem]];
@@ -2224,26 +2208,26 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
         // Delete
         if (!firstMenuNode.shared && !firstMenuNode.sharingAccount && ([rootNode class] == [PithosContainerNode class])) {
             if ([rootNode.pithosContainer.name isEqualToString:@"pithos"]) {
-                menuItem = [[[NSMenuItem alloc] initWithTitle:@"Move to Trash" 
+                menuItem = [[NSMenuItem alloc] initWithTitle:@"Move to Trash" 
                                                        action:@selector(menuMoveToTrash:) 
-                                                keyEquivalent:@""] autorelease];
+                                                keyEquivalent:@""];
                 [menuItem setRepresentedObject:menuNodes];
                 [menu addItem:menuItem];
             }
-            menuItem = [[[NSMenuItem alloc] initWithTitle:@"Delete" action:@selector(menuDelete:) keyEquivalent:@""] autorelease];
+            menuItem = [[NSMenuItem alloc] initWithTitle:@"Delete" action:@selector(menuDelete:) keyEquivalent:@""];
             [menuItem setRepresentedObject:menuNodes];
             [menu addItem:menuItem];
             [menu addItem:[NSMenuItem separatorItem]];
         }
         // Refresh
-        menuItem = [[[NSMenuItem alloc] initWithTitle:@"Refresh" action:@selector(refresh:) keyEquivalent:@""] autorelease];
+        menuItem = [[NSMenuItem alloc] initWithTitle:@"Refresh" action:@selector(refresh:) keyEquivalent:@""];
         [menu addItem:menuItem];
         // Get Info
         if (!firstMenuNode.sharingAccount || ([firstMenuNode class] != [PithosAccountNode class])) {
             [menu addItem:[NSMenuItem separatorItem]];
-            menuItem = [[[NSMenuItem alloc] initWithTitle:(([firstMenuNode class] == [PithosContainerNode class]) ? @"Info" : @"Info and Sharing") 
+            menuItem = [[NSMenuItem alloc] initWithTitle:(([firstMenuNode class] == [PithosContainerNode class]) ? @"Info" : @"Info and Sharing") 
                                                    action:@selector(menuGetInfo:) 
-                                            keyEquivalent:@""] autorelease];
+                                            keyEquivalent:@""];
             [menuItem setRepresentedObject:menuNodes];
             [menu addItem:menuItem];
             
@@ -2256,7 +2240,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
                 menuItemTitle = [NSString stringWithFormat:@"Cut \"%@\"", ((PithosNode *)[menuNodes objectAtIndex:0]).displayName];
             else 
                 menuItemTitle = [NSString stringWithFormat:@"Cut %lu Items", menuNodesCount];
-            menuItem = [[[NSMenuItem alloc] initWithTitle:menuItemTitle action:@selector(menuCut:) keyEquivalent:@""] autorelease];
+            menuItem = [[NSMenuItem alloc] initWithTitle:menuItemTitle action:@selector(menuCut:) keyEquivalent:@""];
             [menuItem setRepresentedObject:menuNodes];
             [menu addItem:menuItem];
         }
@@ -2267,7 +2251,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
                 menuItemTitle = [NSString stringWithFormat:@"Copy \"%@\"", ((PithosNode *)[menuNodes objectAtIndex:0]).displayName];
             else 
                 menuItemTitle = [NSString stringWithFormat:@"Copy %lu Items", menuNodesCount];
-            menuItem = [[[NSMenuItem alloc] initWithTitle:menuItemTitle action:@selector(menuCopy:) keyEquivalent:@""] autorelease];
+            menuItem = [[NSMenuItem alloc] initWithTitle:menuItemTitle action:@selector(menuCopy:) keyEquivalent:@""];
             [menuItem setRepresentedObject:menuNodes];
             [menu addItem:menuItem];
         }
@@ -2283,7 +2267,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
                     menuItemTitle = @"Paste Item";
                 else
                     menuItemTitle = @"Paste Items";
-                menuItem = [[[NSMenuItem alloc] initWithTitle:menuItemTitle action:@selector(menuPaste:) keyEquivalent:@""] autorelease];
+                menuItem = [[NSMenuItem alloc] initWithTitle:menuItemTitle action:@selector(menuPaste:) keyEquivalent:@""];
                 [menuItem setRepresentedObject:firstMenuNode];
                 [menu addItem:menuItem];
             }
@@ -2723,7 +2707,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
     PithosNode *dropNode = (PithosNode *)[sender representedObject];
     NSArray *localClipboardNodes = [NSArray arrayWithArray:clipboardNodes];
     if (clipboardCopy) {
-        [self copyNodes:localClipboardNodes toNode:dropNode];
+        [self cpyNodes:localClipboardNodes toNode:dropNode];
     } else if (![dropNode isEqualTo:clipboardParentNode]) {
         self.clipboardNodes = nil;
         self.clipboardParentNode = nil;
@@ -2752,7 +2736,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
     }
     
     if (!message)
-        message = [[[[UsingSizeTransformer alloc] init] autorelease] transformedValue:accountNode.pithosAccount];
+        message = [[[UsingSizeTransformer alloc] init] transformedValue:accountNode.pithosAccount];
     [activityTextField setStringValue:message];
 }