summaryrefslogtreecommitdiff
path: root/Cydia.mm
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2008-03-08 21:57:55 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2008-03-08 21:57:55 +0000
commitc7c6384e1b4b08d546b9f1d7728c218eee42ac0f (patch)
tree0d7f37e41222642d1d5f11367471f2d1d3160922 /Cydia.mm
parentec97ef06d3da4f9426d971319fc1b8c6eaf5631a (diff)
Label width, move.sh, and Default-Icon.
Diffstat (limited to 'Cydia.mm')
-rw-r--r--Cydia.mm28
1 files changed, 22 insertions, 6 deletions
diff --git a/Cydia.mm b/Cydia.mm
index 0fc182c..53e94b1 100644
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -937,6 +937,8 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString
NSString *type_;
NSString *version_;
+ NSString *defaultIcon_;
+
BOOL trusted_;
}
@@ -954,6 +956,8 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString
- (NSString *) label;
- (NSString *) origin;
- (NSString *) version;
+
+- (NSString *) defaultIcon;
@end
@implementation Source
@@ -1001,7 +1005,9 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString
while (!value.empty() && value[0] == ' ')
value = value.substr(1);
- if (name == "Description")
+ if (name == "Default-Icon")
+ defaultIcon_ = [[NSString stringWithCString:value.c_str()] retain];
+ else if (name == "Description")
description_ = [[NSString stringWithCString:value.c_str()] retain];
else if (name == "Label")
label_ = [[NSString stringWithCString:value.c_str()] retain];
@@ -1046,6 +1052,10 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString
return version_;
}
+- (NSString *) defaultIcon {
+ return defaultIcon_;
+}
+
@end
/* }}} */
/* Package Class {{{ */
@@ -1707,7 +1717,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
[description_ setBackgroundColor:clear];
[description_ setFont:small];
- source_ = [[UITextLabel alloc] initWithFrame:CGRectMake(12, 72, 150, 20)];
+ source_ = [[UITextLabel alloc] initWithFrame:CGRectMake(12, 72, 225, 20)];
[source_ setBackgroundColor:clear];
[source_ setFont:large];
@@ -1734,9 +1744,13 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
}
- (void) setPackage:(Package *)package {
+ Source *source = [package source];
+
UIImage *image = nil;
if (NSString *icon = [package icon])
image = [UIImage imageAtPath:[icon substringFromIndex:6]];
+ if (image == nil) if (NSString *icon = [source defaultIcon])
+ image = [UIImage imageAtPath:[icon substringFromIndex:6]];
if (image == nil)
image = [UIImage applicationImageNamed:@"unknown.png"];
@@ -1748,16 +1762,18 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
[version_ setText:[package latest]];
[description_ setText:[package tagline]];
- Source *source = [package source];
NSString *label;
bool trusted;
- if (source == nil) {
+ if (source != nil) {
+ label = [source label];
+ trusted = [source trusted];
+ } else if ([[package id] isEqualToString:@"firmware"]) {
label = @"Apple";
trusted = false;
} else {
- label = [source label];
- trusted = [source trusted];
+ label = @"Unknown/Local";
+ trusted = false;
}
[source_ setText:[NSString stringWithFormat:@"from %@", label]];