diff --git a/Classes/App.h b/Classes/App.h
index cf8396c..491ea09 100644
--- a/Classes/App.h
+++ b/Classes/App.h
@@ -2,12 +2,17 @@
@interface App : NSObject {
NSString *path;
+ NSString *version;
IBOutlet NSWindow *prefPanel;
IBOutlet NSTextField *textField;
+ IBOutlet NSPopUpButton *versionSelector;
}
-(IBAction)showPrefPanel:(id)sender;
-(IBAction)applyChange:(id)sender;
+-(void)populatePopUp;
+-(NSString *)applicationBundleName;
+
@end
diff --git a/Classes/App.m b/Classes/App.m
index 6110c1c..f0b009e 100644
--- a/Classes/App.m
+++ b/Classes/App.m
@@ -9,9 +9,12 @@ @implementation App
-(void)awakeFromNib {
NSUserDefaults *d = [NSUserDefaults standardUserDefaults];
path = [d objectForKey:@"path"];
+ version = [d objectForKey:@"version"];
NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager];
[appleEventManager setEventHandler:self andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL];
+
+ [self populatePopUp];
}
-(void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent {
@@ -39,7 +42,7 @@ -(void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSApple
[task launch];
[task release];
NSWorkspace *sharedWorkspace = [NSWorkspace sharedWorkspace];
- NSString *appPath = [sharedWorkspace fullPathForApplication:@"Sublime Text 2"];
+ NSString *appPath = [sharedWorkspace fullPathForApplication:[self applicationBundleName]];
NSString *identifier = [[NSBundle bundleWithPath:appPath] bundleIdentifier];
NSArray *selectedApps =
[NSRunningApplication runningApplicationsWithBundleIdentifier:identifier];
@@ -54,23 +57,52 @@ -(void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSApple
// }
}
+-(void)populatePopUp {
+ [versionSelector removeAllItems];
+ [versionSelector addItemsWithTitles:[NSArray arrayWithObjects:@"Sublime Text 2", @"Sublime Text 3", nil]];
+}
+
+-(NSString *)applicationBundleName {
+ NSString* appName;
+
+ if (version == nil) {
+ appName = @"Sublime Text 2";
+ } else if ([version isEqual: @"Sublime Text 3"]) {
+ appName = @"Sublime Text";
+ } else {
+ appName = version;
+ }
+
+ return appName;
+}
+
-(IBAction)showPrefPanel:(id)sender {
if (path) {
[textField setStringValue:path];
} else {
[textField setStringValue:defaultPath];
}
+
+ if (version) {
+ [versionSelector selectItemWithTitle:version];
+ }
+
[prefPanel makeKeyAndOrderFront:nil];
}
-(IBAction)applyChange:(id)sender {
+ NSUserDefaults *d = [NSUserDefaults standardUserDefaults];
path = [textField stringValue];
+ version = [[versionSelector selectedItem] title];
if (path) {
- NSUserDefaults *d = [NSUserDefaults standardUserDefaults];
[d setObject:path forKey:@"path"];
}
+ if (version) {
+ [d setObject:version forKey:@"version"];
+ }
+
[prefPanel orderOut:nil];
}
diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib
index 898f4e4..3247d69 100644
--- a/English.lproj/MainMenu.xib
+++ b/English.lproj/MainMenu.xib
@@ -1,774 +1,157 @@
-
-
-
- 1050
- 11B26
- 1617
- 1138
- 566.00
-
-
-
-
-
- YES
-
- NSApplication
-
-
- FirstResponder
-
-
- NSApplication
-
-
-
- 15
- 2
- {{335, 520}, {571, 90}}
- 1946157056
- Preferences
- NSWindow
-
-
-
-
- 256
-
- YES
-
-
- 268
- {{17, 53}, {91, 17}}
-
-
- YES
-
- 68288064
- 272630784
- Path to subl:
-
- LucidaGrande
- 13
- 1044
-
-
-
- 6
- System
- controlColor
-
- 3
- MC42NjY2NjY2NjY3AA
-
-
-
- 6
- System
- controlTextColor
-
- 3
- MAA
-
-
-
-
-
-
- 268
- {{105, 48}, {446, 22}}
-
-
- YES
-
- -1804468671
- 272630784
-
-
-
- YES
-
- 6
- System
- textBackgroundColor
-
- 3
- MQA
-
-
-
- 6
- System
- textColor
-
-
-
-
-
-
- 268
- {{461, 12}, {96, 32}}
-
-
- YES
-
- -2080244224
- 134217728
- Apply
-
-
- -2038284033
- 129
-
-
- 200
- 25
-
-
-
- {571, 90}
-
-
-
- {{0, 0}, {1920, 1178}}
- {10000000000000, 10000000000000}
- YES
-
-
- NSFontManager
-
-
- App
-
-
-
-
- YES
-
-
- orderFrontStandardAboutPanel:
-
-
-
- 142
-
-
-
- showHelp:
-
-
-
- 360
-
-
-
- hide:
-
-
-
- 367
-
-
-
- hideOtherApplications:
-
-
-
- 368
-
-
-
- unhideAllApplications:
-
-
-
- 370
-
-
-
- terminate:
-
-
-
- 449
-
-
-
- delegate
-
-
-
- 452
-
-
-
- showPrefPanel:
-
-
-
- 478
-
-
-
- prefPanel
-
-
-
- 479
-
-
-
- textField
-
-
-
- 480
-
-
-
- applyChange:
-
-
-
- 481
-
-
-
-
- YES
-
- 0
-
-
-
-
-
- -2
-
-
- File's Owner
-
-
- -1
-
-
- First Responder
-
-
- -3
-
-
- Application
-
-
- 29
-
-
- YES
-
-
-
-
- MainMenu
-
-
- 56
-
-
- YES
-
-
-
-
-
- 103
-
-
- YES
-
-
-
- 1
-
-
- 106
-
-
- YES
-
-
-
- 2
-
-
- 111
-
-
-
-
- 57
-
-
- YES
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 58
-
-
-
-
- 134
-
-
-
-
- 150
-
-
-
-
- 136
-
-
- 1111
-
-
- 144
-
-
-
-
- 129
-
-
- 121
-
-
- 143
-
-
-
-
- 236
-
-
-
-
- 131
-
-
- YES
-
-
-
-
-
- 149
-
-
-
-
- 145
-
-
-
-
- 130
-
-
-
-
- 371
-
-
- YES
-
-
-
-
-
- 372
-
-
- YES
-
-
-
-
-
-
-
- 420
-
-
-
-
- 451
-
-
-
-
- 457
-
-
- YES
-
-
-
-
-
- 458
-
-
-
-
- 459
-
-
- YES
-
-
-
-
-
- 460
-
-
-
-
- 461
-
-
- YES
-
-
-
-
-
- 462
-
-
-
-
-
-
- YES
-
- YES
- -1.IBPluginDependency
- -2.IBPluginDependency
- -3.IBPluginDependency
- 103.IBPluginDependency
- 106.IBPluginDependency
- 111.IBPluginDependency
- 129.IBPluginDependency
- 130.IBPluginDependency
- 131.IBPluginDependency
- 134.IBPluginDependency
- 136.IBPluginDependency
- 143.IBPluginDependency
- 144.IBPluginDependency
- 145.IBPluginDependency
- 149.IBPluginDependency
- 150.IBPluginDependency
- 236.IBPluginDependency
- 29.IBPluginDependency
- 371.IBPluginDependency
- 371.IBWindowTemplateEditedContentRect
- 371.NSWindowTemplate.visibleAtLaunch
- 372.IBPluginDependency
- 420.IBPluginDependency
- 451.IBPluginDependency
- 457.IBPluginDependency
- 458.IBPluginDependency
- 459.IBPluginDependency
- 460.IBPluginDependency
- 461.IBPluginDependency
- 462.IBPluginDependency
- 56.IBPluginDependency
- 57.IBPluginDependency
- 58.IBPluginDependency
-
-
- YES
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- {{107, 467}, {480, 230}}
-
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
-
-
-
- YES
-
-
-
-
-
- YES
-
-
-
-
- 481
-
-
- 0
- IBCocoaFramework
-
- com.apple.InterfaceBuilder.CocoaPlugin.macosx
-
-
-
- com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3
-
-
- YES
- 3
-
- YES
-
- YES
- NSMenuCheckmark
- NSMenuMixedState
-
-
- YES
- {9, 8}
- {7, 2}
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file