-
Notifications
You must be signed in to change notification settings - Fork 55
/
TargetConfig.m
36 lines (28 loc) · 882 Bytes
/
TargetConfig.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// TargetConfig.m
// Enjoy
//
// Created by Sam McCall on 6/05/09.
//
#import "TargetConfig.h"
@implementation TargetConfig
@synthesize config;
-(NSString*) stringify {
return [[NSString alloc] initWithFormat: @"cfg~%@", [config name]];
}
+(TargetConfig*) unstringifyImpl: (NSArray*) comps withConfigList: (NSArray*) configs {
NSParameterAssert([comps count] == 2);
NSString* name = [comps objectAtIndex: 1];
TargetConfig* target = [[TargetConfig alloc] init];
for(int i=0; i<[configs count]; i++)
if([[[configs objectAtIndex:i] name] isEqualToString:name]) {
[target setConfig: [configs objectAtIndex:i]];
return target;
}
NSLog(@"Warning: couldn't find matching config to restore from: %@",name);
return NULL;
}
-(void) trigger {
[[[[NSApplication sharedApplication] delegate] configsController] activateConfig:config forApplication: NULL];
}
@end