Permalink
Browse files

Add preference pane and ability to require double-tap to activate ren…

…ame mode with icon courtesy of Surenix

(yes, I said this wouldn't happen but the complainers are so damn annoying it was either this or pulling the project altogether)
  • Loading branch information...
1 parent 0446781 commit 001ba418018875940bb7f37e0c54b98b8726f1fe @rpetrich committed Dec 28, 2010
View
@@ -114,13 +114,30 @@ - (void)dealloc
CHSuper(2, SBApplicationIcon, touchesMoved, touches, withEvent, event);
}
+static NSTimeInterval lastTapTime;
+
CHOptimizedMethod(2, super, void, SBApplicationIcon, touchesEnded, NSSet *, touches, withEvent, UIEvent *, event)
{
- if (inTap)
- [[IconRenamer renamerWithIcon:self] show];
+ if (inTap) {
+ if ([[iconMappings objectForKey:@"IRRequiresDoubleTap"] boolValue]) {
+ UITouch *touch = [touches anyObject];
+ NSTimeInterval currentTapTime = touch.timestamp;
+ if (currentTapTime - lastTapTime < 0.5)
+ [[IconRenamer renamerWithIcon:self] show];
+ lastTapTime = currentTapTime;
+ } else {
+ [[IconRenamer renamerWithIcon:self] show];
+ }
+ }
CHSuper(2, SBApplicationIcon, touchesEnded, touches, withEvent, event);
}
+static void LoadSettings()
+{
+ [iconMappings release];
+ iconMappings = [[NSMutableDictionary alloc] initWithContentsOfFile:@kSettingsFilePath] ?: [[NSMutableDictionary alloc] init];
+}
+
CHConstructor {
CHLoadLateClass(SBApplicationIcon);
CHHook(0, SBApplicationIcon, displayName);
@@ -129,5 +146,6 @@ - (void)dealloc
CHHook(2, SBApplicationIcon, touchesEnded, withEvent);
CHLoadLateClass(SBIconController);
CHAutoreleasePoolForScope();
- iconMappings = [[NSMutableDictionary alloc] initWithContentsOfFile:@kSettingsFilePath] ?: [[NSMutableDictionary alloc] init];
+ CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (void *)LoadSettings, CFSTR("ch.rpetri.iconrenamer/settingschanged"), NULL, CFNotificationSuspensionBehaviorCoalesce);
+ LoadSettings();
}
View
@@ -3,7 +3,7 @@ Section: Tweaks
Maintainer: BigBoss <bigboss@thebigboss.org>
Architecture: iphoneos-arm
Version: 1.0
-Depends: firmware (>= 4.0), mobilesubstrate
+Depends: firmware (>= 4.0), mobilesubstrate, preferenceloader (>= 2.0)
Description: Rename icons from your SpringBoard
Name: Icon Renamer
Homepage: http://moreinfo.thebigboss.org/moreinfo/depiction.php?file=iconrenamerData
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>title</key>
+ <string>IconRenamer</string>
+ <key>entry</key>
+ <dict>
+ <key>cell</key>
+ <string>PSLinkCell</string>
+ <key>icon</key>
+ <string>/Library/PreferenceLoader/Preferences/IconRenamer/IconRenamer.png</string>
+ <key>label</key>
+ <string>IconRenamer</string>
+ </dict>
+ <key>items</key>
+ <array>
+ <dict>
+ <key>cell</key>
+ <string>PSGroupCell</string>
+ </dict>
+ <dict>
+ <key>cell</key>
+ <string>PSSwitchCell</string>
+ <key>default</key>
+ <false/>
+ <key>defaults</key>
+ <string>ch.rpetri.iconrenamer</string>
+ <key>key</key>
+ <string>IRRequiresDoubleTap</string>
+ <key>label</key>
+ <string>Require Double Tap</string>
+ <key>PostNotification</key>
+ <string>ch.rpetri.iconrenamer/settingschanged</string>
+ </dict>
+ </array>
+</dict>
+</plist>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 001ba41

Please sign in to comment.