Use API available on 10.7 for the commit window’s NSTableView

We’re using an NSViewController to load the nib so that we do not need to manually release the top level objects.
This commit is contained in:
Allan Odgaard
2014-04-16 22:22:30 +07:00
parent ae69d06c2c
commit 4474419405
2 changed files with 14 additions and 5 deletions

View File

@@ -1,10 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5053" systemVersion="13C64" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13C64" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5053"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="OakCommitWindow"/>
<customObject id="-2" userLabel="File's Owner" customClass="NSViewController">
<connections>
<outlet property="view" destination="bP4-qe-84i" id="MH0-D5-u3g"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<tableCellView identifier="path" id="bP4-qe-84i" userLabel="CWTableCellView" customClass="CWTableCellView">

View File

@@ -121,7 +121,6 @@ static NSUInteger const kOakCommitWindowCommitMessagesMax = 5;
tableView.menu.delegate = self;
_tableView = tableView;
[_tableView registerNib:[[NSNib alloc] initWithNibNamed:@"CWTableCellView" bundle:[NSBundle bundleForClass:[self class]]] forIdentifier:@"path"];
[self populateTableView];
[_tableView bind:NSContentBinding toObject:_arrayController withKeyPath:@"arrangedObjects" options:0];
@@ -586,7 +585,13 @@ static NSUInteger const kOakCommitWindowCommitMessagesMax = 5;
- (NSView*)tableView:(NSTableView*)aTableView viewForTableColumn:(NSTableColumn*)aTableColumn row:(NSInteger)row
{
CWTableCellView* cellView = [aTableView makeViewWithIdentifier:@"path" owner:self];
CWTableCellView* cellView = [aTableView makeViewWithIdentifier:aTableColumn.identifier owner:self];
if(!cellView)
{
NSViewController* viewController = [[NSViewController alloc] initWithNibName:@"CWTableCellView" bundle:[NSBundle bundleForClass:[self class]]];
cellView = (CWTableCellView*)viewController.view;
cellView.identifier = aTableColumn.identifier;
}
[cellView.textField bind:NSValueBinding toObject:cellView withKeyPath:@"objectValue.path" options:0];
[cellView.commitCheckBox bind:NSValueBinding toObject:cellView withKeyPath:@"objectValue.commit" options:0];