show the number of blocked ip addresses in the preferences window
This commit is contained in:
parent
7539b95f14
commit
5596981934
|
@ -80,7 +80,7 @@
|
|||
fCurrentSize += length;
|
||||
|
||||
#warning factor for unknown size, combine 2 strings - make a single private method
|
||||
[fTextField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"Downloading blocklist (%.1f%%)",
|
||||
[fTextField setStringValue: [NSString localizedStringWithFormat: NSLocalizedString(@"Downloading blocklist (%.1f%%)",
|
||||
"Blocklist -> message"), 100.0 * ((double)fCurrentSize / fExpectedSize)]];
|
||||
[fProgressBar setDoubleValue: (double)fCurrentSize / fExpectedSize];
|
||||
}
|
||||
|
|
|
@ -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"]];
|
||||
|
|
Loading…
Reference in New Issue