avoid setting views in the inspector until necessary

This commit is contained in:
Mitchell Livingston
2010-03-09 02:26:52 +00:00
parent eab787ac7d
commit 15c2279052
13 changed files with 267 additions and 151 deletions

View File

@@ -30,6 +30,8 @@
@interface InfoFileViewController (Private)
- (void) setupInfo;
- (BOOL) canQuickLookFile: (FileListNode *) item;
@end
@@ -62,24 +64,14 @@
[fTorrents release];
fTorrents = [torrents retain];
[fFileFilterField setStringValue: @""];
if ([fTorrents count] == 1)
{
Torrent * torrent = [fTorrents objectAtIndex: 0];
[fFileController setTorrent: torrent];
[fFileFilterField setEnabled: [torrent isFolder]];
}
else
{
[fFileController setTorrent: nil];
[fFileFilterField setEnabled: NO];
}
fSet = NO;
}
- (void) updateInfo
{
if (!fSet)
[self setupInfo];
if ([fTorrents count] == 1)
[fFileController reloadData];
}
@@ -158,6 +150,26 @@
@implementation InfoFileViewController (Private)
- (void) setupInfo
{
[fFileFilterField setStringValue: @""];
if ([fTorrents count] == 1)
{
Torrent * torrent = [fTorrents objectAtIndex: 0];
[fFileController setTorrent: torrent];
[fFileFilterField setEnabled: [torrent isFolder]];
}
else
{
[fFileController setTorrent: nil];
[fFileFilterField setEnabled: NO];
}
fSet = YES;
}
- (BOOL) canQuickLookFile: (FileListNode *) item
{
Torrent * torrent = [fTorrents objectAtIndex: 0];