mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
show the number of blocked ip addresses in the preferences window
This commit is contained in:
@@ -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"]];
|
||||
|
||||
Reference in New Issue
Block a user