]> git.saurik.com Git - winterboard.git/blobdiff - Settings.mm
Provide some backwards compatibility for iOS 6 Maps.
[winterboard.git] / Settings.mm
index 442e97cbc2464c4401839155a88958a3b09b622c..ce81f16724aa2f63d58f918ab673bbcdd4e8573c 100644 (file)
@@ -445,12 +445,29 @@ static NSString *_plist;
     UnHideIconViaDisplayId = reinterpret_cast<BOOL (*)(NSString *)>(dlsym(libhide, "UnHideIconViaDisplayId"));
 }
 
+- (void) _wb$loadSettings {
+    _plist = [[NSString stringWithFormat:@"%@/Library/Preferences/com.saurik.WinterBoard.plist", NSHomeDirectory()] retain];
+    _settings = [NSMutableDictionary dictionaryWithContentsOfFile:_plist];
+
+    bool set;
+    if (_settings != nil)
+        set = true;
+    else {
+        set = false;
+        _settings = [NSMutableDictionary dictionary];
+    }
+
+    _settings = [_settings retain];
+
+    if ([_settings objectForKey:@"SummerBoard"] == nil)
+        [_settings setObject:[NSNumber numberWithBool:set] forKey:@"SummerBoard"];
+
+    [_settings setObject:[NSNumber numberWithBool:IsIconHiddenDisplayId(WinterBoardDisplayID)] forKey:@"IconHidden"];
+}
+
 - (id) initForContentSize:(CGSize)size {
     if ((self = [super initForContentSize:size]) != nil) {
-        _plist = [[NSString stringWithFormat:@"%@/Library/Preferences/com.saurik.WinterBoard.plist", NSHomeDirectory()] retain];
-        _settings = [([NSMutableDictionary dictionaryWithContentsOfFile:_plist] ?: [NSMutableDictionary dictionary]) retain];
-
-        [_settings setObject:[NSNumber numberWithBool:IsIconHiddenDisplayId(WinterBoardDisplayID)] forKey:@"IconHidden"];
+        [self _wb$loadSettings];
     } return self;
 }
 
@@ -491,16 +508,16 @@ static NSString *_plist;
     system("rm -rf /User/Library/Caches/com.apple.newsstand");
     system("rm -rf /User/Library/Caches/com.apple.springboard.sharedimagecache");
 
-    system("killall lsd SpringBoard");
+    system("killall -9 lsd");
+    system("killall SpringBoard backboardd");
 }
 
 - (void) cancelChanges {
     [_settings release];
     [_plist release];
-    _plist = [[NSString stringWithFormat:@"%@/Library/Preferences/com.saurik.WinterBoard.plist", NSHomeDirectory()] retain];
-    _settings = [([NSMutableDictionary dictionaryWithContentsOfFile:_plist] ?: [NSMutableDictionary dictionary]) retain];
 
-    [_settings setObject:[NSNumber numberWithBool:IsIconHiddenDisplayId(WinterBoardDisplayID)] forKey:@"IconHidden"];
+    [self _wb$loadSettings];
+
     [self reloadSpecifiers];
     if (![[PSViewController class] instancesRespondToSelector:@selector(showLeftButton:withStyle:rightButton:withStyle:)]) {
         [[self navigationItem] setLeftBarButtonItem:nil];