]> git.saurik.com Git - winterboard.git/commitdiff
Page-specific wallpapers.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 4 Jan 2009 02:11:47 +0000 (02:11 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 4 Jan 2009 02:11:47 +0000 (02:11 +0000)
Library.mm
control

index 6ec4a8d4af3b857e7222b7ad9e5c5fd4d55b183e..e46acb62079541682b37dd35805ceb780649182c 100644 (file)
@@ -59,6 +59,7 @@
 #import <SpringBoard/SBContentLayer.h>
 #import <SpringBoard/SBIconController.h>
 #import <SpringBoard/SBIconLabel.h>
+#import <SpringBoard/SBIconModel.h>
 #import <SpringBoard/SBSlidingAlertDisplay.h>
 #import <SpringBoard/SBStatusBarContentsView.h>
 #import <SpringBoard/SBStatusBarController.h>
@@ -854,10 +855,48 @@ MSHook(void, SBStatusBarTimeView$drawRect$, SBStatusBarTimeView *self, SEL sel,
     return _SBStatusBarTimeView$drawRect$(self, sel, rect);
 }
 
-MSHook(void, SBIconController$appendIconList$, SBIconController *self, SEL sel, SBIconList *list) {
-    if (Debug_)
-        NSLog(@"appendIconList:%@", list);
-    return _SBIconController$appendIconList$(self, sel, list);
+@interface UIView (WinterBoard)
+- (bool) wb$isImageView;
+@end
+
+@implementation UIView (WinterBoard)
+
+- (bool) wb$isImageView {
+    return false;
+}
+
+@end
+
+@interface UIImageView (WinterBoard)
+- (bool) wb$isImageView;
+@end
+
+@implementation UIImageView (WinterBoard)
+
+- (bool) wb$isImageView {
+    return true;
+}
+
+@end
+
+MSHook(void, SBIconController$noteNumberOfIconListsChanged, SBIconController *self, SEL sel) {
+    SBIconModel *&_iconModel(MSHookIvar<SBIconModel *>(self, "_iconModel"));
+    NSArray *lists([_iconModel iconLists]);
+
+    for (unsigned i(0), e([lists count]); i != e; ++i)
+        if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Page%u.png", i]])) {
+            SBIconList *list([lists objectAtIndex:i]);
+            NSArray *subviews([list subviews]);
+            UIImageView *view([subviews count] == 0 ? nil : [subviews objectAtIndex:0]);
+            if (view == nil || ![view wb$isImageView]) {
+                view = [[[UIImageView alloc] init] autorelease];
+                [list insertSubview:view atIndex:0];
+            }
+            UIImage *image([UIImage imageWithContentsOfFile:path]);
+            [view setImage:image];
+        }
+
+    return _SBIconController$noteNumberOfIconListsChanged(self, sel);
 }
 
 MSHook(id, SBIconLabel$initWithSize$label$, SBIconLabel *self, SEL sel, CGSize size, NSString *label) {
@@ -1241,7 +1280,7 @@ extern "C" void WBInitialize() {
         WBRename(SBCalendarIconContentsView, drawRect:, drawRect$);
         WBRename(SBContentLayer, initWithSize:, initWithSize$);
         WBRename(SBIconBadge, initWithBadge:, initWithBadge$);
-        WBRename(SBIconController, appendIconList:, appendIconList$);
+        WBRename(SBIconController, noteNumberOfIconListsChanged, noteNumberOfIconListsChanged);
         WBRename(SBWidgetApplicationIcon, icon, icon);
 
         WBRename(SBIconLabel, drawRect:, drawRect$);
diff --git a/control b/control
index 60953e876329b42cb44ccd27f8c704694d8a617d..820dd3c95756ea5f2c9feb6e10880bc2b43143bd 100644 (file)
--- a/control
+++ b/control
@@ -3,7 +3,7 @@ Priority: optional
 Section: System
 Maintainer: Jay Freeman (saurik) <saurik@saurik.com>
 Architecture: iphoneos-arm
-Version: 0.9.2693-1
+Version: 0.9.2694-1
 Description: more powerful, open-source SummerBoard
 Name: WinterBoard
 Depends: mobilesubstrate (>= 0.9.2660-1)