]> git.saurik.com Git - cydia.git/commitdiff
Fixed keyboard click sound thingees.
authorJay Freeman (saurik) <saurik@saurk.com>
Thu, 24 Apr 2008 23:58:39 +0000 (23:58 +0000)
committerJay Freeman (saurik) <saurik@saurk.com>
Thu, 24 Apr 2008 23:58:39 +0000 (23:58 +0000)
Cydia.mm

index 789d5035db44c0be5f80237dc3cabb21c4e3cc81..524ec1fc40542b124e0bddc9fcdd363ffab82f1a 100644 (file)
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -424,6 +424,9 @@ static CGColor Clear_;
 static CGColor Red_;
 static CGColor White_;
 
+static NSString *Home_;
+static BOOL Sounds_Keyboard_;
+
 const char *Firmware_ = NULL;
 const char *Machine_ = NULL;
 const char *SerialNumber_ = NULL;
@@ -4243,6 +4246,7 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString
     CGSize keysize = [UIKeyboard defaultSize];
     CGRect keyrect = {{0, [overlay_ bounds].size.height - keysize.height}, keysize};
     keyboard_ = [[UIKeyboard alloc] initWithFrame:keyrect];
+    [[UIKeyboardImpl sharedInstance] setSoundsEnabled:(Sounds_Keyboard_ ? YES : NO)];
 
     [self reloadData];
     [book_ update];
@@ -4324,8 +4328,19 @@ id Dealloc_(id self, SEL selector) {
 }*/
 
 int main(int argc, char *argv[]) {
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
     bootstrap_ = argc > 1 && strcmp(argv[1], "--bootstrap") == 0;
 
+    Home_ = NSHomeDirectory();
+
+    {
+        NSString *plist = [Home_ stringByAppendingString:@"/Library/Preferences/com.apple.preferences.sounds.plist"];
+        if (NSDictionary *sounds = [NSDictionary dictionaryWithContentsOfFile:plist])
+            if (NSNumber *keyboard = [sounds objectForKey:@"keyboard"])
+                Sounds_Keyboard_ = [keyboard boolValue];
+    }
+
     setuid(0);
     setgid(0);
 
@@ -4337,8 +4352,6 @@ int main(int argc, char *argv[]) {
     dealloc_ = dealloc->method_imp;
     dealloc->method_imp = (IMP) &Dealloc_;*/
 
-    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
     if (NSDictionary *sysver = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"]) {
         if (NSString *prover = [sysver valueForKey:@"ProductVersion"]) {
             Firmware_ = strdup([prover UTF8String]);