diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2008-02-03 12:47:52 +0000 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2008-02-03 12:47:52 +0000 |
commit | 23672b395e60e5a76f7ba01ba0b7ac7cf7957525 (patch) | |
tree | bd3c7e27071a87afdc72cd4193edc2c412051414 /Cydia.mm | |
parent | f62038bb546ec54e73e629187eebe209d3b0fb2f (diff) |
Renaming folder structure, added settings icon, and fixed crash bug for everyone but me.
Diffstat (limited to 'Cydia.mm')
-rw-r--r-- | Cydia.mm | 50 |
1 files changed, 28 insertions, 22 deletions
@@ -178,6 +178,23 @@ static NSMutableDictionary *Metadata_; static NSMutableDictionary *Packages_; static NSDate *now_; +NSString *GetLastUpdate() { + NSDate *update = [Metadata_ objectForKey:@"LastUpdate"]; + + if (update == nil) + return @"Never or Unknown"; + + CFLocaleRef locale = CFLocaleCopyCurrent(); + CFDateFormatterRef formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterMediumStyle, kCFDateFormatterMediumStyle); + CFStringRef formatted = CFDateFormatterCreateStringWithDate(NULL, formatter, (CFDateRef) update); + + CFRelease(formatter); + CFRelease(formatted); + CFRelease(locale); + + return [(NSString *) formatted autorelease]; +} + @protocol ProgressDelegate - (void) setError:(NSString *)error; - (void) setTitle:(NSString *)title; @@ -590,17 +607,7 @@ inline float interpolate(float begin, float end, float fraction) { } - (void) setPrompt { - NSDate *update = [Metadata_ objectForKey:@"LastUpdate"]; - - CFLocaleRef locale = CFLocaleCopyCurrent(); - CFDateFormatterRef formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterMediumStyle, kCFDateFormatterMediumStyle); - CFStringRef formatted = CFDateFormatterCreateStringWithDate(NULL, formatter, (CFDateRef) update); - - [navbar_ setPrompt:[NSString stringWithFormat:@"Last Updated: %@", (NSString *) formatted]]; - - CFRelease(formatter); - CFRelease(formatted); - CFRelease(locale); + [navbar_ setPrompt:[NSString stringWithFormat:@"Last Updated: %@", GetLastUpdate()]]; } @end @@ -898,6 +905,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) { NSString *tagline_; NSString *icon_; NSString *bundle_; + NSString *website_; } - (void) dealloc; @@ -922,6 +930,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) { - (NSString *) tagline; - (NSString *) icon; - (NSString *) bundle; +- (NSString *) website; - (BOOL) matches:(NSString *)text; @@ -978,6 +987,9 @@ NSString *Scour(const char *field, const char *begin, const char *end) { bundle_ = Scour("Bundle", begin, end); if (bundle_ != nil) bundle_ = [bundle_ retain]; + website_ = Scour("Website", begin, end); + if (website_ != nil) + website_ = [website_ retain]; NSMutableDictionary *metadata = [Packages_ objectForKey:id_]; if (metadata == nil) { @@ -1074,6 +1086,10 @@ NSString *Scour(const char *field, const char *begin, const char *end) { return bundle_; } +- (NSString *) website { + return website_; +} + - (BOOL) matches:(NSString *)text { if (text == nil) return NO; @@ -3142,17 +3158,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) { } - (void) setPrompt { - NSDate *update = [Metadata_ objectForKey:@"LastUpdate"]; - - CFLocaleRef locale = CFLocaleCopyCurrent(); - CFDateFormatterRef formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterMediumStyle, kCFDateFormatterMediumStyle); - CFStringRef formatted = CFDateFormatterCreateStringWithDate(NULL, formatter, (CFDateRef) update); - - [navbar_ setPrompt:[NSString stringWithFormat:@"Last Updated: %@", (NSString *) formatted]]; - - CFRelease(formatter); - CFRelease(formatted); - CFRelease(locale); + [navbar_ setPrompt:[NSString stringWithFormat:@"Last Updated: %@", GetLastUpdate()]]; } - (void) resolve { |