X-Git-Url: https://git.saurik.com/winterboard.git/blobdiff_plain/b054b53d5b5c4f6c79fe8c7e8e2f0f9141810518..af22086e643ffc516d8753facfe6c660ec0b63e8:/Settings.mm diff --git a/Settings.mm b/Settings.mm index 2029981..3ef8fe3 100644 --- a/Settings.mm +++ b/Settings.mm @@ -445,25 +445,29 @@ static NSString *_plist; UnHideIconViaDisplayId = reinterpret_cast(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 ([_settings objectForKey:@"SummerBoard"] == nil) - [_settings setObject:[NSNumber numberWithBool:set] 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; } @@ -505,15 +509,15 @@ static NSString *_plist; system("rm -rf /User/Library/Caches/com.apple.springboard.sharedimagecache"); system("killall lsd SpringBoard"); + system("killall -9 lsd SpringBoard"); } - (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];