'my shared' nodes can be copied.
authorMiltiadis Vasilakis <mvasilak@gmail.com>
Mon, 26 Sep 2011 21:22:35 +0000 (00:22 +0300)
committerMiltiadis Vasilakis <mvasilak@gmail.com>
Mon, 26 Sep 2011 21:22:35 +0000 (00:22 +0300)
If a shared node has its sharing property changed from its info window,
the browser is refreshed.
Refresh button also refreshes account containers.
Modified the left NSOutlineView to use PithosNode objects directly, instead through an NSTreeController.

pithos-macos/PithosBrowserController.h
pithos-macos/PithosBrowserController.m
pithos-macos/PithosBrowserController.xib
pithos-macos/PithosNode.h
pithos-macos/PithosNode.m
pithos-macos/PithosObjectNode.m
pithos-macos/PithosSubdirNode.m

index 077a94e..facd1b3 100644 (file)
 #import <Cocoa/Cocoa.h>
 @class PithosNode;
 @class PithosAccountNode;
+@class PithosEmptyNode;
 
 @interface PithosBrowserController : NSWindowController <NSBrowserDelegate, NSSplitViewDelegate, NSOutlineViewDelegate, NSMenuDelegate> {    
     PithosNode *rootNode;
     PithosAccountNode *accountNode;
-    PithosAccountNode *mySharedRootNode;
-    
-    NSMutableArray *outlineViewDataSourceArray;
+    PithosEmptyNode *containersNode;
+    NSMutableArray *containersNodeChildren;
+    PithosEmptyNode *sharedNode;
+    PithosAccountNode *mySharedNode;
+    PithosEmptyNode *othersSharedNode;
     
     NSViewController *sharedPreviewController;
     
@@ -65,8 +68,6 @@
     BOOL clipboardCopy;
 }
 
-@property (nonatomic, retain) NSMutableArray *outlineViewDataSourceArray;
-
 @property (nonatomic, assign) IBOutlet NSSplitView *verticalSplitView;
 @property (nonatomic, assign) IBOutlet NSSplitView *horizontalSplitView;
 @property (nonatomic, assign) IBOutlet NSView *leftTopView;
index f2cace6..832014e 100644 (file)
@@ -99,8 +99,7 @@
 @end
 
 @implementation PithosBrowserController
-@synthesize outlineViewDataSourceArray, verticalSplitView, horizontalSplitView, leftTopView, leftBottomView,
-            outlineView, browser;
+@synthesize verticalSplitView, horizontalSplitView, leftTopView, leftBottomView, outlineView, browser;
 @synthesize draggedNodes, draggedParentNode;
 @synthesize clipboardNodes, clipboardParentNode, clipboardCopy;
 
     [draggedNodes release];
     [browserMenu release];
     [sharedPreviewController release];
-    [outlineViewDataSourceArray release];
-    [mySharedRootNode release];
+    [othersSharedNode release];
+    [mySharedNode release];
+    [sharedNode release];
+    [containersNodeChildren release];
+    [containersNode release];
     [accountNode release];
     [rootNode release];
     [super dealloc];
 - (void)resetContainers:(NSNotification *)notification {
     rootNode = nil;
     [browser loadColumnZero];
-    self.outlineViewDataSourceArray = nil;
-    
-    // Create the outlineView tree
-    // CONTAINERS
-       NSTreeNode *containersTreeNode = [NSTreeNode treeNodeWithRepresentedObject:
-                            [[[PithosEmptyNode alloc] initWithDisplayName:@"CONTAINERS" icon:nil] autorelease]];
-
-    // SHARED
-       NSTreeNode *sharedTreeNode = [NSTreeNode treeNodeWithRepresentedObject:
-                                      [[[PithosEmptyNode alloc] initWithDisplayName:@"SHARED" icon:nil] autorelease]];
-    // SHARED/my shared
-       [[sharedTreeNode mutableChildNodes] addObject:[NSTreeNode treeNodeWithRepresentedObject:mySharedRootNode]];
-    // SHARED/others shared
-       [[sharedTreeNode mutableChildNodes] addObject:
-     [NSTreeNode treeNodeWithRepresentedObject:
-      [[[PithosEmptyNode alloc] initWithDisplayName:@"others shared"
-                                               icon:[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGroupIcon)]
-        ] autorelease]]];
-    
-    self.outlineViewDataSourceArray = [NSMutableArray arrayWithObjects:containersTreeNode, sharedTreeNode, nil];
+    [outlineView reloadData];
     
        // Expand the folder outline view
     [outlineView expandItem:nil expandChildren:YES];
     [super windowDidLoad];
     
     accountNode = [[PithosAccountNode alloc] init];
-    mySharedRootNode = [[PithosAccountNode alloc] init];
-    mySharedRootNode.displayName = @"my shared";
-    mySharedRootNode.shared = YES;
-    mySharedRootNode.icon = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kUserIcon)];
+    containersNode = [[PithosEmptyNode alloc] initWithDisplayName:@"CONTAINERS" icon:nil];
+    containersNodeChildren = [[NSMutableArray alloc] init];
+    sharedNode = [[PithosEmptyNode alloc] initWithDisplayName:@"SHARED" icon:nil];
+    mySharedNode = [[PithosAccountNode alloc] init];
+    mySharedNode.displayName = @"my shared";
+    mySharedNode.shared = YES;
+    mySharedNode.icon = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kUserIcon)];
+    othersSharedNode = [[PithosEmptyNode alloc] initWithDisplayName:@"others shared" 
+                                                               icon:[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGroupIcon)]];
     
     [[[outlineView tableColumns] objectAtIndex:0] setDataCell:[[[PithosOutlineViewCell alloc] init] autorelease]];
     
     [[NSNotificationCenter defaultCenter] addObserver:self 
                                              selector:@selector(pithosNodeChildrenUpdated:) 
                                                  name:@"PithosAccountNodeChildrenUpdated" 
-                                               object:mySharedRootNode];
+                                               object:mySharedNode];
     [[NSNotificationCenter defaultCenter] addObserver:self 
                                              selector:@selector(resetContainers:) 
                                                  name:@"PithosAuthenticationCredentialsUpdated" 
                                                object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self 
+                                             selector:@selector(pithosBrowserRefreshNeeded:) 
+                                                 name:@"PithosBrowserRefreshNeeeded" 
+                                               object:nil];    
 }
 
 #pragma mark -
-#pragma Observers
+#pragma mark Observers
 
 - (void)pithosNodeChildrenUpdated:(NSNotification *)notification {
     PithosNode *node = (PithosNode *)[notification object];
 - (void)pithosAccountNodeChildrenUpdated:(NSNotification *)notification {
     BOOL containerPithosFound = NO;
     BOOL containerTrashFound = NO;
-    NSMutableArray *containersTreeNodeChildren = [NSMutableArray array];
+    NSMutableIndexSet *removedContainersNodeChildren = [NSMutableIndexSet indexSet];
+    for (NSUInteger i = 0 ; i < [containersNodeChildren count] ; i++) {
+        if (![accountNode.children containsObject:[containersNodeChildren objectAtIndex:i]])
+            [removedContainersNodeChildren addIndex:i];
+    }
+    [containersNodeChildren removeObjectsAtIndexes:removedContainersNodeChildren];
     for (PithosContainerNode *containerNode in accountNode.children) {
         if ([containerNode.pithosContainer.name isEqualToString:@"pithos"]) {
-            [containersTreeNodeChildren insertObject:[NSTreeNode treeNodeWithRepresentedObject:containerNode] atIndex:0];
+            if (![containersNodeChildren containsObject:containerNode])
+                [containersNodeChildren insertObject:containerNode atIndex:0];
             containerPithosFound = YES;
         } else if ([containerNode.pithosContainer.name isEqualToString:@"trash"]) {
             NSUInteger insertIndex = 1;
             if (!containerPithosFound)
                 insertIndex = 0;
-            [containersTreeNodeChildren insertObject:[NSTreeNode treeNodeWithRepresentedObject:containerNode] atIndex:insertIndex];
+            if (![containersNodeChildren containsObject:containerNode])
+                [containersNodeChildren insertObject:containerNode atIndex:insertIndex];
             containerTrashFound = YES;
-        } else {
-            [containersTreeNodeChildren addObject:[NSTreeNode treeNodeWithRepresentedObject:containerNode]];
+        } else if (![containersNodeChildren containsObject:containerNode]) {
+            [containersNodeChildren addObject:containerNode];
         }
     }
     BOOL refreshAccountNode = NO;
             refreshAccountNode = YES;
         }
     }
-    if (refreshAccountNode) {
+    
+    if (refreshAccountNode)
         [accountNode refresh];
-    } else {
-        [[[outlineViewDataSourceArray objectAtIndex:0] mutableChildNodes] setArray:containersTreeNodeChildren];
-        self.outlineViewDataSourceArray = outlineViewDataSourceArray;
-        
-        // Expand the folder outline view
-        [outlineView expandItem:nil expandChildren:YES];
-        [outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
-        
-        [self refresh:nil];
+    
+    [outlineView reloadData];
+    
+    // Expand the folder outline view
+    [outlineView expandItem:nil expandChildren:YES];
+    
+    if ((rootNode == containersNode) || (rootNode == sharedNode)) {
+        rootNode = [containersNodeChildren objectAtIndex:0];
+        [browser loadColumnZero];
     }
+    
+    if (notification)
+        [self refresh:nil];
+}
+
+- (void)pithosBrowserRefreshNeeded:(NSNotification *)notification {
+    [self refresh:nil];
 }
 
 #pragma mark -
-#pragma Actions
+#pragma mark Actions
 
 - (IBAction)refresh:(id)sender {
+    if (sender)
+        [accountNode refresh];
     for (NSInteger column = [browser lastColumn]; column >= 0; column--) {
         [(PithosNode *)[browser parentForItemsInColumn:column] invalidateChildren];
     }
 }
 
 #pragma mark -
-#pragma NSBrowserDelegate
+#pragma mark NSBrowserDelegate
 
 - (id)rootItemForBrowser:(NSBrowser *)browser {
     return rootNode;    
@@ -1061,22 +1070,58 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
 }
 
 #pragma mark -
+#pragma mark NSOutlineViewDataSource
+
+- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item {
+    if (item == nil)
+        return 2;
+    if (item == containersNode)
+        return containersNodeChildren.count;
+    if (item == sharedNode)
+        return 2;
+    return 0;
+}
+
+- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item {
+    if (item == nil)
+        return (!index ? containersNode : sharedNode);
+    if (item == sharedNode)
+        return (!index ? mySharedNode : othersSharedNode);
+    return [containersNodeChildren objectAtIndex:index];
+}
+
+- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item {
+    if ((item == containersNode) || (item == sharedNode))
+        return YES;
+    return NO;
+}
+
+- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item {
+    PithosNode *node = (PithosNode *)item;
+    return node;    
+}
+
+#pragma mark -
 #pragma mark NSOutlineViewDelegate
 
 - (BOOL)outlineView:outlineView shouldSelectItem:(id)item {
-    return ([[item representedObject] isLeaf]);
+    if ((item == containersNode) || (item == sharedNode))
+        return NO;
+    return YES;
 }
 
 - (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item {
-       return (![[item representedObject] isLeaf]);
+    if ((item == containersNode) || (item == sharedNode))
+        return YES;
+    return NO;
 }
 
 - (void)outlineViewSelectionDidChange:(NSNotification *)notification {
-    PithosNode *node = [[[outlineView itemAtRow:[outlineView selectedRow]] representedObject] representedObject];
+    PithosNode *node = (PithosNode *)[outlineView itemAtRow:[outlineView selectedRow]];
     if (node) {
         rootNode = node;
         [browser loadColumnZero];
-        [self refresh:nil];                                  
+        [self refresh:nil];
     }
 }
 
@@ -1151,6 +1196,7 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
         NSUInteger menuNodesCount = [menuNodes count];
         BOOL shared = ((PithosNode *)[menuNodes objectAtIndex:0]).shared;
         
+        
         if (!shared) {
             // Move to Trash (pithos container only)
             // Delete
@@ -1172,9 +1218,12 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
         [menuItem setRepresentedObject:menuNodes];
         [menu addItem:menuItem];
         
+        if (!shared || ([[menuNodes objectAtIndex:0] class] != [PithosContainerNode class]))
+            [menu addItem:[NSMenuItem separatorItem]];
+        
         if (!shared) {
             // Cut
-            [menu addItem:[NSMenuItem separatorItem]];
+            
             if (menuNodesCount == 1)
                 menuItemTitle = [NSString stringWithFormat:@"Cut \"%@\"", ((PithosNode *)[menuNodes objectAtIndex:0]).displayName];
             else 
@@ -1182,6 +1231,9 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
             menuItem = [[[NSMenuItem alloc] initWithTitle:menuItemTitle action:@selector(menuCut:) keyEquivalent:@""] autorelease];
             [menuItem setRepresentedObject:menuNodes];
             [menu addItem:menuItem];
+        }
+        
+        if (!shared || ([[menuNodes objectAtIndex:0] class] != [PithosContainerNode class])) {
             // Copy
             if (menuNodesCount == 1)
                 menuItemTitle = [NSString stringWithFormat:@"Copy \"%@\"", ((PithosNode *)[menuNodes objectAtIndex:0]).displayName];
@@ -1190,6 +1242,9 @@ forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)column {
             menuItem = [[[NSMenuItem alloc] initWithTitle:menuItemTitle action:@selector(menuCopy:) keyEquivalent:@""] autorelease];
             [menuItem setRepresentedObject:menuNodes];
             [menu addItem:menuItem];
+        }
+        
+        if (!shared) {
             // Paste
             if (menuNodesCount == 1) {
                 PithosNode *menuNode = [menuNodes objectAtIndex:0];
index 9b84421..40d9b21 100755 (executable)
@@ -23,7 +23,6 @@
                        <string>NSTextField</string>
                        <string>NSToolbarSeparatorItem</string>
                        <string>NSWindowTemplate</string>
-                       <string>NSTreeController</string>
                        <string>NSTextFieldCell</string>
                        <string>NSButtonCell</string>
                        <string>NSTableColumn</string>
                                                                                                                                                        <int key="NSvFlags">4352</int>
                                                                                                                                                        <string key="NSFrameSize">{180, 313}</string>
                                                                                                                                                        <reference key="NSSuperview" ref="843429105"/>
+                                                                                                                                                       <reference key="NSWindow"/>
                                                                                                                                                        <reference key="NSNextKeyView" ref="624286523"/>
                                                                                                                                                        <bool key="NSEnabled">YES</bool>
                                                                                                                                                        <object class="_NSCornerView" key="NSCornerView">
                                                                                                                                        </object>
                                                                                                                                        <string key="NSFrameSize">{180, 313}</string>
                                                                                                                                        <reference key="NSSuperview" ref="197496877"/>
+                                                                                                                                       <reference key="NSWindow"/>
                                                                                                                                        <reference key="NSNextKeyView" ref="392693553"/>
                                                                                                                                        <reference key="NSDocView" ref="392693553"/>
                                                                                                                                        <reference key="NSBGColor" ref="592883226"/>
                                                                                                                                        <int key="NSvFlags">-2147483392</int>
                                                                                                                                        <string key="NSFrame">{{224, 17}, {15, 102}}</string>
                                                                                                                                        <reference key="NSSuperview" ref="197496877"/>
+                                                                                                                                       <reference key="NSWindow"/>
                                                                                                                                        <reference key="NSNextKeyView" ref="1047973191"/>
                                                                                                                                        <reference key="NSTarget" ref="197496877"/>
                                                                                                                                        <string key="NSAction">_doScroller:</string>
                                                                                                                                        <int key="NSvFlags">-2147483392</int>
                                                                                                                                        <string key="NSFrame">{{-100, -100}, {144, 15}}</string>
                                                                                                                                        <reference key="NSSuperview" ref="197496877"/>
+                                                                                                                                       <reference key="NSWindow"/>
                                                                                                                                        <reference key="NSNextKeyView" ref="843429105"/>
                                                                                                                                        <int key="NSsFlags">1</int>
                                                                                                                                        <reference key="NSTarget" ref="197496877"/>
                                                                                                                        </object>
                                                                                                                        <string key="NSFrameSize">{180, 313}</string>
                                                                                                                        <reference key="NSSuperview" ref="414504914"/>
+                                                                                                                       <reference key="NSWindow"/>
                                                                                                                        <reference key="NSNextKeyView" ref="205521010"/>
                                                                                                                        <int key="NSsFlags">528</int>
                                                                                                                        <reference key="NSVScroller" ref="624286523"/>
                                                                                                        </object>
                                                                                                        <string key="NSFrameSize">{180, 313}</string>
                                                                                                        <reference key="NSSuperview" ref="462572416"/>
+                                                                                                       <reference key="NSWindow"/>
                                                                                                        <reference key="NSNextKeyView" ref="197496877"/>
                                                                                                        <string key="NSClassName">NSView</string>
                                                                                                </object>
                                                                                                                        <object class="NSPSMatrix" key="NSDrawMatrix"/>
                                                                                                                        <string key="NSFrame">{{7, 21}, {166, 12}}</string>
                                                                                                                        <reference key="NSSuperview" ref="1047973191"/>
+                                                                                                                       <reference key="NSWindow"/>
                                                                                                                        <reference key="NSNextKeyView" ref="620067477"/>
                                                                                                                        <int key="NSpiFlags">16648</int>
                                                                                                                        <double key="NSMaxValue">100</double>
                                                                                                                        <int key="NSvFlags">266</int>
                                                                                                                        <string key="NSFrame">{{5, 6}, {170, 14}}</string>
                                                                                                                        <reference key="NSSuperview" ref="1047973191"/>
+                                                                                                                       <reference key="NSWindow"/>
                                                                                                                        <reference key="NSNextKeyView" ref="987905504"/>
                                                                                                                        <bool key="NSEnabled">YES</bool>
                                                                                                                        <object class="NSTextFieldCell" key="NSCell" id="667098628">
                                                                                                                        </object>
                                                                                                                        <string key="NSFrame">{{69, 38}, {42, 42}}</string>
                                                                                                                        <reference key="NSSuperview" ref="1047973191"/>
+                                                                                                                       <reference key="NSWindow"/>
                                                                                                                        <reference key="NSNextKeyView" ref="744849637"/>
                                                                                                                        <bool key="NSEnabled">YES</bool>
                                                                                                                        <object class="NSImageCell" key="NSCell" id="280822281">
                                                                                                        </object>
                                                                                                        <string key="NSFrame">{{0, 314}, {180, 86}}</string>
                                                                                                        <reference key="NSSuperview" ref="462572416"/>
+                                                                                                       <reference key="NSWindow"/>
                                                                                                        <reference key="NSNextKeyView" ref="805035077"/>
                                                                                                        <string key="NSClassName">NSView</string>
                                                                                                </object>
                                                                                        </object>
                                                                                        <string key="NSFrameSize">{180, 400}</string>
                                                                                        <reference key="NSSuperview" ref="581795577"/>
+                                                                                       <reference key="NSWindow"/>
                                                                                        <reference key="NSNextKeyView" ref="414504914"/>
                                                                                        <int key="NSDividerStyle">2</int>
                                                                                </object>
                                                                        </object>
                                                                        <string key="NSFrameSize">{180, 400}</string>
                                                                        <reference key="NSSuperview" ref="374340452"/>
+                                                                       <reference key="NSWindow"/>
                                                                        <reference key="NSNextKeyView" ref="462572416"/>
                                                                        <string key="NSClassName">NSView</string>
                                                                </object>
                                                                                        <int key="NSvFlags">4370</int>
                                                                                        <string key="NSFrame">{{-1, -1}, {511, 402}}</string>
                                                                                        <reference key="NSSuperview" ref="987905504"/>
+                                                                                       <reference key="NSWindow"/>
                                                                                        <reference key="NSNextKeyView"/>
                                                                                        <bool key="NSEnabled">YES</bool>
                                                                                        <object class="NSBrowserCell" key="NSCellPrototype">
                                                                        </object>
                                                                        <string key="NSFrame">{{181, 0}, {509, 400}}</string>
                                                                        <reference key="NSSuperview" ref="374340452"/>
+                                                                       <reference key="NSWindow"/>
                                                                        <reference key="NSNextKeyView" ref="259981942"/>
                                                                        <string key="NSClassName">NSView</string>
                                                                </object>
                                                        </object>
                                                        <string key="NSFrameSize">{690, 400}</string>
                                                        <reference key="NSSuperview" ref="1006"/>
+                                                       <reference key="NSWindow"/>
                                                        <reference key="NSNextKeyView" ref="581795577"/>
                                                        <bool key="NSIsVertical">YES</bool>
                                                        <int key="NSDividerStyle">2</int>
                                        </object>
                                        <string key="NSFrame">{{7, 11}, {690, 400}}</string>
                                        <reference key="NSSuperview"/>
+                                       <reference key="NSWindow"/>
                                        <reference key="NSNextKeyView" ref="374340452"/>
                                </object>
                                <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
                        <object class="NSUserDefaultsController" id="505454360">
                                <bool key="NSSharedInstance">YES</bool>
                        </object>
-                       <object class="NSTreeController" id="995272659">
-                               <object class="NSMutableArray" key="NSDeclaredKeys">
-                                       <bool key="EncodedWithXMLCoder">YES</bool>
-                                       <string>representedObject.displayName</string>
-                                       <string>representedObject</string>
-                               </object>
-                               <string key="NSObjectClassName">PithosNode</string>
-                               <object class="_NSManagedProxy" key="_NSManagedProxy"/>
-                               <bool key="NSAvoidsEmptySelection">YES</bool>
-                               <bool key="NSPreservesSelection">YES</bool>
-                               <bool key="NSSelectsInsertedObjects">YES</bool>
-                               <string key="NSTreeContentChildrenKey">childNodes</string>
-                               <string key="NSTreeContentLeafKey">isLeaf</string>
-                       </object>
                </object>
                <object class="IBObjectContainer" key="IBDocument.Objects">
                        <object class="NSMutableArray" key="connectionRecords">
                                        <int key="connectionID">37</int>
                                </object>
                                <object class="IBConnectionRecord">
-                                       <object class="IBBindingConnection" key="connection">
-                                               <string key="label">contentArray: outlineViewDataSourceArray</string>
-                                               <reference key="source" ref="995272659"/>
-                                               <reference key="destination" ref="1001"/>
-                                               <object class="NSNibBindingConnector" key="connector">
-                                                       <reference key="NSSource" ref="995272659"/>
-                                                       <reference key="NSDestination" ref="1001"/>
-                                                       <string key="NSLabel">contentArray: outlineViewDataSourceArray</string>
-                                                       <string key="NSBinding">contentArray</string>
-                                                       <string key="NSKeyPath">outlineViewDataSourceArray</string>
-                                                       <int key="NSNibBindingConnectorVersion">2</int>
-                                               </object>
-                                       </object>
-                                       <int key="connectionID">42</int>
-                               </object>
-                               <object class="IBConnectionRecord">
-                                       <object class="IBBindingConnection" key="connection">
-                                               <string key="label">value: arrangedObjects.representedObject</string>
-                                               <reference key="source" ref="612034888"/>
-                                               <reference key="destination" ref="995272659"/>
-                                               <object class="NSNibBindingConnector" key="connector">
-                                                       <reference key="NSSource" ref="612034888"/>
-                                                       <reference key="NSDestination" ref="995272659"/>
-                                                       <string key="NSLabel">value: arrangedObjects.representedObject</string>
-                                                       <string key="NSBinding">value</string>
-                                                       <string key="NSKeyPath">arrangedObjects.representedObject</string>
-                                                       <object class="NSDictionary" key="NSOptions">
-                                                               <string key="NS.key.0">NSConditionallySetsEditable</string>
-                                                               <boolean value="YES" key="NS.object.0"/>
-                                                       </object>
-                                                       <int key="NSNibBindingConnectorVersion">2</int>
-                                               </object>
-                                       </object>
-                                       <int key="connectionID">46</int>
-                               </object>
-                               <object class="IBConnectionRecord">
                                        <object class="IBOutletConnection" key="connection">
                                                <string key="label">verticalSplitView</string>
                                                <reference key="source" ref="1001"/>
                                        </object>
                                        <int key="connectionID">174</int>
                                </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBOutletConnection" key="connection">
+                                               <string key="label">dataSource</string>
+                                               <reference key="source" ref="392693553"/>
+                                               <reference key="destination" ref="1001"/>
+                                       </object>
+                                       <int key="connectionID">175</int>
+                               </object>
                        </object>
                        <object class="IBMutableOrderedSet" key="objectRecords">
                                <object class="NSArray" key="orderedObjects">
                                                <reference key="parent" ref="987905504"/>
                                        </object>
                                        <object class="IBObjectRecord">
-                                               <int key="objectID">38</int>
-                                               <reference key="object" ref="995272659"/>
-                                               <reference key="parent" ref="0"/>
-                                       </object>
-                                       <object class="IBObjectRecord">
                                                <int key="objectID">113</int>
                                                <reference key="object" ref="817791921"/>
                                                <object class="NSMutableArray" key="children">
                                        <string>31.IBPluginDependency</string>
                                        <string>32.IBPluginDependency</string>
                                        <string>35.IBPluginDependency</string>
-                                       <string>38.IBPluginDependency</string>
                                        <string>39.IBPluginDependency</string>
                                        <string>8.IBPluginDependency</string>
                                </object>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-                                       <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                </object>
                        </object>
                        <object class="NSMutableDictionary" key="unlocalizedProperties">
                                <reference key="dict.values" ref="0"/>
                        </object>
                        <nil key="sourceID"/>
-                       <int key="maxID">174</int>
+                       <int key="maxID">175</int>
+               </object>
+               <object class="IBClassDescriber" key="IBDocument.Classes">
+                       <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+                               <bool key="EncodedWithXMLCoder">YES</bool>
+                               <object class="IBPartialClassDescription">
+                                       <string key="className">PithosBrowserController</string>
+                                       <string key="superclassName">NSWindowController</string>
+                                       <object class="NSMutableDictionary" key="actions">
+                                               <string key="NS.key.0">refresh:</string>
+                                               <string key="NS.object.0">id</string>
+                                       </object>
+                                       <object class="NSMutableDictionary" key="actionInfosByName">
+                                               <string key="NS.key.0">refresh:</string>
+                                               <object class="IBActionInfo" key="NS.object.0">
+                                                       <string key="name">refresh:</string>
+                                                       <string key="candidateClassName">id</string>
+                                               </object>
+                                       </object>
+                                       <object class="NSMutableDictionary" key="outlets">
+                                               <bool key="EncodedWithXMLCoder">YES</bool>
+                                               <object class="NSArray" key="dict.sortedKeys">
+                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                       <string>browser</string>
+                                                       <string>horizontalSplitView</string>
+                                                       <string>leftBottomView</string>
+                                                       <string>leftTopView</string>
+                                                       <string>outlineView</string>
+                                                       <string>verticalSplitView</string>
+                                               </object>
+                                               <object class="NSMutableArray" key="dict.values">
+                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                       <string>NSBrowser</string>
+                                                       <string>NSSplitView</string>
+                                                       <string>NSView</string>
+                                                       <string>NSView</string>
+                                                       <string>NSOutlineView</string>
+                                                       <string>NSSplitView</string>
+                                               </object>
+                                       </object>
+                                       <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+                                               <bool key="EncodedWithXMLCoder">YES</bool>
+                                               <object class="NSArray" key="dict.sortedKeys">
+                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                       <string>browser</string>
+                                                       <string>horizontalSplitView</string>
+                                                       <string>leftBottomView</string>
+                                                       <string>leftTopView</string>
+                                                       <string>outlineView</string>
+                                                       <string>verticalSplitView</string>
+                                               </object>
+                                               <object class="NSMutableArray" key="dict.values">
+                                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                                                       <object class="IBToOneOutletInfo">
+                                                               <string key="name">browser</string>
+                                                               <string key="candidateClassName">NSBrowser</string>
+                                                       </object>
+                                                       <object class="IBToOneOutletInfo">
+                                                               <string key="name">horizontalSplitView</string>
+                                                               <string key="candidateClassName">NSSplitView</string>
+                                                       </object>
+                                                       <object class="IBToOneOutletInfo">
+                                                               <string key="name">leftBottomView</string>
+                                                               <string key="candidateClassName">NSView</string>
+                                                       </object>
+                                                       <object class="IBToOneOutletInfo">
+                                                               <string key="name">leftTopView</string>
+                                                               <string key="candidateClassName">NSView</string>
+                                                       </object>
+                                                       <object class="IBToOneOutletInfo">
+                                                               <string key="name">outlineView</string>
+                                                               <string key="candidateClassName">NSOutlineView</string>
+                                                       </object>
+                                                       <object class="IBToOneOutletInfo">
+                                                               <string key="name">verticalSplitView</string>
+                                                               <string key="candidateClassName">NSSplitView</string>
+                                                       </object>
+                                               </object>
+                                       </object>
+                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
+                                               <string key="majorKey">IBProjectSource</string>
+                                               <string key="minorKey">./Classes/PithosBrowserController.h</string>
+                                       </object>
+                               </object>
+                       </object>
                </object>
-               <object class="IBClassDescriber" key="IBDocument.Classes"/>
                <int key="IBDocument.localizationMode">0</int>
                <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
                <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
index 0720d48..fa2f9f7 100644 (file)
@@ -79,7 +79,6 @@
 - (void)invalidateChildren;
 - (void)invalidateChildrenRecursive;
 - (void)refresh;
-- (void)refreshToRoot;
 
 - (void)showPithosNodeInfo:(id)sender;
 - (void)pithosNodeInfoWillClose:(id)sender;
index e8cac8d..4ae40d9 100644 (file)
     self.children;
 }
 
-- (void)refreshToRoot {
-    [self invalidateChildren];
-    [self.parent refreshToRoot];
-    self.children;
-}
-
 - (void)showPithosNodeInfo:(id)sender {
     // Abstract method
 }
index e72b6f1..d396d4b 100644 (file)
         pithosObject = [aPithosObject retain];
     }
     self.isPublic = (pithosObject.publicURI != nil);
-    // Refresh parent if the object is in my shared and is no longer shared
+    // Refresh browser if the object is in my shared and is no longer shared
     if (shared && !pithosObject.sharing)
-        [self.parent refreshToRoot];
+        [[NSNotificationCenter defaultCenter] postNotificationName:@"PithosBrowserRefreshNeeeded" object:self];
 }
 
 #pragma mark -
     NSLog(@"cached: %d", [request didUseCachedResponse]);
     
     if ([request isEqualTo:applyMetadataObjectRequest]) {
+        int responseStatusCode = applyMetadataObjectRequest.responseStatusCode;
+        if (responseStatusCode != 202)
+            [PithosFileUtilities unexpectedResponseStatusAlertWithRequest:applyMetadataObjectRequest];
         @synchronized(self) {
             [applyMetadataObjectRequest release];
             applyMetadataObjectRequest = nil;
         }
-        [self refreshInfo];
+        if (responseStatusCode == 202)
+            [self refreshInfo];
     } else if ([request isEqualTo:refreshMetadataObjectRequest]) {
         [[pithosNodeInfoController window] makeFirstResponder:nil];
-        
         self.pithosObject = [refreshMetadataObjectRequest object];
         @synchronized(self) {
             [refreshMetadataObjectRequest release];
                                                                                                contentEncoding:pithosObject.contentEncoding 
                                                                                             contentDisposition:pithosObject.contentDisposition 
                                                                                                       manifest:pithosObject.manifest 
-                                                                                                       sharing:pithosObject.sharing 
+                                                                                                       sharing:(pithosObject.sharing ? pithosObject.sharing : @"")
                                                                                                       isPublic:(isPublic ? ASIPithosObjectRequestPublicTrue : ASIPithosObjectRequestPublicFalse) 
                                                                                                       metadata:pithosObject.metadata
                                                                                                         update:NO] retain];
index 6f24b9f..d634daa 100644 (file)
@@ -116,9 +116,10 @@ static NSImage *sharedIcon = nil;
         self.prefix = [NSString stringWithString:pithosObject.name];
     }
     self.isPublic = (pithosObject.publicURI != nil);
-    // Refresh parent if the object is in my shared and is no longer shared
-    if (shared && !pithosObject.subdir && !pithosObject.sharing)
-        [self.parent refreshToRoot];
+    // Refresh browser if the object is in my shared and is no longer shared
+    if (shared && !pithosObject.subdir && !pithosObject.sharing) {
+        [[NSNotificationCenter defaultCenter] postNotificationName:@"PithosBrowserRefreshNeeeded" object:self];
+    }
 }
 
 #pragma mark -
@@ -129,19 +130,22 @@ static NSImage *sharedIcon = nil;
     NSLog(@"cached: %d", [request didUseCachedResponse]);
     
     if ([request isEqualTo:applyMetadataObjectRequest]) {
+        int responseStatusCode = applyMetadataObjectRequest.responseStatusCode;
+        if ((responseStatusCode != 201) && (responseStatusCode != 202))
+            [PithosFileUtilities unexpectedResponseStatusAlertWithRequest:applyMetadataObjectRequest];
         @synchronized(self) {
             [applyMetadataObjectRequest release];
             applyMetadataObjectRequest = nil;
         }
-        [self refreshInfo];
+        if ((responseStatusCode == 201) || (responseStatusCode == 202))
+            [self refreshInfo];
     } else if ([request isEqualTo:refreshMetadataObjectRequest]) {
         [[pithosNodeInfoController window] makeFirstResponder:nil];
         self.pithosObject = [refreshMetadataObjectRequest object];
         if (refreshParent) {
             // Ask the parent for refresh for the case where an object was removed
             // It is done here so that it doesn't affect the info window refresh
-            [parent invalidateChildren];
-            [parent children];
+            [parent refresh];
             refreshParent = NO;
         }
         @synchronized(self) {
@@ -245,7 +249,7 @@ static NSImage *sharedIcon = nil;
                                                                                                    contentEncoding:pithosObject.contentEncoding
                                                                                                 contentDisposition:pithosObject.contentDisposition 
                                                                                                           manifest:pithosObject.manifest 
-                                                                                                           sharing:pithosObject.sharing 
+                                                                                                           sharing:(pithosObject.sharing ? pithosObject.sharing : @"") 
                                                                                                           isPublic:(isPublic ? ASIPithosObjectRequestPublicTrue : ASIPithosObjectRequestPublicFalse) 
                                                                                                           metadata:pithosObject.metadata
                                                                                                             update:NO] retain];