]> git.saurik.com Git - cydia.git/blobdiff - Cydia.mm
Remove cycc requirement.
[cydia.git] / Cydia.mm
index c28f93d945add031c8b9b7b023acda02ad0c81d9..ec3f9c6bbc3fa8f1cc14086d99747cebffab9ed1 100644 (file)
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -1216,6 +1216,7 @@ bool isSectionVisible(NSString *section) {
 - (void) removeProgressHUD:(UIProgressHUD *)hud;
 - (UCViewController *) pageForPackage:(NSString *)name;
 - (PackageController *) packageController;
+- (void) showActionSheet:(UIActionSheet *)sheet fromItem:(UIBarButtonItem *)item;
 @end
 /* }}} */
 
@@ -5121,7 +5122,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 @end
 /* }}} */
 /* Package Controller {{{ */
-@interface PackageController : CYBrowserController {
+@interface PackageController : CYBrowserController <
+    UIActionSheetDelegate
+> {
     _transient Database *database_;
     Package *package_;
     NSString *name_;
@@ -5193,7 +5196,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 }
 
 #if !AlwaysReload
-- (void) _actionButtonClicked {
+- (void) _customButtonClicked {
     int count([buttons_ count]);
     if (count == 0)
         return;
@@ -5223,10 +5226,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     }
 }
 
-- (void) actionButtonClicked {
+- (void) customButtonClicked {
     // Wait until it's done loading.
     if (![self isLoading])
-        [self _actionButtonClicked];
+        [self _customButtonClicked];
 }
 
 - (void) reloadButtonClicked {
@@ -5309,7 +5312,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         initWithTitle:count == 0 ? nil : count != 1 ? UCLocalize("MODIFY") : [buttons_ objectAtIndex:0]
         style:UIBarButtonItemStylePlain
         target:self
-        action:@selector(actionButtonClicked)
+        action:@selector(customButtonClicked)
     ];
     if (![self isLoading]) [[self navigationItem] setRightBarButtonItem:actionItem];
     else [super applyRightButton];
@@ -8573,21 +8576,12 @@ static _finline void _setHomePage(Cydia *self) {
 
     _trace();
 
-    NSMutableArray *controllers = [NSMutableArray array];
-    [controllers addObject:[[CYNavigationController alloc] initWithDatabase:database_]];
-    [controllers addObject:[[CYNavigationController alloc] initWithDatabase:database_]];
-    [controllers addObject:[[CYNavigationController alloc] initWithDatabase:database_]];
-    if (IsWildcat_) [controllers addObject:[[CYNavigationController alloc] initWithDatabase:database_]];
-    [controllers addObject:[[CYNavigationController alloc] initWithDatabase:database_]];
-    [controllers addObject:[[CYNavigationController alloc] initWithDatabase:database_]];
-
-    NSMutableArray *items = [NSMutableArray arrayWithObjects:
+    NSMutableArray *items([NSMutableArray arrayWithObjects:
         [[[UITabBarItem alloc] initWithTitle:@"Cydia" image:[UIImage applicationImageNamed:@"home.png"] tag:kCydiaTag] autorelease],
         [[[UITabBarItem alloc] initWithTitle:UCLocalize("SECTIONS") image:[UIImage applicationImageNamed:@"install.png"] tag:kSectionsTag] autorelease],
         [[[UITabBarItem alloc] initWithTitle:UCLocalize("CHANGES") image:[UIImage applicationImageNamed:@"changes.png"] tag:kChangesTag] autorelease],
         [[[UITabBarItem alloc] initWithTitle:UCLocalize("SEARCH") image:[UIImage applicationImageNamed:@"search.png"] tag:kSearchTag] autorelease],
-        nil
-    ];
+    nil]);
 
     if (IsWildcat_) {
         [items insertObject:[[[UITabBarItem alloc] initWithTitle:UCLocalize("SOURCES") image:[UIImage applicationImageNamed:@"source.png"] tag:kSourcesTag] autorelease] atIndex:3];
@@ -8596,8 +8590,13 @@ static _finline void _setHomePage(Cydia *self) {
         [items insertObject:[[[UITabBarItem alloc] initWithTitle:UCLocalize("MANAGE") image:[UIImage applicationImageNamed:@"manage.png"] tag:kManageTag] autorelease] atIndex:3];
     }
 
-    for (size_t i(0); i != [items count]; i++)
-        [[controllers objectAtIndex:i] setTabBarItem:[items objectAtIndex:i]];
+    NSMutableArray *controllers([NSMutableArray array]);
+
+    for (UITabBarItem *item in items) {
+        CYNavigationController *controller([[[CYNavigationController alloc] initWithDatabase:database_] autorelease]);
+        [controller setTabBarItem:item];
+        [controllers addObject:controller];
+    }
 
     tabbar_ = [[CYTabBarController alloc] initWithDatabase:database_];
     [tabbar_ setViewControllers:controllers];
@@ -8608,7 +8607,6 @@ static _finline void _setHomePage(Cydia *self) {
     [container_ setUpdateDelegate:self];
     [container_ setTabBarController:tabbar_];
     [window_ addSubview:[container_ view]];
-    [[tabbar_ view] setFrame:CGRectMake(0, -20.0f, [window_ bounds].size.width, [window_ bounds].size.height)];
 
     [UIKeyboard initImplementationNow];
 
@@ -8661,19 +8659,20 @@ static NSNumber *shouldPlayKeyboardSounds;
 
 Class $UIHardware;
 
-MSHook(void, UIHardware$_playSystemSound$, Class self, SEL _cmd, int soundIndex) {
-    switch (soundIndex) {
+MSHook(void, UIHardware$_playSystemSound$, Class self, SEL _cmd, int sound) {
+    switch (sound) {
         case 1104: // Keyboard Button Clicked
         case 1105: // Keyboard Delete Repeated
-            if (!shouldPlayKeyboardSounds) {
-                NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.apple.preferences.sounds.plist"];
-                shouldPlayKeyboardSounds = [[dict objectForKey:@"keyboard"] ?: (id)kCFBooleanTrue retain];
-                [dict release];
+            if (shouldPlayKeyboardSounds == nil) {
+                NSDictionary *dict([[[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.apple.preferences.sounds.plist"] autorelease]);
+                shouldPlayKeyboardSounds = [([dict objectForKey:@"keyboard"] ?: (id) kCFBooleanTrue) retain];
             }
+
             if (![shouldPlayKeyboardSounds boolValue])
                 break;
+
         default:
-            _UIHardware$_playSystemSound$(self, _cmd, soundIndex);
+            _UIHardware$_playSystemSound$(self, _cmd, sound);
     }
 }
 
@@ -8941,7 +8940,7 @@ int main(int argc, char *argv[]) { _pooled
     Warning_ = UCLocalize("WARNING");
 
     _trace();
-    int value = UIApplicationMain(argc, argv, @"Cydia", @"Cydia");
+    int value(UIApplicationMain(argc, argv, @"Cydia", @"Cydia"));
 
     CGColorSpaceRelease(space_);
     CFRelease(Locale_);