diff --git a/macosx/Torrent.m b/macosx/Torrent.m index f76eabf8c..f5367b451 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -537,11 +537,12 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void * NSFileManager * fileManager = [NSFileManager defaultManager]; NSString * downloadFolder = [self downloadFolder]; - BOOL onLeopard = [NSApp isOnLeopardOrBetter]; NSString * volumeName; if ((volumeName = [[fileManager componentsToDisplayForPath: downloadFolder] objectAtIndex: 0])) { + BOOL onLeopard = [NSApp isOnLeopardOrBetter]; + NSDictionary * systemAttributes = onLeopard ? [fileManager attributesOfFileSystemForPath: downloadFolder error: NULL] : [fileManager fileSystemAttributesAtPath: downloadFolder]; uint64_t remainingSpace = [[systemAttributes objectForKey: NSFileSystemFreeSize] unsignedLongLongValue], neededSpace = 0; @@ -578,7 +579,6 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void * [alert addButtonWithTitle: NSLocalizedString(@"OK", "Torrent file disk space alert -> button")]; [alert addButtonWithTitle: NSLocalizedString(@"Download Anyway", "Torrent file disk space alert -> button")]; - BOOL onLeopard = [NSApp isOnLeopardOrBetter]; if (onLeopard) [alert setShowsSuppressionButton: YES]; else diff --git a/macosx/TorrentTableView.m b/macosx/TorrentTableView.m index 07303261d..3dfc76924 100644 --- a/macosx/TorrentTableView.m +++ b/macosx/TorrentTableView.m @@ -36,6 +36,9 @@ #define PIECE_CHANGE 0.1 #define PIECE_TIME 0.005 +#define GROUP_SPEED_IMAGE_COLUMN_WIDTH 8.0 +#define GROUP_RATIO_IMAGE_COLUMN_WIDTH 10.0 + @interface TorrentTableView (Private) - (BOOL) pointInControlRect: (NSPoint) point; @@ -90,10 +93,6 @@ else fCollapsedGroups = [[NSMutableIndexSet alloc] init]; - //set group columns to show ratio (nib is set to speeds) - if ([fDefaults boolForKey: @"DisplayGroupRowRatio"]) - [self setGroupStatusColumns]; - fMouseControlRow = -1; fMouseRevealRow = -1; fMouseActionRow = -1; @@ -121,6 +120,12 @@ [super dealloc]; } +- (void) awakeFromNib +{ + //set group columns to show ratio, needs to be in awakeFromNib to size columns correctly + [self setGroupStatusColumns]; +} + - (BOOL) isGroupCollapsed: (int) value { if (value < 0) @@ -817,16 +822,20 @@ BOOL ratio = [fDefaults boolForKey: @"DisplayGroupRowRatio"]; NSTableColumn * dlTableColumn = [self tableColumnWithIdentifier: @"DL"]; - if ([dlTableColumn isHidden] == ratio) - return; [dlTableColumn setHidden: ratio]; [[self tableColumnWithIdentifier: @"DL Image"] setHidden: ratio]; - [[self tableColumnWithIdentifier: @"UL Image"] setWidth: ratio ? 10.0 : 8.0]; - - NSTableColumn * groupTableColumn = [self tableColumnWithIdentifier: @"Group"]; - [groupTableColumn setWidth: [groupTableColumn width] + (ratio ? -2.0 : 2.0)]; + //change size of image column + NSTableColumn * ulImageTableColumn = [self tableColumnWithIdentifier: @"UL Image"]; + float oldWidth = [ulImageTableColumn width], newWidth = ratio ? GROUP_RATIO_IMAGE_COLUMN_WIDTH : GROUP_SPEED_IMAGE_COLUMN_WIDTH; + if (oldWidth != newWidth) + { + [ulImageTableColumn setWidth: newWidth]; + + NSTableColumn * groupTableColumn = [self tableColumnWithIdentifier: @"Group"]; + [groupTableColumn setWidth: [groupTableColumn width] - (newWidth - oldWidth)]; + } } - (void) createFileMenu: (NSMenu *) menu forFiles: (NSArray *) files