]> git.saurik.com Git - cydia.git/commitdiff
Added icons to sources.
authorJay Freeman (saurik) <saurik@saurk.com>
Thu, 16 Oct 2008 21:57:50 +0000 (21:57 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 30 Sep 2010 07:08:51 +0000 (07:08 +0000)
Cydia.app/package.html
Cydia.app/package.js
Cydia.mm

index 7c58967856aa1e96fc2f88b68c733d9d5ccbace0..0c7762e4bd0d60a87ca9f7d5b9755597fa007116 100644 (file)
 
 <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>
 
index 1a8fc92bf8bb76272932081176e22677937c3475..3117a576416762d65bd152a31046fa2bb5129760 100644 (file)
@@ -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)
index 5742a76daa84b66d1cd2c7acc281196e0eb093fa..b7622dfe7657ea5387a36799d2b2e1143a028d95 100644 (file)
--- 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)
@@ -5636,6 +5636,22 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
         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:@"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];