diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2008-10-16 21:57:50 +0000 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2010-09-30 07:08:51 +0000 |
commit | 16f2786b1b8cd214a4557cfe287980d35ed24c1f (patch) | |
tree | 2e3a131838fda639439dcb5ed3951bacaf8979bf /Cydia.mm | |
parent | b49f4c9290180d61fa427469807ca6716dcfd54e (diff) |
Added icons to sources.
Diffstat (limited to 'Cydia.mm')
-rw-r--r-- | Cydia.mm | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -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; |