From d12c6e703c607e4a57334768e544285499ad6172 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Tue, 22 Jan 2008 11:35:12 +0000 Subject: [PATCH] Implemented badges. --- Cydia.mm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Cydia.mm b/Cydia.mm index aa90bd0f..e63f35e4 100644 --- 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 { -- 2.45.2