1 #import <Foundation/Foundation.h>
7 int main(int argc, const char *argv[]) {
8 if (argc < 2 || strcmp(argv[1], "remove") != 0)
11 struct passwd *passwd = getpwnam("mobile");
17 if (setregid(passwd->pw_gid, passwd->pw_gid) == -1) {
22 if (setreuid(passwd->pw_uid, passwd->pw_uid) == -1) {
27 NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
29 NSString *path([NSString stringWithFormat:@"%@/Library/Preferences/com.apple.springboard.plist", NSHomeDirectory()]);
31 NSMutableDictionary *settings([[NSMutableDictionary alloc] initWithContentsOfFile:path]);
35 NSMutableDictionary *iconState([settings objectForKey:@"iconState"]);
39 NSMutableDictionary *buttonBar([iconState objectForKey:@"buttonBar"]);
43 NSMutableArray *buttonBarIconMatrix([buttonBar objectForKey:@"iconMatrix"]);
44 if (buttonBarIconMatrix == nil || [buttonBarIconMatrix count] == 0)
47 NSMutableArray *buttonBarRow([buttonBarIconMatrix objectAtIndex:0]);
48 if (buttonBarRow == nil || [buttonBarRow count] < 5)
51 NSMutableDictionary *fifth([buttonBarRow objectAtIndex:4]);
53 if (![fifth isEqual:[NSNumber numberWithInt:0]]) {
54 NSMutableArray *iconLists([iconState objectForKey:@"iconLists"]);
56 iconLists = [NSMutableArray arrayWithCapacity:1];
57 else for (NSUInteger i(0), e([iconLists count]); i != e; ++i) {
58 NSMutableDictionary *iconList([iconLists objectAtIndex:i]);
59 NSMutableArray *iconMatrix([iconList objectForKey:@"iconMatrix"]);
60 if (iconMatrix == nil)
63 for (NSUInteger i(0), e([iconMatrix count]); i != e; ++i) {
64 NSMutableArray *row([iconMatrix objectAtIndex:i]);
65 NSUInteger spot([row indexOfObject:[NSNumber numberWithInteger:0]]);
66 if (spot != NSNotFound) {
67 [row replaceObjectAtIndex:i withObject:fifth];
73 [iconLists addObject:[NSDictionary dictionaryWithObjectsAndKeys:
74 [NSArray arrayWithObjects:[NSArray arrayWithObject:fifth], nil], @"iconMatrix",
79 [buttonBarRow removeLastObject];
80 bool saved([settings writeToFile:path atomically:YES]);