make sure the windows are closed before removing torrents...avoids a crash-on-quit

This commit is contained in:
Mitchell Livingston
2007-07-04 18:14:58 +00:00
parent 42a642bbbf
commit ab20e6d645
4 changed files with 24 additions and 20 deletions
+6 -6
View File
@@ -547,6 +547,12 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[fAutoImportTimer release];
}
//remember window states and close all windows
[fDefaults setBool: [[fInfoController window] isVisible] forKey: @"InfoVisible"];
[[NSApp windows] makeObjectsPerformSelector: @selector(close)];
[self showStatusBar: NO animate: NO];
[self showFilterBar: NO animate: NO];
//save history
[self updateTorrentHistory];
@@ -562,12 +568,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
//disable NAT traversal
tr_natTraversalEnable(fLib, 0);
//remember window states and close all windows
[fDefaults setBool: [[fInfoController window] isVisible] forKey: @"InfoVisible"];
[[NSApp windows] makeObjectsPerformSelector: @selector(close)];
[self showStatusBar: NO animate: NO];
[self showFilterBar: NO animate: NO];
//clear badge
[fBadger clearBadge];
+1 -1
View File
@@ -520,10 +520,10 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
{
NSMutableDictionary * info = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[self name], @"Name",
[NSNumber numberWithBool: [self isSeeding]], @"Seeding",
[NSNumber numberWithFloat: [self progress]], @"Progress",
[NSNumber numberWithFloat: (float)fStat->left/[self size]], @"Left",
[NSNumber numberWithBool: [self isActive]], @"Active",
[NSNumber numberWithBool: [self isSeeding]], @"Seeding",
[NSNumber numberWithBool: [self isChecking]], @"Checking",
[NSNumber numberWithBool: [self isError]], @"Error", nil];
+2 -2
View File
@@ -31,8 +31,8 @@
@interface TorrentCell : NSCell
{
NSImage * fErrorImage;
CTGradient * fWhiteGradient, * fGrayGradient, * fLightGrayGradient, * fLightGreenGradient,
* fGreenGradient, * fYellowGradient, * fBlueGradient, * fTransparentGradient;
CTGradient * fWhiteGradient, * fGrayGradient, * fLightGrayGradient, * fBlueGradient, * fDarkBlueGradient,
* fGreenGradient, * fLightGreenGradient, * fDarkGreenGradient, * fYellowGradient, * fTransparentGradient;
NSUserDefaults * fDefaults;
}
+15 -11
View File
@@ -50,8 +50,10 @@
fGrayGradient = [[CTGradient progressGrayGradient] retain];
fLightGrayGradient = [[CTGradient progressLightGrayGradient] retain];
fBlueGradient = [[CTGradient progressBlueGradient] retain];
//fDarkBlueGradient = [[CTGradient progressDarkBlueGradient] retain];
fGreenGradient = [[CTGradient progressGreenGradient] retain];
fLightGreenGradient = [[CTGradient progressLightGreenGradient] retain];
//fDarkGreenGradient = [[CTGradient progressDarkGreenGradient] retain];
fYellowGradient = [[CTGradient progressYellowGradient] retain];
fTransparentGradient = [[CTGradient progressTransparentGradient] retain];
@@ -101,19 +103,21 @@
}
}
if ([[info objectForKey: @"Checking"] boolValue])
[fYellowGradient fillRect: completeBounds angle: -90];
else if ([[info objectForKey: @"Seeding"] boolValue])
if ([[info objectForKey: @"Active"] boolValue])
{
NSRect ratioBounds = completeBounds;
ratioBounds.size.width *= [[info objectForKey: @"ProgressStopRatio"] floatValue];
if (ratioBounds.size.width < completeBounds.size.width)
[fLightGreenGradient fillRect: completeBounds angle: -90];
[fGreenGradient fillRect: ratioBounds angle: -90];
if ([[info objectForKey: @"Checking"] boolValue])
[fYellowGradient fillRect: completeBounds angle: -90];
else if ([[info objectForKey: @"Seeding"] boolValue])
{
NSRect ratioBounds = completeBounds;
ratioBounds.size.width *= [[info objectForKey: @"ProgressStopRatio"] floatValue];
if (ratioBounds.size.width < completeBounds.size.width)
[fLightGreenGradient fillRect: completeBounds angle: -90];
}
else
[fBlueGradient fillRect: completeBounds angle: -90];
}
else if ([[info objectForKey: @"Active"] boolValue])
[fBlueGradient fillRect: completeBounds angle: -90];
else
[fGrayGradient fillRect: completeBounds angle: -90];