]> git.saurik.com Git - winterboard.git/blobdiff - Settings.mm
Fix icon image alpha code on 3.1.2.
[winterboard.git] / Settings.mm
index 3a506d71478a4df3275a16d946757efa87a1acc1..6ba7b41261dd53e5cc8a657c764377f92661196a 100644 (file)
@@ -445,25 +445,29 @@ static NSString *_plist;
     UnHideIconViaDisplayId = reinterpret_cast<BOOL (*)(NSString *)>(dlsym(libhide, "UnHideIconViaDisplayId"));
 }
 
-- (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];
-
-        bool set;
-        if (_settings != nil)
-            set = true;
-        else {
-            set = false;
-            _settings = [NSMutableDictionary dictionary];
-        }
+- (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];
+    _settings = [_settings retain];
 
-        if (set && [_settings objectForKey:@"SummerBoard"] == nil)
-            [_settings setObject:[NSNumber numberWithBool:YES] forKey:@"SummerBoard"];
+    if ([_settings objectForKey:@"SummerBoard"] == nil)
+        [_settings setObject:[NSNumber numberWithBool:set] forKey:@"SummerBoard"];
 
-        [_settings setObject:[NSNumber numberWithBool:IsIconHiddenDisplayId(WinterBoardDisplayID)] forKey:@"IconHidden"];
+    [_settings setObject:[NSNumber numberWithBool:IsIconHiddenDisplayId(WinterBoardDisplayID)] forKey:@"IconHidden"];
+}
+
+- (id) initForContentSize:(CGSize)size {
+    if ((self = [super initForContentSize:size]) != nil) {
+        [self _wb$loadSettings];
     } return self;
 }
 
@@ -510,10 +514,9 @@ static NSString *_plist;
 - (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];