From: Dustin L. Howett Date: Tue, 23 Nov 2010 01:27:05 +0000 (-0500) Subject: Add and fix the display of ignored (SelectedState == Hold) packages and abolish the... X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/1f9a3349a723206e70db07f93f72e4be7ed075c0?ds=sidebyside;hp=9297d5d59d19fb6d410ea53e23a70187d3a31631 Add and fix the display of ignored (SelectedState == Hold) packages and abolish the use/storage of IsIgnored in the metadata - rely on apt to track that for us. We currently cannot (do not) set a held state, as apt doesn't expose a means by which to do this, or I have not yet found such a means. --- diff --git a/MobileCydia.mm b/MobileCydia.mm index 950012cf..c4abc53d 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -1735,6 +1735,7 @@ typedef std::map< unsigned long, _H > SourceMap; _transient NSDate *firstSeen_; _transient NSDate *lastSeen_; bool subscribed_; + bool ignored_; } - (Package *) initWithVersion:(pkgCache::VerIterator)version withZone:(NSZone *)zone inPool:(apr_pool_t *)pool database:(Database *)database; @@ -2180,6 +2181,8 @@ struct PackageNameOrdering : obsolete_ = [self hasTag:@"cydia::obsolete"]; essential_ = ((iterator_->Flags & pkgCache::Flag::Essential) == 0 ? NO : YES) || [self hasTag:@"cydia::essential"]; _end + + ignored_ = iterator_->SelectedState == pkgCache::State::Hold; _end } return self; } @@ -2311,11 +2314,7 @@ struct PackageNameOrdering : } - (BOOL) ignored { - NSDictionary *metadata([self metadata]); - if (NSNumber *ignored = [metadata objectForKey:@"IsIgnored"]) - return [ignored boolValue]; - else - return false; + return ignored_; } - (NSString *) latest { @@ -7040,7 +7039,7 @@ freeing the view controllers on tab change */ #endif Section *upgradable = [[[Section alloc] initWithName:UCLocalize("AVAILABLE_UPGRADES") localize:NO] autorelease]; - Section *ignored = [[[Section alloc] initWithName:UCLocalize("IGNORED_UPGRADES") localize:NO] autorelease]; + Section *ignored = nil; Section *section = nil; NSDate *last = nil; @@ -7081,9 +7080,12 @@ freeing the view controllers on tab change */ } [section addToCount]; - } else if ([package ignored]) + } else if ([package ignored]) { + if (ignored == nil) { + ignored = [[[Section alloc] initWithName:UCLocalize("IGNORED_UPGRADES") row:offset localize:NO] autorelease]; + } [ignored addToCount]; - else { + } else { ++upgrades_; [upgradable addToCount]; } @@ -7269,7 +7271,7 @@ freeing the view controllers on tab change */ } - (void) onIgnored:(id)control { - [self onSomething:(int) [control isOn] withKey:@"IsIgnored"]; + // TODO: set Held state - possibly call out to dpkg, etc. } - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {