diff options
-rw-r--r-- | Interfaces/English.lproj/DBView.xib | 357 | ||||
-rw-r--r-- | Resources/Images/ssh-connected.png | bin | 0 -> 254 bytes | |||
-rw-r--r-- | Resources/Images/ssh-connecting.png | bin | 0 -> 342 bytes | |||
-rw-r--r-- | Resources/Images/ssh-disconnected.png | bin | 0 -> 342 bytes | |||
-rw-r--r-- | Source/CMMCPConnection.h | 1 | ||||
-rw-r--r-- | Source/CMMCPConnection.m | 24 | ||||
-rw-r--r-- | Source/TableDocument.h | 6 | ||||
-rw-r--r-- | Source/TableDocument.m | 38 | ||||
-rw-r--r-- | sequel-pro.xcodeproj/project.pbxproj | 12 |
9 files changed, 193 insertions, 245 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 52a9fe0c..3373c38c 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -2,13 +2,12 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">9J61</string> + <string key="IBDocument.SystemVersion">9G55</string> <string key="IBDocument.InterfaceBuilderVersion">677</string> - <string key="IBDocument.AppKitVersion">949.46</string> + <string key="IBDocument.AppKitVersion">949.43</string> <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="5945"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -372,7 +371,7 @@ <reference key="NSControlView" ref="1029554648"/> <int key="NSButtonFlags">-2042609409</int> <int key="NSButtonFlags2">35</int> - <object class="NSCustomResource" key="NSNormalImage" id="738720219"> + <object class="NSCustomResource" key="NSNormalImage" id="197220008"> <string key="NSClassName">NSImage</string> <string key="NSResourceName">button_action</string> </object> @@ -387,7 +386,7 @@ <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSImage" ref="738720219"/> + <reference key="NSImage" ref="197220008"/> <string key="NSAction">_popUpItemAction:</string> <reference key="NSTarget" ref="753352469"/> </object> @@ -2274,8 +2273,8 @@ <bool key="NS.raise.underflow">YES</bool> <bool key="NS.raise.dividebyzero">YES</bool> </object> - <string key="NS.decimal">,</string> - <string key="NS.thousand">.</string> + <string key="NS.decimal">.</string> + <string key="NS.thousand">,</string> <bool key="NS.hasthousands">NO</bool> <bool key="NS.localized">YES</bool> <bool key="NS.allowsfloats">NO</bool> @@ -2939,7 +2938,7 @@ <reference key="NSControlView" ref="363916571"/> <int key="NSButtonFlags">-2042609409</int> <int key="NSButtonFlags2">35</int> - <reference key="NSNormalImage" ref="738720219"/> + <reference key="NSNormalImage" ref="197220008"/> <string key="NSAlternateContents"/> <string key="NSKeyEquivalent"/> <int key="NSPeriodicDelay">400</int> @@ -2951,7 +2950,7 @@ <string key="NSKeyEquiv"/> <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSImage" ref="738720219"/> + <reference key="NSImage" ref="197220008"/> <string key="NSAction">_popUpItemAction:</string> <reference key="NSTarget" ref="984501775"/> </object> @@ -6167,7 +6166,7 @@ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{560, 200}</string> <object class="NSView" key="NSWindowView" id="999543752"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">4370</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -6292,10 +6291,6 @@ <reference key="NSControlView" ref="620882358"/> <int key="NSButtonFlags">-2031075073</int> <int key="NSButtonFlags2">33554467</int> - <object class="NSCustomResource" key="NSNormalImage"> - <string key="NSClassName">NSImage</string> - <string key="NSResourceName">j</string> - </object> <string key="NSAlternateContents"/> <string key="NSKeyEquivalent"/> <int key="NSPeriodicDelay">400</int> @@ -6418,7 +6413,6 @@ </object> </object> </object> - <int key="NSSelectedIndex">9</int> <bool key="NSPullDown">YES</bool> <int key="NSPreferredEdge">1</int> <bool key="NSUsesItemFromMenu">YES</bool> @@ -6621,29 +6615,6 @@ <object class="NSTextView" id="1011820278"> <reference key="NSNextResponder" ref="134546146"/> <int key="NSvFlags">2322</int> - <object class="NSMutableSet" key="NSDragTypes"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="set.sortedObjects"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>Apple HTML pasteboard type</string> - <string>Apple PDF pasteboard type</string> - <string>Apple PICT pasteboard type</string> - <string>Apple PNG pasteboard type</string> - <string>Apple URL pasteboard type</string> - <string>CorePasteboardFlavorType 0x6D6F6F76</string> - <string>CorePasteboardFlavorType 0x75726C20</string> - <string>NSColor pasteboard type</string> - <string>NSFilenamesPboardType</string> - <string>NSStringPboardType</string> - <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string> - <string>NeXT RTFD pasteboard type</string> - <string>NeXT Rich Text Format v1.0 pasteboard type</string> - <string>NeXT TIFF v4.0 pasteboard type</string> - <string>NeXT font pasteboard type</string> - <string>NeXT ruler pasteboard type</string> - <string>WebURLsWithTitlesPboardType</string> - </object> - </object> <string key="NSFrameSize">{667, 14}</string> <reference key="NSSuperview" ref="134546146"/> <object class="NSTextContainer" key="NSTextContainer" id="609699272"> @@ -6781,7 +6752,6 @@ </object> </object> <string key="NSFrameSize">{667, 416}</string> - <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{560, 222}</string> @@ -12318,6 +12288,46 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSFrameSize">{200, 32}</string> <string key="NSClassName">NSView</string> </object> + <object class="NSCustomView" id="730777562"> + <reference key="NSNextResponder"/> + <int key="NSvFlags">265</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSImageView" id="346676398"> + <reference key="NSNextResponder" ref="730777562"/> + <int key="NSvFlags">265</int> + <object class="NSMutableSet" key="NSDragTypes"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="set.sortedObjects"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>Apple PDF pasteboard type</string> + <string>Apple PICT pasteboard type</string> + <string>Apple PNG pasteboard type</string> + <string>NSFilenamesPboardType</string> + <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string> + <string>NeXT TIFF v4.0 pasteboard type</string> + </object> + </object> + <string key="NSFrame">{{14, 0}, {22, 22}}</string> + <reference key="NSSuperview" ref="730777562"/> + <reference key="NSWindow"/> + <bool key="NSEnabled">YES</bool> + <object class="NSImageCell" key="NSCell" id="1052485434"> + <int key="NSCellFlags">130560</int> + <int key="NSCellFlags2">33554432</int> + <int key="NSAlign">0</int> + <int key="NSScale">0</int> + <int key="NSStyle">0</int> + <bool key="NSAnimates">YES</bool> + </object> + <bool key="NSEditable">YES</bool> + </object> + </object> + <string key="NSFrameSize">{50, 22}</string> + <reference key="NSSuperview"/> + <reference key="NSWindow"/> + <string key="NSClassName">NSView</string> + </object> <object class="NSUserDefaultsController" id="461189245"> <bool key="NSSharedInstance">YES</bool> </object> @@ -16083,6 +16093,22 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <int key="connectionID">5998</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">titleAccessoryView</string> + <reference key="source" ref="427689665"/> + <reference key="destination" ref="730777562"/> + </object> + <int key="connectionID">6002</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">titleImageView</string> + <reference key="source" ref="427689665"/> + <reference key="destination" ref="346676398"/> + </object> + <int key="connectionID">6003</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -22744,6 +22770,30 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <reference key="object" ref="1064737236"/> <reference key="parent" ref="999543752"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">5999</int> + <reference key="object" ref="730777562"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="346676398"/> + </object> + <reference key="parent" ref="1043842561"/> + <string key="objectName">Title Icon View</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">6000</int> + <reference key="object" ref="346676398"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1052485434"/> + </object> + <reference key="parent" ref="730777562"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">6001</int> + <reference key="object" ref="1052485434"/> + <reference key="parent" ref="346676398"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -24102,8 +24152,12 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string>5984.IBPluginDependency</string> <string>5986.IBPluginDependency</string> <string>5989.IBPluginDependency</string> + <string>5999.IBEditorWindowLastContentRect</string> + <string>5999.IBPluginDependency</string> <string>6.IBPluginDependency</string> <string>6.ImportedFromIB2</string> + <string>6000.IBPluginDependency</string> + <string>6001.IBPluginDependency</string> <string>604.IBEditorWindowLastContentRect</string> <string>604.IBWindowTemplateEditedContentRect</string> <string>604.ImportedFromIB2</string> @@ -26011,8 +26065,12 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>{{528, 162}, {50, 22}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{67, 340}, {667, 416}}</string> <string>{{67, 340}, {667, 416}}</string> <reference ref="9"/> @@ -26265,7 +26323,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> </object> </object> <nil key="sourceID"/> - <int key="maxID">5998</int> + <int key="maxID">6003</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -26884,10 +26942,12 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> <string>dropImage:</string> <string>filterTable:</string> <string>openEditSheet:</string> + <string>quickLookFormatButton:</string> <string>reloadTable:</string> <string>reloadTableValues:</string> <string>removeRow:</string> <string>saveEditSheet:</string> + <string>segmentControllerChanged:</string> <string>setCompareTypes:</string> <string>showAll:</string> <string>stepLimitRows:</string> @@ -26909,6 +26969,8 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> <string>id</string> <string>id</string> <string>id</string> + <string>id</string> + <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> @@ -26923,10 +26985,14 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> <string>editData</string> <string>editImage</string> <string>editSheet</string> - <string>editSheetTabView</string> + <string>editSheetProgressBar</string> + <string>editSheetQuickLookButton</string> + <string>editSheetSegmentControl</string> + <string>editTextScrollView</string> <string>editTextView</string> <string>fieldField</string> <string>filterButton</string> + <string>hexTextScrollView</string> <string>hexTextView</string> <string>limitRowsButton</string> <string>limitRowsField</string> @@ -26961,6 +27027,10 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> <string>id</string> <string>id</string> <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> <string>CMCopyTable</string> <string>id</string> <string>id</string> @@ -27116,6 +27186,8 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> <string>tableTabView</string> <string>tableWindow</string> <string>tablesListInstance</string> + <string>titleAccessoryView</string> + <string>titleImageView</string> <string>userField</string> <string>variablesSheet</string> <string>variablesTableView</string> @@ -27170,6 +27242,8 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> <string>id</string> <string>id</string> <string>id</string> + <string>id</string> + <string>id</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> @@ -27548,207 +27622,6 @@ Y2hhbmdlIHRoZSBvcmRlcg</string> </object> </object> </object> - <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="IBPartialClassDescription"> - <string key="className">TableContent</string> - <string key="superclassName">NSObject</string> - <object class="NSMutableDictionary" key="actions"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>addRow:</string> - <string>closeEditSheet:</string> - <string>copyRow:</string> - <string>dropImage:</string> - <string>filterTable:</string> - <string>openEditSheet:</string> - <string>quickLookFormatButton:</string> - <string>reloadTable:</string> - <string>reloadTableValues:</string> - <string>removeRow:</string> - <string>saveEditSheet:</string> - <string>segmentControllerChanged:</string> - <string>setCompareTypes:</string> - <string>showAll:</string> - <string>stepLimitRows:</string> - <string>toggleFilterField:</string> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - </object> - </object> - <object class="NSMutableDictionary" key="outlets"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>addButton</string> - <string>argumentField</string> - <string>compareField</string> - <string>copyButton</string> - <string>countText</string> - <string>editData</string> - <string>editImage</string> - <string>editSheet</string> - <string>editSheetProgressBar</string> - <string>editSheetQuickLookButton</string> - <string>editSheetSegmentControl</string> - <string>editTextScrollView</string> - <string>editTextView</string> - <string>fieldField</string> - <string>filterButton</string> - <string>hexTextScrollView</string> - <string>hexTextView</string> - <string>limitRowsButton</string> - <string>limitRowsField</string> - <string>limitRowsStepper</string> - <string>limitRowsText</string> - <string>multipleLineEditingButton</string> - <string>removeButton</string> - <string>tableContentView</string> - <string>tableDataInstance</string> - <string>tableDocumentInstance</string> - <string>tableWindow</string> - <string>tablesListInstance</string> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>CMCopyTable</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - </object> - </object> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBDocumentRelativeSource</string> - <string key="minorKey">../../Source/TableContent.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">TableSource</string> - <string key="superclassName">NSObject</string> - <object class="NSMutableDictionary" key="actions"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>addField:</string> - <string>addIndex:</string> - <string>chooseIndexType:</string> - <string>closeIndexSheet:</string> - <string>closeKeySheet:</string> - <string>copyField:</string> - <string>openIndexSheet:</string> - <string>reloadTable:</string> - <string>removeField:</string> - <string>removeIndex:</string> - <string>typeChanged:</string> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - </object> - </object> - <object class="NSMutableDictionary" key="outlets"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>addFieldButton</string> - <string>addIndexButton</string> - <string>chooseKeyButton</string> - <string>copyFieldButton</string> - <string>indexNameField</string> - <string>indexSheet</string> - <string>indexTypeField</string> - <string>indexView</string> - <string>indexedColumnsField</string> - <string>keySheet</string> - <string>removeFieldButton</string> - <string>removeIndexButton</string> - <string>structureGrabber</string> - <string>tableDataInstance</string> - <string>tableSourceView</string> - <string>tableTypeButton</string> - <string>tableWindow</string> - <string>tablesListInstance</string> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> - </object> - </object> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBDocumentRelativeSource</string> - <string key="minorKey">../../Source/TableSource.h</string> - </object> - </object> - </object> </object> <int key="IBDocument.localizationMode">0</int> <string key="IBDocument.LastKnownRelativeProjectPath">../../sequel-pro.xcodeproj</string> diff --git a/Resources/Images/ssh-connected.png b/Resources/Images/ssh-connected.png Binary files differnew file mode 100644 index 00000000..2ba841b5 --- /dev/null +++ b/Resources/Images/ssh-connected.png diff --git a/Resources/Images/ssh-connecting.png b/Resources/Images/ssh-connecting.png Binary files differnew file mode 100644 index 00000000..f1e11e59 --- /dev/null +++ b/Resources/Images/ssh-connecting.png diff --git a/Resources/Images/ssh-disconnected.png b/Resources/Images/ssh-disconnected.png Binary files differnew file mode 100644 index 00000000..f8e7c83c --- /dev/null +++ b/Resources/Images/ssh-disconnected.png diff --git a/Source/CMMCPConnection.h b/Source/CMMCPConnection.h index 7c892ead..814738bf 100644 --- a/Source/CMMCPConnection.h +++ b/Source/CMMCPConnection.h @@ -33,6 +33,7 @@ - (void)willQueryString:(NSString *)query; - (void)queryGaveError:(NSString *)error; +- (void)setStatusIconToImageWithName:(NSString *)imagePath; - (BOOL)connectionEncodingViaLatin1; @end diff --git a/Source/CMMCPConnection.m b/Source/CMMCPConnection.m index db45a3d8..6654948b 100644 --- a/Source/CMMCPConnection.m +++ b/Source/CMMCPConnection.m @@ -239,7 +239,10 @@ static void forcePingTimeout(int signalNumber); theRet = mysql_real_connect(mConnection, theHost, theLogin, thePass, NULL, connectionPort, theSocket, mConnectionFlags); thePass = NULL; if (theRet != mConnection) { - if (connectionTunnel) [connectionTunnel disconnect]; + if (connectionTunnel) { + [connectionTunnel disconnect]; + [delegate setStatusIconToImageWithName:@"ssh-disconnected"]; + } return mConnected = NO; } @@ -260,7 +263,10 @@ static void forcePingTimeout(int signalNumber); { [super disconnect]; - if (connectionTunnel) [connectionTunnel disconnect]; + if (connectionTunnel) { + [connectionTunnel disconnect]; + [delegate setStatusIconToImageWithName:@"ssh-disconnected"]; + } if( serverVersionString != nil ) { [serverVersionString release]; @@ -358,16 +364,19 @@ static void forcePingTimeout(int signalNumber); [connectionTunnel setConnectionStateChangeSelector:nil delegate:nil]; if ([connectionTunnel state] != SPSSH_STATE_IDLE) [connectionTunnel disconnect]; [connectionTunnel connect]; + [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"]; connectionPort = [connectionTunnel localPort]; break; } if ([[NSDate date] timeIntervalSinceDate:tunnelStartDate] > (connectionTimeout + 1)) { [connectionTunnel disconnect]; + [delegate setStatusIconToImageWithName:@"ssh-disconnected"]; break; } @@ -449,6 +458,12 @@ 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"]; + } + // Restart the tunnel if it dies if (mConnected && newState == SPSSH_STATE_IDLE && currentSSHTunnelState == SPSSH_STATE_CONNECTED) { currentSSHTunnelState = newState; @@ -614,7 +629,10 @@ static void forcePingTimeout(int signalNumber); [self startKeepAliveTimerResettingState:YES]; return YES; } - if (connectionTunnel) [connectionTunnel disconnect]; + if (connectionTunnel) { + [connectionTunnel disconnect]; + [delegate setStatusIconToImageWithName:@"ssh-disconnected"]; + } return NO; } diff --git a/Source/TableDocument.h b/Source/TableDocument.h index a7ba9d01..946b2492 100644 --- a/Source/TableDocument.h +++ b/Source/TableDocument.h @@ -51,6 +51,8 @@ IBOutlet id spExportControllerInstance; IBOutlet id tableWindow; + IBOutlet id titleAccessoryView; + IBOutlet id titleImageView; IBOutlet id connectSheet; IBOutlet id databaseSheet; IBOutlet id variablesSheet; @@ -215,6 +217,10 @@ - (IBAction)viewRelations:(id)sender; - (IBAction)addConnectionToFavorites:(id)sender; +// titlebar methods +- (void)setStatusIconToImageWithName:(NSString *)imagePath; +- (void)clearStatusIcon; + //toolbar methods - (void)setupToolbar; - (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag; diff --git a/Source/TableDocument.m b/Source/TableDocument.m index c797b530..e9ad5322 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -113,6 +113,17 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum // Hide the tabs in the tab view (we only show them to allow switching tabs in interface builder) [tableTabView setTabViewType:NSNoTabsNoBorder]; [tableListSplitter setDividerStyle:NSSplitViewDividerStyleThin]; + + // Add the icon accessory view to the title bar + NSView *windowFrame = [[tableWindow contentView] superview]; + NSRect av = [titleAccessoryView frame]; + NSRect initialAccessoryViewFrame = NSMakeRect( + [windowFrame frame].size.width - av.size.width - 20, + [windowFrame frame].size.height - av.size.height, + av.size.width, + av.size.height); + [titleAccessoryView setFrame:initialAccessoryViewFrame]; + [windowFrame addSubview:titleAccessoryView]; } - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context @@ -383,9 +394,13 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum int newState = [theTunnel state]; if (newState == SPSSH_STATE_IDLE) { + [self setStatusIconToImageWithName:@"ssh-disconnected"]; [self failConnectionWithErrorMessage:[theTunnel lastError]]; } else if (newState == SPSSH_STATE_CONNECTED) { + [self setStatusIconToImageWithName:@"ssh-connected"]; [self initiateMySQLConnection]; + } else { + [self setStatusIconToImageWithName:@"ssh-connecting"]; } } @@ -1991,6 +2006,29 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum } #pragma mark - +#pragma mark Titlebar Methods + +/** + * Set the connection status icon in the titlebar + */ +- (void)setStatusIconToImageWithName:(NSString *)imageName +{ + NSString *imagePath = [[NSBundle mainBundle] pathForResource:imageName ofType:@"png"]; + if (!imagePath) return; + + NSImage *image = [[NSImage alloc] initByReferencingFile:imagePath]; + [titleImageView setImage:image]; +} + +/** + * Clear the connection status icon in the titlebar + */ +- (void)clearStatusIcon +{ + [titleImageView setImage:nil]; +} + +#pragma mark - #pragma mark Toolbar Methods /** diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index 4a7fdf16..2cbab6a7 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -91,6 +91,9 @@ 586F457B0FDB269E00B428D7 /* RegexKitLite.m in Sources */ = {isa = PBXBuildFile; fileRef = 296DC8AB0F909194002A3258 /* RegexKitLite.m */; }; 586F457E0FDB280100B428D7 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 296DC8BE0F9091DF002A3258 /* libicucore.dylib */; }; 5885940F0F7AEE6000ED0E67 /* sparkle-public-key.pem in Resources */ = {isa = PBXBuildFile; fileRef = 5885940E0F7AEE6000ED0E67 /* sparkle-public-key.pem */; }; + 588B2CC80FE5641E00EC5FC0 /* ssh-connected.png in Resources */ = {isa = PBXBuildFile; fileRef = 588B2CC50FE5641E00EC5FC0 /* ssh-connected.png */; }; + 588B2CC90FE5641E00EC5FC0 /* ssh-connecting.png in Resources */ = {isa = PBXBuildFile; fileRef = 588B2CC60FE5641E00EC5FC0 /* ssh-connecting.png */; }; + 588B2CCA0FE5641E00EC5FC0 /* ssh-disconnected.png in Resources */ = {isa = PBXBuildFile; fileRef = 588B2CC70FE5641E00EC5FC0 /* ssh-disconnected.png */; }; 58C56EF50F438E120035701E /* SPDataCellFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 58C56EF40F438E120035701E /* SPDataCellFormatter.m */; }; 58CB20ED0F79A75D005EA204 /* button_edit_mode_selected.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 58CB20EC0F79A75D005EA204 /* button_edit_mode_selected.tiff */; }; 58CDB3300FCE138D00F8ACA3 /* SPSSHTunnel.m in Sources */ = {isa = PBXBuildFile; fileRef = 58CDB32F0FCE138D00F8ACA3 /* SPSSHTunnel.m */; }; @@ -330,6 +333,9 @@ 586F432A0FD74CFC00B428D7 /* SSHQuestionDialog.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SSHQuestionDialog.xib; sourceTree = "<group>"; }; 588593F30F7AEC9500ED0E67 /* package-application.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "package-application.sh"; sourceTree = "<group>"; }; 5885940E0F7AEE6000ED0E67 /* sparkle-public-key.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "sparkle-public-key.pem"; sourceTree = "<group>"; }; + 588B2CC50FE5641E00EC5FC0 /* ssh-connected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ssh-connected.png"; sourceTree = "<group>"; }; + 588B2CC60FE5641E00EC5FC0 /* ssh-connecting.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ssh-connecting.png"; sourceTree = "<group>"; }; + 588B2CC70FE5641E00EC5FC0 /* ssh-disconnected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ssh-disconnected.png"; sourceTree = "<group>"; }; 58C56EF30F438E120035701E /* SPDataCellFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPDataCellFormatter.h; sourceTree = "<group>"; }; 58C56EF40F438E120035701E /* SPDataCellFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPDataCellFormatter.m; sourceTree = "<group>"; }; 58CB20EC0F79A75D005EA204 /* button_edit_mode_selected.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = button_edit_mode_selected.tiff; sourceTree = "<group>"; }; @@ -722,6 +728,9 @@ 17E641B10EF02036001BC333 /* showconsole.tiff */, 17E641B20EF02036001BC333 /* showvariables.tiff */, 17E641B30EF02036001BC333 /* spyglass.tiff */, + 588B2CC50FE5641E00EC5FC0 /* ssh-connected.png */, + 588B2CC60FE5641E00EC5FC0 /* ssh-connecting.png */, + 588B2CC70FE5641E00EC5FC0 /* ssh-disconnected.png */, B5E2C5F90F2353B5007446E0 /* table-property.png */, 17E641B40EF02036001BC333 /* table-small.tiff */, 584F5F8E0F50ACD800036517 /* table-view-small.tiff */, @@ -1029,6 +1038,9 @@ 29A1B7EB0FD12E55000B88E8 /* printAccessory.xib in Resources */, 586F432B0FD74CFC00B428D7 /* SSHQuestionDialog.xib in Resources */, B54F25E60FD909C400E2CF36 /* toolbar-switch-to-table-relations.png in Resources */, + 588B2CC80FE5641E00EC5FC0 /* ssh-connected.png in Resources */, + 588B2CC90FE5641E00EC5FC0 /* ssh-connecting.png in Resources */, + 588B2CCA0FE5641E00EC5FC0 /* ssh-disconnected.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; |