diff --git a/DODropletManager/AppDelegate.m b/DODropletManager/AppDelegate.m index a5046bc..fe7085e 100644 --- a/DODropletManager/AppDelegate.m +++ b/DODropletManager/AppDelegate.m @@ -31,6 +31,11 @@ @implementation AppDelegate { BOOL firstRun; DropletManager *dropletManager; + + NSUserDefaults *userdefaults; + NSMutableDictionary *sshUserDictionary; + + } - (void)applicationDidFinishLaunching:(NSNotification *)aNotification @@ -56,6 +61,17 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification name:@"dropletsFailed" object:nil]; + + userdefaults = [NSUserDefaults standardUserDefaults]; + + + // If dictionary exists, load it from userDefaults; + if ([userdefaults objectForKey:@"sshUserDictionary"] == nil) { + sshUserDictionary = [[NSMutableDictionary alloc] init]; + } else { + sshUserDictionary = [[userdefaults objectForKey:@"sshUserDictionary"] mutableCopy]; + } + } - (BOOL)loadKeys { @@ -312,8 +328,20 @@ - (void)viewDropletOnBrowser:(id)sender { } - (void)establishSSHConnectionToDroplet:(id)sender { + + + + Droplet *currentDroplet = ((NSMenuItem*)sender).representedObject; - [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"ssh://root@%@", currentDroplet.ip]]]; + + + if ([sshUserDictionary objectForKey:currentDroplet.name] == nil) { + [sshUserDictionary setObject:@"root" forKey:currentDroplet.name]; + } + + NSString *dropletSSHUsername = [sshUserDictionary objectForKey:currentDroplet.name]; + + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"ssh://%@@%@", dropletSSHUsername, currentDroplet.ip]]]; } - (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo diff --git a/DODropletManager/DODropletManager-Info.plist b/DODropletManager/DODropletManager-Info.plist index 2d15fbd..b500cd3 100644 --- a/DODropletManager/DODropletManager-Info.plist +++ b/DODropletManager/DODropletManager-Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.1 + 0.4.1 CFBundleSignature ???? CFBundleVersion - 1 + 4 LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} LSUIElement diff --git a/DODropletManager/PreferencesWindow.xib b/DODropletManager/PreferencesWindow.xib index eaafa36..89dbf21 100644 --- a/DODropletManager/PreferencesWindow.xib +++ b/DODropletManager/PreferencesWindow.xib @@ -11,6 +11,7 @@ + @@ -31,11 +32,11 @@ - + - + @@ -44,7 +45,7 @@ - + @@ -53,7 +54,7 @@ - + @@ -73,7 +74,7 @@ - + @@ -82,7 +83,7 @@ - + @@ -91,7 +92,7 @@ - + @@ -114,14 +115,14 @@ - + - + @@ -133,21 +134,65 @@ + + + + + + + + + + + + + + + + + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -156,11 +201,11 @@ -