- themesArray_ = [themesArray_ retain];
-
- NSMutableSet *themesSet = [NSMutableSet setWithCapacity:32];
- for (NSMutableDictionary *theme in themesArray_)
- if (NSString *name = [theme objectForKey:@"Name"])
- [themesSet addObject:name];
-
- NSFileManager *manager = [NSFileManager defaultManager];
-
- NSMutableArray *themes = [NSMutableArray arrayWithCapacity:32];
- [themes addObjectsFromArray:[manager contentsOfDirectoryAtPath:@"/Library/Themes" error:NULL]];
- [themes addObjectsFromArray:[manager contentsOfDirectoryAtPath:[NSString stringWithFormat:@"%@/Library/SummerBoard/Themes", NSHomeDirectory()] error:NULL]];
-
- for (NSString *theme in themes) {
- if ([theme hasSuffix:@".theme"])
- theme = [theme substringWithRange:NSMakeRange(0, [theme length] - 6)];
- if ([themesSet containsObject:theme])
- continue;
- [themesSet addObject:theme];
- [themesArray_ addObject:[[NSDictionary dictionaryWithObjectsAndKeys:
- theme, @"Name",
- [NSNumber numberWithBool:NO], @"Active",
- nil] mutableCopy]];
- }