From b27f0a944413d129aee4db862fcafd0aa77d7050 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sat, 14 Jun 2008 09:19:10 +0000 Subject: [PATCH] Ported to latest firmware and fixed locales. --- Cydia.mm | 17 ++++++++++------- makefile | 8 +++++++- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Cydia.mm b/Cydia.mm index 8b38b7ff..4ebced76 100644 --- a/Cydia.mm +++ b/Cydia.mm @@ -420,6 +420,7 @@ unsigned Major_; unsigned Minor_; unsigned BugFix_; +CFLocaleRef Locale_; CGColorSpaceRef space_; #define FW_LEAST(major, minor, bugfix) \ @@ -441,12 +442,10 @@ NSString *GetLastUpdate() { if (update == nil) return @"Never or Unknown"; - CFLocaleRef locale = CFLocaleCopyCurrent(); - CFDateFormatterRef formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterMediumStyle, kCFDateFormatterMediumStyle); + CFDateFormatterRef formatter = CFDateFormatterCreate(NULL, Locale_, kCFDateFormatterMediumStyle, kCFDateFormatterMediumStyle); CFStringRef formatted = CFDateFormatterCreateStringWithDate(NULL, formatter, (CFDateRef) update); CFRelease(formatter); - CFRelease(locale); return [(NSString *) formatted autorelease]; } @@ -2032,7 +2031,9 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString context:@"remove" ]; +#ifndef __OBJC2__ [essential_ setDestructiveButton:[[essential_ buttons] objectAtIndex:0]]; +#endif [essential_ setBodyText:@"This operation involves the removal of one or more packages that are required for the continued operation of either Cydia or iPhoneOS. If you continue, you may not be able to use Cydia to repair any damage."]; } else { essential_ = [[UIAlertSheet alloc] @@ -3652,7 +3653,7 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$"); - (void) _leftButtonClicked { UIAlertSheet *sheet = [[[UIAlertSheet alloc] - initWithTitle:@"About Cydia Packager" + initWithTitle:@"About Cydia Installer" buttons:[NSArray arrayWithObjects:@"Close", nil] defaultButtonIndex:0 delegate:self @@ -4013,8 +4014,7 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$"); upgrades_ = 0; bool unseens = false; - CFLocaleRef locale = CFLocaleCopyCurrent(); - CFDateFormatterRef formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterMediumStyle, kCFDateFormatterMediumStyle); + CFDateFormatterRef formatter = CFDateFormatterCreate(NULL, Locale_, kCFDateFormatterMediumStyle, kCFDateFormatterMediumStyle); for (size_t offset = 0, count = [packages_ count]; offset != count; ++offset) { Package *package = [packages_ objectAtIndex:offset]; @@ -4045,7 +4045,6 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$"); } CFRelease(formatter); - CFRelease(locale); if (unseens) { Section *last = [sections_ lastObject]; @@ -4306,6 +4305,7 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$"); } - (void) flipPage { +#ifndef __OBJC2__ LKAnimation *animation = [LKTransition animation]; [animation setType:@"oglFlip"]; [animation setTimingFunction:[LKTimingFunction functionWithName:@"easeInEaseOut"]]; @@ -4317,6 +4317,7 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$"); [[transition_ _layer] addAnimation:animation forKey:0]; [transition_ transition:0 toView:(flipped_ ? (UIView *) table_ : (UIView *) advanced_)]; flipped_ = !flipped_; +#endif } - (void) configurePushed { @@ -5163,6 +5164,7 @@ int main(int argc, char *argv[]) { if (access("/User", F_OK) != 0) system("/usr/libexec/cydia/firmware.sh"); + Locale_ = CFLocaleCopyCurrent(); space_ = CGColorSpaceCreateDeviceRGB(); Blueish_.Set(space_, 0x19/255.f, 0x32/255.f, 0x50/255.f, 1.0); @@ -5174,6 +5176,7 @@ int main(int argc, char *argv[]) { int value = UIApplicationMain(argc, argv, [Cydia class]); CGColorSpaceRelease(space_); + CFRelease(Locale_); [pool release]; return value; diff --git a/makefile b/makefile index 21674a87..01003c4e 100644 --- a/makefile +++ b/makefile @@ -4,6 +4,12 @@ else target := $(PKG_TARG)- endif +frameworks := + +ifneq ($(wildcard $(PKG_ROOT)/System/Library/*Frameworks/LayerKit.framework),) +frameworks += -framework LayerKit +endif + all: Cydia exec clean: @@ -13,6 +19,6 @@ exec: exec.mm makefile $(target)g++ -Wall -Werror -o $@ $< -framework Foundation -framework CoreFoundation -lobjc Cydia: Cydia.mm ../uicaboodle.m/*.mm *.h makefile - $(target)g++ -I../uicaboodle.m -fobjc-call-cxx-cdtors -g0 -O2 -Wall -Werror -o $@ $(filter %.mm,$^) -framework UIKit -framework IOKit -framework CoreFoundation -framework Foundation -framework CoreGraphics -framework GraphicsServices -framework LayerKit -lobjc -lapt-pkg -lpcre -fobjc-exceptions -I/apl/i20 -F$${PKG_ROOT}/System/Library/PrivateFrameworks + $(target)g++ -I../uicaboodle.m -fobjc-call-cxx-cdtors -g0 -O2 -Wall -Werror -o $@ $(filter %.mm,$^) -framework UIKit -framework IOKit -framework CoreFoundation -framework Foundation -framework CoreGraphics -framework GraphicsServices $(frameworks) -lobjc -lapt-pkg -lpcre -fobjc-exceptions -I/apl/i20 -F"$${PKG_ROOT}"/System/Library/PrivateFrameworks .PHONY: all clean -- 2.45.2