From f22a89893de5b47d242318375498ca9f02b6eba8 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 11 Aug 2008 23:14:09 +0000 Subject: [PATCH] Various release engineeirng issues. --- Application.mm | 29 +++++++++++++++++++++++++---- Library.mm | 12 ++++++++---- control | 2 +- makefile | 2 +- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/Application.mm b/Application.mm index 5f16bc4..36dc111 100644 --- a/Application.mm +++ b/Application.mm @@ -43,6 +43,7 @@ static NSString *plist_; static NSMutableDictionary *settings_; +static BOOL changed_; @interface WBThemeTableViewCell : UITableViewCell { UILabel *label; @@ -76,8 +77,11 @@ static NSMutableDictionary *settings_; } - (void) applicationWillTerminate:(UIApplication *)application { - [settings_ writeToFile:plist_ atomically:YES]; - system("killall SpringBoard"); + if (changed_) { + if (![settings_ writeToFile:plist_ atomically:YES]) + NSLog(@"WB:Error:writeToFile"); + system("killall SpringBoard"); + } } - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { @@ -99,6 +103,7 @@ static NSMutableDictionary *settings_; [theme setObject:[NSNumber numberWithBool:inactive] forKey:@"Active"]; cell.accessoryType = inactive ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone; [themesTable_ deselectRowAtIndexPath:(NSIndexPath *)indexPath animated:YES]; + changed_ = YES; } - (NSInteger) tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section { @@ -117,6 +122,7 @@ static NSMutableDictionary *settings_; NSMutableDictionary *theme = [[[themesArray_ objectAtIndex:fromIndex] retain] autorelease]; [themesArray_ removeObjectAtIndex:fromIndex]; [themesArray_ insertObject:theme atIndex:toIndex]; + changed_ = YES; } - (BOOL) tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { @@ -132,6 +138,8 @@ static NSMutableDictionary *settings_; ] retain]; settings_ = [[NSMutableDictionary alloc] initWithContentsOfFile:plist_]; + if (settings_ == nil) + settings_ = [[NSMutableDictionary alloc] initWithCapacity:16]; themesArray_ = [settings_ objectForKey:@"Themes"]; if (themesArray_ == nil) { @@ -162,9 +170,22 @@ static NSMutableDictionary *settings_; [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) { + for (NSUInteger i(0), e([themes count]); i != e; ++i) { + NSString *theme = [themes objectAtIndex:i]; if ([theme hasSuffix:@".theme"]) - theme = [theme substringWithRange:NSMakeRange(0, [theme length] - 6)]; + [themes replaceObjectAtIndex:i withObject:[theme substringWithRange:NSMakeRange(0, [theme length] - 6)]]; + } + + for (NSUInteger i(0), e([themesArray_ count]); i != e; ++i) { + NSMutableDictionary *theme = [themesArray_ objectAtIndex:i]; + NSString *name = [theme objectForKey:@"Name"]; + if (name == nil || ![themes containsObject:name]) { + [themesArray_ removeObjectAtIndex:i]; + --i; --e; + } + } + + for (NSString *theme in themes) { if ([themesSet containsObject:theme]) continue; [themesSet addObject:theme]; diff --git a/Library.mm b/Library.mm index 6e46c33..c26a44a 100644 --- a/Library.mm +++ b/Library.mm @@ -103,7 +103,7 @@ extern "C" { @end -bool Debug_ = true; +bool Debug_ = false; bool Engineer_ = false; /* WinterBoard Backend {{{ */ @@ -508,12 +508,10 @@ WBDelegate(string_) - (NSString *) _iconLabelStyle { NSString *key = docked_ ? @"DockedIconLabelStyle" : @"UndockedIconLabelStyle"; NSString *style = [Info_ objectForKey:key]; - NSLog(@"WB:Debug:%@ = %@", key, style); return style; } - (CGSize) drawInRect:(CGRect)rect withFont:(UIFont *)font lineBreakMode:(int)mode alignment:(int)alignment { - _trace(); if (NSString *custom = [self _iconLabelStyle]) { NSString *style = [NSString stringWithFormat:@"" "font-family: Helvetica; " @@ -533,7 +531,6 @@ WBDelegate(string_) } - (void) drawInRect:(CGRect)rect withStyle:(NSString *)style { - _trace(); if (NSString *custom = [self _iconLabelStyle]) { NSString *combined = [NSString stringWithFormat:@"%@; %@", style, custom]; if (Debug_) @@ -722,6 +719,13 @@ extern "C" void WBInitialize() { [Info_ setObject:[info objectForKey:key] forKey:key]; } + if ([Info_ objectForKey:@"UndockedIconLabels"] == nil) + [Info_ setObject:[NSNumber numberWithBool:( + [Info_ objectForKey:@"DockedIconLabelStyle"] != nil || + [Info_ objectForKey:@"UndockedIconLabelStyle"] != nil + )] forKey:@"UndockedIconLabels"]; + + if (![Info_ boolForKey:@"UndockedIconLabels"]) if (Debug_) NSLog(@"WB:Debug:Info = %@", [Info_ description]); diff --git a/control b/control index 43d6b8e..bbef03c 100644 --- a/control +++ b/control @@ -3,7 +3,7 @@ Priority: optional Section: System Maintainer: Jay Freeman (saurik) Architecture: iphoneos-arm -Version: 0.9.2519-1 +Version: 0.9.2520-2 Description: more powerful, open-source SummerBoard This tool lets you give your device a graphical overhaul. Themes are taken from /Library/Themes (or, now, the older SummerBoard folder). Using the relatively simple frontend you can activate and deactivate multiple themes and give them a priority ordering. diff --git a/makefile b/makefile index 405934c..e347805 100644 --- a/makefile +++ b/makefile @@ -29,6 +29,6 @@ package: find winterboard/Library/Themes -name .svn | while read -r line; do rm -rf "$${line}"; done cp -a control preinst prerm winterboard/DEBIAN cp -a Test.sh icon.png WinterBoard.dylib WinterBoard UIImages Info.plist winterboard/Applications/WinterBoard.app - dpkg-deb -b winterboard winterboard_0.9.2519-1_iphoneos-arm.deb + dpkg-deb -b winterboard winterboard_0.9.2520-2_iphoneos-arm.deb .PHONY: all clean package -- 2.45.2