aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authoravenjamin <avenjamin@gmail.com>2009-06-24 13:18:30 +0000
committeravenjamin <avenjamin@gmail.com>2009-06-24 13:18:30 +0000
commit99ec873ef3e78512b70285f4b83334df9463c0a1 (patch)
tree4eda6b40c5c427c71e15b9188be76f1fa68cffca /Source
parentf22d7f580430553e2b8b5e5c2aebccc1384994c5 (diff)
downloadsequelpro-99ec873ef3e78512b70285f4b83334df9463c0a1.tar.gz
sequelpro-99ec873ef3e78512b70285f4b83334df9463c0a1.tar.bz2
sequelpro-99ec873ef3e78512b70285f4b83334df9463c0a1.zip
- Modified titlebar display of SSH status
Diffstat (limited to 'Source')
-rw-r--r--Source/CMMCPConnection.m28
-rw-r--r--Source/TableDocument.h4
-rw-r--r--Source/TableDocument.m21
3 files changed, 41 insertions, 12 deletions
diff --git a/Source/CMMCPConnection.m b/Source/CMMCPConnection.m
index e31b9765..90b915fe 100644
--- a/Source/CMMCPConnection.m
+++ b/Source/CMMCPConnection.m
@@ -306,7 +306,8 @@ static void forcePingTimeout(int signalNumber);
if (connectionTunnel) {
[connectionTunnel disconnect];
- [delegate setStatusIconToImageWithName:@"ssh-disconnected"];
+ [delegate setTitlebarStatus:@"SSH Disconnected"];
+ //[delegate setStatusIconToImageWithName:@"ssh-disconnected"];
}
if( serverVersionString != nil ) {
@@ -405,19 +406,24 @@ static void forcePingTimeout(int signalNumber);
[connectionTunnel setConnectionStateChangeSelector:nil delegate:nil];
if ([connectionTunnel state] != SPSSH_STATE_IDLE) [connectionTunnel disconnect];
[connectionTunnel connect];
- [delegate setStatusIconToImageWithName:@"ssh-connecting"];
+
+ [delegate setTitlebarStatus:@"SSH Connecting…"];
+ //[delegate setStatusIconToImageWithName:@"ssh-connecting"];
+
NSDate *tunnelStartDate = [NSDate date], *interfaceInteractionTimer;
// Allow the tunnel to attempt to connect in a loop
while (1) {
if ([connectionTunnel state] == SPSSH_STATE_CONNECTED) {
- [delegate setStatusIconToImageWithName:@"ssh-connected"];
+ [delegate setTitlebarStatus:@"SSH Connected"];
+ //[delegate setStatusIconToImageWithName:@"ssh-connected"];
connectionPort = [connectionTunnel localPort];
break;
}
if ([[NSDate date] timeIntervalSinceDate:tunnelStartDate] > (connectionTimeout + 1)) {
[connectionTunnel disconnect];
- [delegate setStatusIconToImageWithName:@"ssh-disconnected"];
+ [delegate setTitlebarStatus:@"SSH Disconnected"];
+ //[delegate setStatusIconToImageWithName:@"ssh-disconnected"];
break;
}
@@ -501,9 +507,14 @@ static void forcePingTimeout(int signalNumber);
int newState = [theTunnel state];
if (delegate && [delegate respondsToSelector:@selector(setStatusIconToImageWithName:)]) {
- if (newState == SPSSH_STATE_IDLE) [delegate setStatusIconToImageWithName:@"ssh-disconnected"];
- else if (newState == SPSSH_STATE_CONNECTED) [delegate setStatusIconToImageWithName:@"ssh-connected"];
- else [delegate setStatusIconToImageWithName:@"ssh-connecting"];
+ if (newState == SPSSH_STATE_IDLE) [delegate setTitlebarStatus:@"SSH Disconnected"];
+ else if (newState == SPSSH_STATE_CONNECTED) [delegate setTitlebarStatus:@"SSH Connected"];
+ else [delegate setTitlebarStatus:@"SSH Connecting…"];
+
+
+// if (newState == SPSSH_STATE_IDLE) [delegate setStatusIconToImageWithName:@"ssh-disconnected"];
+// else if (newState == SPSSH_STATE_CONNECTED) [delegate setStatusIconToImageWithName:@"ssh-connected"];
+// else [delegate setStatusIconToImageWithName:@"ssh-connecting"];
}
// Restart the tunnel if it dies
@@ -674,7 +685,8 @@ static void forcePingTimeout(int signalNumber);
[self setLastErrorMessage:nil];
if (connectionTunnel) {
[connectionTunnel disconnect];
- [delegate setStatusIconToImageWithName:@"ssh-disconnected"];
+ [delegate setTitlebarStatus:@"SSH Disconnected"];
+ //[delegate setStatusIconToImageWithName:@"ssh-disconnected"];
}
return NO;
}
diff --git a/Source/TableDocument.h b/Source/TableDocument.h
index 6b6ad5f8..e8702648 100644
--- a/Source/TableDocument.h
+++ b/Source/TableDocument.h
@@ -51,8 +51,11 @@
IBOutlet id spExportControllerInstance;
IBOutlet id tableWindow;
+
IBOutlet id titleAccessoryView;
IBOutlet id titleImageView;
+ IBOutlet id titleStringView;
+
IBOutlet id connectSheet;
IBOutlet id databaseSheet;
IBOutlet id variablesSheet;
@@ -221,6 +224,7 @@
// titlebar methods
- (void)setStatusIconToImageWithName:(NSString *)imagePath;
+- (void)setTitlebarStatus:(NSString *)status;
- (void)clearStatusIcon;
//toolbar methods
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 93b22cae..3cc11425 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -120,7 +120,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
NSView *windowFrame = [[tableWindow contentView] superview];
NSRect av = [titleAccessoryView frame];
NSRect initialAccessoryViewFrame = NSMakeRect(
- [windowFrame frame].size.width - av.size.width - 20,
+ [windowFrame frame].size.width - av.size.width - 30,
[windowFrame frame].size.height - av.size.height,
av.size.width,
av.size.height);
@@ -397,13 +397,16 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
int newState = [theTunnel state];
if (newState == SPSSH_STATE_IDLE) {
- [self setStatusIconToImageWithName:@"ssh-disconnected"];
+ [self setTitlebarStatus:@"SSH Disconnected"];
+ //[self setStatusIconToImageWithName:@"ssh-disconnected"];
[self failConnectionWithErrorMessage:[theTunnel lastError] withDetail:[sshTunnel debugMessages]];
} else if (newState == SPSSH_STATE_CONNECTED) {
- [self setStatusIconToImageWithName:@"ssh-connected"];
+ [self setTitlebarStatus:@"SSH Connected"];
+ //[self setStatusIconToImageWithName:@"ssh-connected"];
[self initiateMySQLConnection];
} else {
- [self setStatusIconToImageWithName:@"ssh-connecting"];
+ [self setTitlebarStatus:@"SSH Connecting…"];
+ //[self setStatusIconToImageWithName:@"ssh-connecting"];
}
}
@@ -2081,6 +2084,12 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
[titleImageView setImage:image];
}
+- (void)setTitlebarStatus:(NSString *)status
+{
+ [self clearStatusIcon];
+ [titleStringView setStringValue:status];
+}
+
/**
* Clear the connection status icon in the titlebar
*/
@@ -2089,6 +2098,10 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
[titleImageView setImage:nil];
}
+
+
+
+
#pragma mark -
#pragma mark Toolbar Methods