]> git.saurik.com Git - cydia.git/blobdiff - Cydia.mm
Remove cycc requirement.
[cydia.git] / Cydia.mm
index 3afab9db3e9e6b93e73337ffb98f8e2edfccda39..ec3f9c6bbc3fa8f1cc14086d99747cebffab9ed1 100644 (file)
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -8576,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];
@@ -8599,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];
@@ -8611,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];
 
@@ -8664,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);
     }
 }
 
@@ -8944,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_);