Skip to content

Commit

Permalink
Add preference pane and ability to require double-tap to activate ren…
Browse files Browse the repository at this point in the history
…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
rpetrich committed Dec 30, 2010
1 parent 0446781 commit 001ba41
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 4 deletions.
24 changes: 21 additions & 3 deletions IconRenamer.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}
2 changes: 1 addition & 1 deletion layout/DEBIAN/control
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
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.