show the number of blocked ip addresses in the preferences window

This commit is contained in:
Mitchell Livingston
2008-03-30 01:10:18 +00:00
parent 7539b95f14
commit 5596981934
2 changed files with 14 additions and 4 deletions

View File

@@ -374,9 +374,19 @@
{
BOOL exists = tr_blocklistExists(fHandle);
[fBlocklistMessageField setStringValue: exists
? NSLocalizedString(@"Blocklist is loaded", "Prefs -> blocklist -> message")
: NSLocalizedString(@"A blocklist must first be downloaded", "Prefs -> blocklist -> message")];
if (exists)
{
NSNumberFormatter * numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setNumberStyle: NSNumberFormatterDecimalStyle];
NSString * countString = [numberFormatter stringFromNumber: [NSNumber numberWithInt: tr_blocklistGetRuleCount(fHandle)]];
[numberFormatter release];
[fBlocklistMessageField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ blocked IP addresses",
"Prefs -> blocklist -> message"), countString]];
}
else
[fBlocklistMessageField setStringValue: NSLocalizedString(@"A blocklist must first be downloaded",
"Prefs -> blocklist -> message")];
[fBlocklistEnableCheck setEnabled: exists];
[fBlocklistEnableCheck setState: exists && [fDefaults boolForKey: @"Blocklist"]];