[self activateConfig: neutralConfig forApplication: NULL];
}
+// TODO: Not an appropriate way to track 'neutral configs', it should just
+// always be the first config and be unremovable.
+
-(void) activateConfig: (Config*)config forApplication: (ProcessSerialNumber*) psn {
if(currentConfig == config)
return;
if(psn) {
if(!neutralConfig)
neutralConfig = currentConfig;
- attachedApplication = *psn;
} else {
neutralConfig = NULL;
}
[configs removeObjectAtIndex: [tableView selectedRow]];
// remove all "switch to configuration" actions
- for(int i=0; i<[configs count]; i++) {
- NSMutableDictionary* entries = [(Config*)configs[i] entries];
- for(id key in entries) {
- Target* target = (Target*) entries[key];
- if([target isKindOfClass: [TargetConfig class]] && [(TargetConfig*)target config] == current_config)
+ for (Config *config in configs) {
+ NSMutableDictionary *entries = config.entries;
+ for (id key in entries) {
+ Target *target = entries[key];
+ if([target isKindOfClass:[TargetConfig class]] && [(TargetConfig *)target config] == current_config)
[entries removeObjectForKey: key];
}
}
[ary addObject: cfgInfo];
}
envelope[@"configurationList"] = ary;
- envelope[@"selectedIndex"] = [NSNumber numberWithInt: [configs indexOfObject: [self currentNeutralConfig] ] ];
+ envelope[@"selectedIndex"] = @([configs indexOfObject: [self currentNeutralConfig] ]);
return envelope;
}
-(void) loadAllFrom: (NSDictionary*) envelope{
[self restoreNeutralConfig];
}
--(ProcessSerialNumber*) targetApplication {
- if(neutralConfig)
- return &attachedApplication;
- return NULL;
-}
-
@end