Created
June 18, 2011 16:21
-
-
Save r-plus/1033240 to your computer and use it in GitHub Desktop.
answer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dict> | |
<key>cell</key> | |
<string>PSSwitchCell</string> | |
<key>default</key> | |
<false/> | |
<key>defaults</key> | |
<string>jp.r-plus.amdaijirin</string> | |
<key>key</key> | |
<string>ALCEnabled</string> | |
<key>label</key> | |
<string>ALC[origin word]</string> | |
<key>icon</key> | |
<key>Safari.png</key> | |
<key>set</key> | |
<string>setMasterToggle:specifier:</string> | |
</dict> | |
<dict> | |
<key>cell</key> | |
<string>PSSwitchCell</string> | |
<key>default</key> | |
<false/> | |
<key>defaults</key> | |
<string>jp.r-plus.amdaijirin</string> | |
<key>key</key> | |
<string>ALCMobilizerEnabled</string> | |
<key>label</key> | |
<string>Mobilizer(ALC only)</string> | |
<key>enabled</key> | |
<false/> | |
<key>id</key> | |
<string>ALCMobilizerID</string> | |
</dict> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation DaijirinListController | |
- (void)setMasterToggle:(id)value specifier:(id)specifier { | |
NSlog(@"SETTING_START"); | |
// You'd set the "set" property for your switch in your plist to | |
// "setMasterToggle:specifier:" so this gets called | |
[self setPreferenceValue:value specifier:specifier]; | |
BOOL boolValue = [value boolValue]; | |
// "SlaveToggle" is the ID of the toggle that depends on this switch | |
PSSpecifier* slaveSpecifier = [self specifierForID:@"ALCMobilizerID"]; | |
if (!boolValue) | |
[self setPreferenceValue:[NSNumber numberWithBool:NO] specifier:slaveSpecifier]; | |
[slaveSpecifier setProperty:[NSNumber numberWithBool:boolValue] forKey:@"enabled"]; | |
// Of course, you might want to split that behavior out into another method | |
// you could call during your initializer otherwise it will remain enabled | |
// when you first launch the prefs bundle. | |
[[NSUserDefaults standardUserDefaults] synchronize]; | |
} | |
- (id)specifiers { | |
if(_specifiers == nil) { | |
_specifiers = [[self loadSpecifiersFromPlistName:@"Daijirin" target:self] retain]; | |
} | |
return _specifiers; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment