don't check for speeds to badge that are disabled in prefs

This commit is contained in:
Mitchell Livingston 2008-04-25 04:38:08 +00:00
parent 48bec954be
commit 877c824ac2
1 changed files with 4 additions and 9 deletions

View File

@ -87,15 +87,10 @@
if ([NSApp isOnLeopardOrBetter])
{
float downloadRate = 0.0, uploadRate = 0.0;
BOOL checkDownload = [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeDownloadRate"],
checkUpload = [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeUploadRate"];
if (checkDownload || checkUpload)
{
tr_torrentRates(fLib, &downloadRate, &uploadRate);
downloadRate = checkDownload ? downloadRate : 0.0;
uploadRate = checkUpload ? uploadRate : 0.0;
}
BOOL badgeDownload = [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeDownloadRate"],
badgeUpload = [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeUploadRate"];
if (badgeDownload || badgeUpload)
tr_torrentRates(fLib, badgeDownload ? &downloadRate : NULL, badgeUpload ? &uploadRate : NULL);
//only update if the badged values change
if ([(BadgeView *)[[NSApp dockTile] contentView] setRatesWithDownload: downloadRate upload: uploadRate])