]> git.saurik.com Git - cydia.git/commitdiff
Implemented badges.
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 22 Jan 2008 11:35:12 +0000 (11:35 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Tue, 22 Jan 2008 11:35:12 +0000 (11:35 +0000)
Cydia.mm

index aa90bd0f53fc9525105eefd5bb4a7f84832495b0..e63f35e4fa4e6d38ee0207bd9826cf6ec5cd1c8d 100644 (file)
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -1698,6 +1698,7 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString
 - (void) deselect;
 - (void) reloadData:(BOOL)reset;
 
+- (NSMutableArray *) packages;
 - (NSString *) title;
 - (void) perform:(Package *)package;
 - (void) addPackage:(Package *)package;
@@ -1866,6 +1867,10 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString
     }
 }
 
+- (NSMutableArray *) packages {
+    return packages_;
+}
+
 - (NSString *) title {
     return nil;
 }
@@ -2066,6 +2071,17 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString
     [upgrade_ reloadData:reset];
     [uninstall_ reloadData:reset];
     [sources_ reloadData];
+
+    if (size_t count = [[upgrade_ packages] count]) {
+        NSString *badge([[NSNumber numberWithInt:count] stringValue]);
+        [buttonbar_ setBadgeValue:badge forButton:3];
+        [buttonbar_ setBadgeAnimated:YES forButton:3];
+        [self setApplicationBadge:badge];
+    } else {
+        [buttonbar_ setBadgeValue:nil forButton:3];
+        [buttonbar_ setBadgeAnimated:NO forButton:3];
+        [self removeApplicationBadge];
+    }
 }
 
 - (void) perform {