aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPConnectionController.m12
-rw-r--r--Source/SPConnectionControllerInitializer.m11
2 files changed, 19 insertions, 4 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index c9e07b31..9400f451 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -64,6 +64,7 @@ static NSString *SPExportFavoritesFilename = @"SequelProFavorites.plist";
- (void)_reloadFavoritesViewData;
- (void)_restoreConnectionInterface;
- (void)_selectNode:(SPTreeNode *)node;
+- (void)_scrollToSelectedNode;
- (void)_removeNode:(SPTreeNode *)node;
- (NSNumber *)_createNewFavoriteID;
@@ -1230,7 +1231,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2,
{
[favoritesOutlineView reloadData];
[favoritesOutlineView expandItem:[[favoritesRoot childNodes] objectAtIndex:0] expandChildren:NO];
- [favoritesOutlineView scrollRowToVisible:[favoritesOutlineView selectedRow]];
+ [self _scrollToSelectedNode];
}
/**
@@ -1278,6 +1279,14 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2,
- (void)_selectNode:(SPTreeNode *)node
{
[favoritesOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:[favoritesOutlineView rowForItem:node]] byExtendingSelection:NO];
+ [self _scrollToSelectedNode];
+}
+
+/**
+ * Scroll to the currently selected node.
+ */
+- (void)_scrollToSelectedNode
+{
[favoritesOutlineView scrollRowToVisible:[favoritesOutlineView selectedRow]];
}
@@ -1469,6 +1478,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2,
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSObject cancelPreviousPerformRequestsWithTarget:self];
// Unregister observers
[self removeObserver:self forKeyPath:SPFavoriteNameKey];
diff --git a/Source/SPConnectionControllerInitializer.m b/Source/SPConnectionControllerInitializer.m
index 7bafe157..ee805594 100644
--- a/Source/SPConnectionControllerInitializer.m
+++ b/Source/SPConnectionControllerInitializer.m
@@ -104,8 +104,13 @@ static NSString *SPConnectionViewNibName = @"ConnectionView";
// Update the UI
[self _reloadFavoritesViewData];
[self setUpFavoritesOutlineView];
- [self setUpSelectedConnectionFavorite];
[self _restoreOutlineViewStateNode:favoritesRoot];
+
+ // Set up the selected favourite, and scroll after a small delay to fix animation delay on Lion
+ [self setUpSelectedConnectionFavorite];
+ if ([favoritesOutlineView selectedRow] != -1) {
+ [self performSelector:@selector(_scrollToSelectedNode) withObject:nil afterDelay:0.0];
+ }
// Set sort items
currentSortItem = [prefs integerForKey:SPFavoritesSortedBy];
@@ -262,8 +267,8 @@ static NSString *SPConnectionViewNibName = @"ConnectionView";
[self _selectNode:favorite];
[self resizeTabViewToConnectionType:[[[[favorite representedObject] nodeFavorite] objectForKey:SPFavoriteTypeKey] integerValue] animating:NO];
-
- [favoritesOutlineView scrollRowToVisible:[favoritesOutlineView selectedRow]];
+
+ [self _scrollToSelectedNode];
}
else {
previousType = SPTCPIPConnection;