aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPConnectionController.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2011-03-22 00:11:30 +0000
committerrowanbeentje <rowan@beent.je>2011-03-22 00:11:30 +0000
commit0912522da735e423d5d99390ca30e358f18993b8 (patch)
tree4ec9e391f5d3fd54d35a7dedafcc64b2ea82ea54 /Source/SPConnectionController.m
parent07c0c28a885dd2f24596ffcbdca6c7c65f913833 (diff)
downloadsequelpro-0912522da735e423d5d99390ca30e358f18993b8.tar.gz
sequelpro-0912522da735e423d5d99390ca30e358f18993b8.tar.bz2
sequelpro-0912522da735e423d5d99390ca30e358f18993b8.zip
- Fix exception on startup if no favourites present - I think the previous first-item preservation dates back to when the title had to be included in the favorites array, so removed
- Fix favorites sorting and preservation of unsorted status
Diffstat (limited to 'Source/SPConnectionController.m')
-rw-r--r--Source/SPConnectionController.m10
1 files changed, 3 insertions, 7 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index 5e3d0a2d..a6cbadd7 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -147,7 +147,7 @@
[favoritesTable setDraggingSourceOperationMask:NSDragOperationMove forLocal:YES];
// Sort the favourites to match prefs and select the appropriate row - if a valid sort option is selected
- if ((NSInteger)currentSortItem > -1) [self _sortFavorites];
+ if (currentSortItem != SPFavoritesSortUnsorted) [self _sortFavorites];
NSUInteger tableRow = [prefs integerForKey:[prefs boolForKey:SPSelectLastFavoriteUsed] ? SPLastFavoriteIndex : SPDefaultFavorite];
@@ -1151,6 +1151,8 @@
case SPFavoritesSortTypeItem:
sortKey = SPFavoriteTypeKey;
break;
+ default:
+ return;
}
NSSortDescriptor *sortDescriptor = nil;
@@ -1162,11 +1164,7 @@
sortDescriptor = [[[NSSortDescriptor alloc] initWithKey:sortKey ascending:(!reverseFavoritesSort) selector:@selector(caseInsensitiveCompare:)] autorelease];
}
- NSDictionary *first = [[favorites objectAtIndex:0] retain];
-
- [favorites removeObjectAtIndex:0];
[favorites sortUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];
- [favorites insertObject:first atIndex:0];
// Rebuild the favorites tree
[self _buildFavoritesTree];
@@ -1174,8 +1172,6 @@
[favoritesTable reloadData];
[favoritesTable expandItem:[[favoritesRoot nodeChildren] objectAtIndex:0]];
-
- [first release];
}
/**