Close node info windows when changing accounts in the browser
[pithos-macos] / pithos-macos / PithosBrowserController.m
index 17420db..e8f0743 100644 (file)
     [activityProgressIndicator setMaxValue:1.0];
     activityFacility = [PithosActivityFacility defaultPithosActivityFacility];
     
-    self.accountNode = [[PithosAccountNode alloc] initWithPithos:pithos];
-    accountNode.pithosAccountManager = pithosAccountManager;
+    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.pithosAccountManager = pithosAccountManager;
+    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.pithosAccountManager = pithosAccountManager;
+    othersSharedNode = [[PithosSharingAccountsNode alloc] initWithPithosAccountManager:pithosAccountManager andPithos:pithos];
     othersSharedNode.displayName = @"shared with me";
     othersSharedNode.icon = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGroupIcon)];
     
     [downloadCallbackQueue cancelAllOperations];
     [downloadCallbackQueue setSuspended:YES];
 
+    [accountNode pithosNodeWillBeRemoved];
+    [mySharedNode pithosNodeWillBeRemoved];
+    [othersSharedNode pithosNodeWillBeRemoved];
+    
     rootNode = nil;
     [browser loadColumnZero];
     [containersNodeChildren removeAllObjects];
@@ -1960,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 {
@@ -1972,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 -