]> git.saurik.com Git - cydia.git/commitdiff
Don't bother updating data if we aren't actually, like, changing anything.
authorGrant Paul <chpwn@chpwn.com>
Sun, 3 Oct 2010 08:49:57 +0000 (01:49 -0700)
committerJay Freeman <saurik@Jay-Freemans-MacBook-Pro.local>
Mon, 4 Oct 2010 07:12:22 +0000 (00:12 -0700)
Cydia.mm

index a260c891daac4f2e73e829b1cbd72407d56925ae..af9b8dac3429c49e9fb5244aa4a4c55cb6fff86a 100644 (file)
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -7547,23 +7547,29 @@ freeing the view controllers on tab change */
 }
 
 - (void) save {
+    NSString *role = nil;
+    
     switch ([segment_ selectedSegmentIndex]) {
-        case 0: Role_ = @"User"; break;
-        case 1: Role_ = @"Hacker"; break;
-        case 2: Role_ = @"Developer"; break;
+        case 0: role = @"User"; break;
+        case 1: role = @"Hacker"; break;
+        case 2: role = @"Developer"; break;
 
         _nodefault
     }
 
-    Settings_ = [NSMutableDictionary dictionaryWithObjectsAndKeys:
-        Role_, @"Role",
-    nil];
+    if (![role isEqualToString:Role_]) {
+        Role_ = role;
+        
+        Settings_ = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+            Role_, @"Role",
+        nil];
 
-    [Metadata_ setObject:Settings_ forKey:@"Settings"];
+        [Metadata_ setObject:Settings_ forKey:@"Settings"];
 
-    Changed_ = true;
+        Changed_ = true;
     
-    [roledelegate_ updateData];
+        [roledelegate_ updateData];
+    }
 }
 
 - (void) segmentChanged:(UISegmentedControl *)control {