]> git.saurik.com Git - winterboard.git/commitdiff
Add a setting to hide the WinterBoard icon.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 28 Mar 2010 07:52:16 +0000 (07:52 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 28 Mar 2010 07:52:16 +0000 (07:52 +0000)
Settings.mm
WinterBoardSettings.bundle/WinterBoard.plist
control

index 38aa3c3a1bb402ffdcb87fe14dcec44b4d06932a..3c8ed65764bbbb2570c00e6c647a8198609a3c1a 100644 (file)
 #import <Preferences/PSTableCell.h>
 #import <UIKit/UINavigationButton.h>
 
+#include <dlfcn.h>
+
+static BOOL (*IsIconHiddenDisplayId)(NSString *);
+static BOOL (*HideIconViaDisplayId)(NSString *);
+static BOOL (*UnHideIconViaDisplayId)(NSString *);
+
+static const NSString *WinterBoardDisplayID = @"com.saurik.WinterBoard";
+
 extern NSString *PSTableCellKey;
 extern "C" UIImage *_UIImageWithName(NSString *);
 
@@ -76,6 +84,7 @@ static NSString *_plist;
 - (UITableViewCellEditingStyle) tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath;
 - (BOOL) tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath;
 - (BOOL) tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath;
+
 @end
 
 @implementation WBSThemesController
@@ -262,10 +271,24 @@ static NSString *_plist;
 
 @implementation WBSettingsController
 
++ (void) load {
+    NSLog(@"LH");
+    void *libhide(dlopen("/usr/lib/hide.dylib", RTLD_LAZY));
+    NSLog(@"LH:%x", libhide);
+    IsIconHiddenDisplayId = reinterpret_cast<BOOL (*)(NSString *)>(dlsym(libhide, "IsIconHiddenDisplayId"));
+    NSLog(@"LH:%x", IsIconHiddenDisplayId);
+    HideIconViaDisplayId = reinterpret_cast<BOOL (*)(NSString *)>(dlsym(libhide, "HideIconViaDisplayId"));
+    NSLog(@"LH:%x", HideIconViaDisplayId);
+    UnHideIconViaDisplayId = reinterpret_cast<BOOL (*)(NSString *)>(dlsym(libhide, "UnHideIconViaDisplayId"));
+    NSLog(@"LH:%x", UnHideIconViaDisplayId);
+}
+
 - (id) initForContentSize:(CGSize)size {
     if ((self = [super initForContentSize:size]) != nil) {
         _plist = [[NSString stringWithFormat:@"%@/Library/Preferences/com.saurik.WinterBoard.plist", NSHomeDirectory()] retain];
         _settings = [([NSMutableDictionary dictionaryWithContentsOfFile:_plist] ?: [NSMutableDictionary dictionary]) retain];
+
+        [_settings setObject:[NSNumber numberWithBool:IsIconHiddenDisplayId(WinterBoardDisplayID)] forKey:@"IconHidden"];
     } return self;
 }
 
@@ -285,10 +308,16 @@ static NSString *_plist;
     if (![data writeToFile:_plist options:NSAtomicWrite error:NULL])
         return;
 
+    ([[_settings objectForKey:@"IconHidden"] boolValue] ? HideIconViaDisplayId : UnHideIconViaDisplayId)(WinterBoardDisplayID);
+
     unlink("/User/Library/Caches/com.apple.springboard-imagecache-icons");
     unlink("/User/Library/Caches/com.apple.springboard-imagecache-icons.plist");
     unlink("/User/Library/Caches/com.apple.springboard-imagecache-smallicons");
     unlink("/User/Library/Caches/com.apple.springboard-imagecache-smallicons.plist");
+
+    system("rm -rf /User/Library/Caches/SpringBoardIconCache");
+    system("rm -rf /User/Library/Caches/SpringBoardIconCache-small");
+
     system("killall SpringBoard");
 }
 
@@ -332,9 +361,10 @@ static NSString *_plist;
 }
 
 - (void) setPreferenceValue:(id)value specifier:(PSSpecifier *)spec {
+    NSString *key([spec propertyForKey:@"key"]);
     if ([[spec propertyForKey:@"negate"] boolValue])
         value = [NSNumber numberWithBool:(![value boolValue])];
-    [_settings setValue:value forKey:[spec propertyForKey:@"key"]];
+    [_settings setValue:value forKey:key];
     [self settingsChanged];
 }
 
index d6b4f964a769590cf7706ff21ba8e3324a8a3e16..e8124bbb8aec1fcf39abf37bbd5372c6d2193c56 100644 (file)
@@ -1,37 +1,22 @@
 {
-    items = (
-       {
-           cell = PSSwitchCell;
-           key = ArbitrarySetting;
-           label = "Arbitrary Switch 1";
-       },
-       {
-           cell = PSSwitchCell;
-           key = ArbitrarySettingTwo;
-           label = "Arbitrary Switch 2";
-           negate = 1;
-       },
-       {
-           cell = PSSwitchCell;
-           default = 1;
-           key = ArbitrarySettingThree;
-           label = "Arbitrary Switch 3";
-       },
-       {
-           cell = PSSwitchCell;
-           default = 0;
-           key = ArbitrarySettingFour;
-           label = "Arbitrary Switch 4";
-       },
-       {
-           cell = PSGroupCell;
-       },
-       {
-           cell = PSLinkCell;
-           detail = WBSThemesController;
-           icon = Themes.png;
-           label = Themes;
-       }
-    );
+    items = ({
+        cell = PSSwitchCell;
+        key = IconHidden;
+        label = "Hide Application";
+    }, {
+        cell = PSGroupCell;
+       isStaticText = true;
+    }, {
+        cell = PSTitleValueCell;
+        label = "WinterBoard can also be found under the normal iPhone OS Settings application.";
+    }, {
+        cell = PSGroupCell;
+    }, {
+        cell = PSLinkCell;
+        detail = WBSThemesController;
+        icon = Themes.png;
+        label = Themes;
+    });
+
     title = WinterBoard;
 }
diff --git a/control b/control
index 9a72f53728cb2b821f76d5625f5ba26112e4c3d1..b10c1fdb35c962753b903645b4360727e423f1fb 100644 (file)
--- a/control
+++ b/control
@@ -3,10 +3,10 @@ Priority: optional
 Section: System
 Maintainer: Jay Freeman (saurik) <saurik@saurik.com>
 Architecture: iphoneos-arm
-Version: 0.9.3017-1
+Version: 0.9.3147-1
 Description: more powerful, open-source SummerBoard
 Name: WinterBoard
-Depends: mobilesubstrate (>= 0.9.2958-1), killall, preferenceloader
+Depends: mobilesubstrate (>= 0.9.2958-1), killall, preferenceloader, libhide
 Provides: theme-manager
 Conflicts: com.modmyifone.winterboardicon, winterboardsettings, themesettings
 Replaces: com.modmyifone.winterboardicon, winterboardsettings, themesettings