1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-04 02:28:03 +00:00

the blocklist downloader should get the tr_handle from the prefs controller instead of needing it passed separately

This commit is contained in:
Mitchell Livingston 2008-04-17 04:25:49 +00:00
parent ea9e0b260f
commit d581251a18
5 changed files with 14 additions and 10 deletions

View file

@ -30,7 +30,6 @@
@interface BlocklistDownloader : NSObject
{
PrefsController * fPrefsController;
tr_handle * fHandle;
IBOutlet NSWindow * fStatusWindow;
IBOutlet NSProgressIndicator * fProgressBar;
@ -43,7 +42,7 @@
long long fExpectedSize;
}
+ (id) downloadWithPrefsController: (PrefsController *) prefsController withHandle: (tr_handle *) handle;
+ (id) downloadWithPrefsController: (PrefsController *) prefsController;
- (void) cancelDownload: (id) sender;

View file

@ -32,7 +32,7 @@
@interface BlocklistDownloader (Private)
- (id) initWithPrefsController: (PrefsController *) prefsController withHandle: (tr_handle *) handle;
- (id) initWithPrefsController: (PrefsController *) prefsController;
- (void) startDownload;
- (void) updateProcessString;
- (void) failureSheetClosed: (NSAlert *) alert returnCode: (int) code contextInfo: (void *) info;
@ -41,9 +41,9 @@
@implementation BlocklistDownloader
+ (id) downloadWithPrefsController: (PrefsController *) prefsController withHandle: (tr_handle *) handle
+ (id) downloadWithPrefsController: (PrefsController *) prefsController
{
BlocklistDownloader * downloader = [[BlocklistDownloader alloc] initWithPrefsController: prefsController withHandle: handle];
BlocklistDownloader * downloader = [[BlocklistDownloader alloc] initWithPrefsController: prefsController];
[downloader startDownload];
}
@ -117,7 +117,7 @@
[fStatusWindow display]; //force window to be updated
//process data
tr_blocklistSetContent(fHandle, [DESTINATION UTF8String]);
tr_blocklistSetContent([fPrefsController handle], [DESTINATION UTF8String]);
//delete downloaded file
if ([NSApp isOnLeopardOrBetter])
@ -136,12 +136,11 @@
@implementation BlocklistDownloader (Private)
- (id) initWithPrefsController: (PrefsController *) prefsController withHandle: (tr_handle *) handle
- (id) initWithPrefsController: (PrefsController *) prefsController
{
if ((self = [super init]))
{
fPrefsController = prefsController;
fHandle = handle;
}
return self;

View file

@ -59,6 +59,7 @@
}
- (id) initWithHandle: (tr_handle *) handle;
- (tr_handle *) handle;
- (void) setUpdater: (SUUpdater *) updater;
- (void) updatePortField;

View file

@ -98,6 +98,11 @@
return self;
}
- (tr_handle *) handle
{
return fHandle;
}
- (void) dealloc
{
if (fPortStatusTimer)
@ -374,7 +379,7 @@
- (void) updateBlocklist: (id) sender
{
[BlocklistDownloader downloadWithPrefsController: self withHandle: fHandle];
[BlocklistDownloader downloadWithPrefsController: self];
}
- (void) updateBlocklistFields

View file

@ -386,7 +386,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
float stopRatio, ratio;
if ((stopRatio = [self actualStopRatio]) == INVALID || (ratio = [self ratio]) >= stopRatio)
return 1.0;
else if (ratio > 0 && stopRatio > 0)
else if (stopRatio > 0)
return ratio / stopRatio;
else
return 0;