X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=ConfigsController.m;h=58614b2f56610c37b43923c2dd343d6f6c40a6c4;hp=cc16b6eadf61b2edb591e7571098dd5173c8e338;hb=25dd74a4a34f4ba7ec797360bd8f92cbd7bc758e;hpb=5a79f9f05829ca1aecc70aeadb8c980ec4f3556d diff --git a/ConfigsController.m b/ConfigsController.m index cc16b6e..58614b2 100644 --- a/ConfigsController.m +++ b/ConfigsController.m @@ -26,6 +26,9 @@ [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; @@ -33,7 +36,6 @@ if(psn) { if(!neutralConfig) neutralConfig = currentConfig; - attachedApplication = *psn; } else { neutralConfig = NULL; } @@ -66,11 +68,11 @@ [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]; } } @@ -183,10 +185,4 @@ [self restoreNeutralConfig]; } --(ProcessSerialNumber*) targetApplication { - if(neutralConfig) - return &attachedApplication; - return NULL; -} - @end