summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2008-10-16 21:57:50 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2010-09-30 07:08:51 +0000
commit16f2786b1b8cd214a4557cfe287980d35ed24c1f (patch)
tree2e3a131838fda639439dcb5ed3951bacaf8979bf
parentb49f4c9290180d61fa427469807ca6716dcfd54e (diff)
Added icons to sources.
-rw-r--r--Cydia.app/package.html6
-rw-r--r--Cydia.app/package.js3
-rw-r--r--Cydia.mm20
3 files changed, 26 insertions, 3 deletions
diff --git a/Cydia.app/package.html b/Cydia.app/package.html
index 7c58967..0c7762e 100644
--- a/Cydia.app/package.html
+++ b/Cydia.app/package.html
@@ -279,7 +279,11 @@
<label class="source">Source Information</label>
<fieldset class="source">
- <div><label id="source-name"></label></div>
+ <div>
+ <img class="icon" id="source-src"/>
+ <label id="source-name"></label>
+ </div>
+
<div class="source-description" id="source-description"></div>
</fieldset>
diff --git a/Cydia.app/package.js b/Cydia.app/package.js
index 1a8fc92..3117a57 100644
--- a/Cydia.app/package.js
+++ b/Cydia.app/package.js
@@ -178,6 +178,9 @@ $(function () {
$(".source").remove();
$(".trusted").remove();
} else {
+ var host = source.host;
+
+ $("#source-src").src("cydia://source-icon/" + encodeURIComponent(host));
$("#source-name").html(source.name);
if (source.trusted)
diff --git a/Cydia.mm b/Cydia.mm
index 5742a76..b7622df 100644
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -261,10 +261,10 @@ extern NSString * const kCAFilterNearest;
#define lprintf(args...) fprintf(stderr, args)
-#define ForRelease 0
+#define ForRelease 1
#define ForSaurik 1 && !ForRelease
#define RecycleWebViews 0
-#define AlwaysReload 0 && !ForRelease
+#define AlwaysReload 1 && !ForRelease
/* Radix Sort {{{ */
@interface NSMutableArray (Radix)
@@ -5640,6 +5640,22 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
[client URLProtocol:self didLoadData:data];
[client URLProtocolDidFinishLoading:self];
+ } else if ([command isEqualToString:@"source-icon"]) {
+ if (path == nil)
+ goto fail;
+ path = [path stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+ NSString *source(Simplify(path));
+
+ UIImage *icon([UIImage imageAtPath:[NSString stringWithFormat:@"%@/Sources/%@.png", App_, source]]);
+ if (icon == nil)
+ icon = [UIImage applicationImageNamed:@"unknown.png"];
+
+ NSData *data(UIImagePNGRepresentation(icon));
+
+ NSURLResponse *response([[[NSURLResponse alloc] initWithURL:[request URL] MIMEType:@"image/png" expectedContentLength:-1 textEncodingName:nil] autorelease]);
+ [client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
+ [client URLProtocol:self didLoadData:data];
+ [client URLProtocolDidFinishLoading:self];
} else if ([command isEqualToString:@"section-icon"]) {
if (path == nil)
goto fail;