diff options
author | stuconnolly <stuart02@gmail.com> | 2009-04-05 20:22:04 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-04-05 20:22:04 +0000 |
commit | cb406e22d30aaf6dc62ea0917943adb555a8b3e6 (patch) | |
tree | ea0dbea2809a952ba529091b643f9dfc619e4a0b /Source/SPQueryConsole.m | |
parent | 5a1f162168e2228be7976842441080b3fc5d00e0 (diff) | |
download | sequelpro-cb406e22d30aaf6dc62ea0917943adb555a8b3e6.tar.gz sequelpro-cb406e22d30aaf6dc62ea0917943adb555a8b3e6.tar.bz2 sequelpro-cb406e22d30aaf6dc62ea0917943adb555a8b3e6.zip |
Fix an issue where by the show/hide console menu item was not being updated when the toolbar item was used. Also add more interface validation by only enabling the 'Clear Console' menu and toolbar items when there is at least one message in the console.
Diffstat (limited to 'Source/SPQueryConsole.m')
-rw-r--r-- | Source/SPQueryConsole.m | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/SPQueryConsole.m b/Source/SPQueryConsole.m index 7b7edccb..0ba6c982 100644 --- a/Source/SPQueryConsole.m +++ b/Source/SPQueryConsole.m @@ -225,6 +225,14 @@ static SPQueryConsole *sharedQueryConsole = nil; } /** + * Returns the number of messages currently in the console. + */ +- (NSUInteger)consoleMessageCount +{ + return [messages count]; +} + +/** * Called when the NSSavePanel sheet ends. Writes the console's current content to the selected file if required. */ - (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo @@ -310,6 +318,10 @@ static SPQueryConsole *sharedQueryConsole = nil; if ([menuItem action] == @selector(copy:)) { return ([consoleTableView numberOfSelectedRows] > 0); } + + if ([menuItem action] == @selector(clearConsole:)) { + return ([self consoleMessageCount] > 0); + } return [[self window] validateMenuItem:menuItem]; } |