add a preference to disable spellchecker (#115)

* add a preference to disable spellchecker

* add GSDisableSpellCheckerServer

* fix typo and unintentional error.

* be clearer about default.

* one was too much
This commit is contained in:
Riccardo 2021-10-18 22:29:50 +02:00 committed by GitHub
parent 31dcf70a11
commit 8892408c8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -287,6 +287,13 @@
Default "#".
</p>
</desc>
<term>GSDisableSpellCheckerServer</term>
<desc>
<p>
A boolean that, if set to YES, disables the start of the Spell Checker.
Default to NO.
</p>
</desc>
<term>NSInterfaceStyleDefault</term>
<desc>
<p>

View file

@ -59,6 +59,7 @@
#import "AppKit/NSTextField.h"
#import "AppKit/NSWindow.h"
#import "GSGuiPrivate.h"
#import "GNUstepBase/NSDebug+GNUstepBase.h"
#import "GNUstepGUI/GSServicesManager.h"
// prototype for function to create name for server
@ -105,6 +106,12 @@ extern NSString *GSSpellServerName(NSString *checkerDictionary, NSString *langua
@implementation GSServicesManager(NSSpellCheckerMethods)
- (id)_launchSpellCheckerForLanguage: (NSString *)language
{
if ([[NSUserDefaults standardUserDefaults] boolForKey: @"GSDisableSpellCheckerServer"])
{
GSOnceMLog(@"WARNING: spell checker disabled - reset 'GSDisableSpellCheckerServer' to NO in defaults to re-enable");
return nil;
}
id<NSSpellServerPrivateProtocol> proxy = nil;
NSDictionary *spellCheckers = [_allServices objectForKey: @"BySpell"];
NSDictionary *checkerDictionary = [spellCheckers objectForKey: language];
@ -131,7 +138,7 @@ extern NSString *GSSpellServerName(NSString *checkerDictionary, NSString *langua
[(NSDistantObject *)proxy setProtocolForProxy:
@protocol(NSSpellServerPrivateProtocol)];
}
return proxy;
}