summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-03-10 17:55:20 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2011-03-10 17:55:20 -0800
commit801326028ed54e43655e3812156cf7dac5842a3e (patch)
tree7e82d66a89925b18691d29c9a37b2237ecc003e3
parent6cfdc30696e4c462f898e9dfa4a202f957dca5d7 (diff)
Do not draw null package cells.
-rw-r--r--MobileCydia.mm108
1 files changed, 56 insertions, 52 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index c3ac471..90ad65e 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -5370,79 +5370,83 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
badge_ = nil;
placard_ = nil;
- [package parse];
+ if (package == nil)
+ [content_ setBackgroundColor:[UIColor whiteColor]];
+ else {
+ [package parse];
- Source *source = [package source];
+ Source *source = [package source];
- icon_ = [package icon];
+ icon_ = [package icon];
- if (NSString *name = [package name])
- name_ = [NSString stringWithString:name];
+ if (NSString *name = [package name])
+ name_ = [NSString stringWithString:name];
- NSString *description(nil);
+ NSString *description(nil);
- if (description == nil && IsWildcat_)
- description = [package longDescription];
- if (description == nil)
- description = [package shortDescription];
+ if (description == nil && IsWildcat_)
+ description = [package longDescription];
+ if (description == nil)
+ description = [package shortDescription];
- if (description != nil)
- description_ = [NSString stringWithString:description];
+ if (description != nil)
+ description_ = [NSString stringWithString:description];
- commercial_ = [package isCommercial];
+ commercial_ = [package isCommercial];
- NSString *label = nil;
- bool trusted = false;
+ NSString *label = nil;
+ bool trusted = false;
- if (source != nil) {
- label = [source label];
- trusted = [source trusted];
- } else if ([[package id] isEqualToString:@"firmware"])
- label = UCLocalize("APPLE");
- else
- label = [NSString stringWithFormat:UCLocalize("SLASH_DELIMITED"), UCLocalize("UNKNOWN"), UCLocalize("LOCAL")];
+ if (source != nil) {
+ label = [source label];
+ trusted = [source trusted];
+ } else if ([[package id] isEqualToString:@"firmware"])
+ label = UCLocalize("APPLE");
+ else
+ label = [NSString stringWithFormat:UCLocalize("SLASH_DELIMITED"), UCLocalize("UNKNOWN"), UCLocalize("LOCAL")];
- NSString *from(label);
+ NSString *from(label);
- NSString *section = [package simpleSection];
- if (section != nil && ![section isEqualToString:label]) {
- section = [[NSBundle mainBundle] localizedStringForKey:section value:nil table:@"Sections"];
- from = [NSString stringWithFormat:UCLocalize("PARENTHETICAL"), from, section];
- }
+ NSString *section = [package simpleSection];
+ if (section != nil && ![section isEqualToString:label]) {
+ section = [[NSBundle mainBundle] localizedStringForKey:section value:nil table:@"Sections"];
+ from = [NSString stringWithFormat:UCLocalize("PARENTHETICAL"), from, section];
+ }
- source_ = [NSString stringWithFormat:UCLocalize("FROM"), from];
+ source_ = [NSString stringWithFormat:UCLocalize("FROM"), from];
- if (NSString *purpose = [package primaryPurpose])
- badge_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/Purposes/%@.png", App_, purpose]];
+ if (NSString *purpose = [package primaryPurpose])
+ badge_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/Purposes/%@.png", App_, purpose]];
- UIColor *color;
- NSString *placard;
+ UIColor *color;
+ NSString *placard;
- if (NSString *mode = [package mode]) {
- if ([mode isEqualToString:@"REMOVE"] || [mode isEqualToString:@"PURGE"]) {
- color = RemovingColor_;
- //placard = @"removing";
+ if (NSString *mode = [package mode]) {
+ if ([mode isEqualToString:@"REMOVE"] || [mode isEqualToString:@"PURGE"]) {
+ color = RemovingColor_;
+ //placard = @"removing";
+ } else {
+ color = InstallingColor_;
+ //placard = @"installing";
+ }
+
+ // XXX: the removing/installing placards are not @2x
+ placard = nil;
} else {
- color = InstallingColor_;
- //placard = @"installing";
+ color = [UIColor whiteColor];
+
+ if ([package installed] != nil)
+ placard = @"installed";
+ else
+ placard = nil;
}
- // XXX: the removing/installing placards are not @2x
- placard = nil;
- } else {
- color = [UIColor whiteColor];
+ [content_ setBackgroundColor:color];
- if ([package installed] != nil)
- placard = @"installed";
- else
- placard = nil;
+ if (placard != nil)
+ placard_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/%@.png", App_, placard]];
}
- [content_ setBackgroundColor:color];
-
- if (placard != nil)
- placard_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/%@.png", App_, placard]];
-
[self setNeedsDisplay];
[content_ setNeedsDisplay];
}