X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=ConfigsController.m;h=58614b2f56610c37b43923c2dd343d6f6c40a6c4;hp=3168f8d31bb7df7b99f4a654d245171364efc316;hb=25dd74a4a34f4ba7ec797360bd8f92cbd7bc758e;hpb=51ca12b552a9c17c4d4029b0340e193b273044a8 diff --git a/ConfigsController.m b/ConfigsController.m index 3168f8d..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]; } } @@ -139,7 +141,7 @@ [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{ @@ -183,10 +185,4 @@ [self restoreNeutralConfig]; } --(ProcessSerialNumber*) targetApplication { - if(neutralConfig) - return &attachedApplication; - return NULL; -} - @end