Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (26 sloc) 1.12 KB
/**
* This code is free software; you can redistribute it and/or modify it under
* the terms of the new BSD License.
*
* Copyright (c) 2010, Sebastian Staudt
*/
#import "SettingsManager.h"
@implementation SettingsManager
@synthesize pluginManager;
- (void)setSettingWithName:(NSString *)aName toValue:(id)aValue forPlugin:(PalantirPlugin *)aPlugin {
NSMutableDictionary *plugins = self.pluginManager.availablePlugins;
NSMutableDictionary *pluginSettings = [[plugins objectForKey:aPlugin.identifier] objectForKey:@"settings"];
if(aValue != nil) {
[pluginSettings setObject:aValue forKey:aName];
} else {
[pluginSettings removeObjectForKey:aName];
}
[[NSUserDefaults standardUserDefaults] setObject:plugins forKey:@"plugins"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (id)settingWithName:(NSString *)aName forPlugin:(PalantirPlugin *)aPlugin {
return [[[self.pluginManager.availablePlugins objectForKey:aPlugin.identifier]
objectForKey:@"settings"]
objectForKey:aName];
}
@end