aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPConnectionController.m10
-rw-r--r--Source/SPConstants.h1
-rw-r--r--Source/SPFavoritesPreferencePane.m4
3 files changed, 7 insertions, 8 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];
}
/**
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index 5a11300a..e6855132 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -129,6 +129,7 @@ typedef enum
// Sort by constants
typedef enum
{
+ SPFavoritesSortUnsorted = -1,
SPFavoritesSortNameItem = 0,
SPFavoritesSortHostItem = 1,
SPFavoritesSortTypeItem = 2
diff --git a/Source/SPFavoritesPreferencePane.m b/Source/SPFavoritesPreferencePane.m
index 47c0d690..5cc01682 100644
--- a/Source/SPFavoritesPreferencePane.m
+++ b/Source/SPFavoritesPreferencePane.m
@@ -87,7 +87,7 @@
[favoritesTabView setTabViewType:NSNoTabsNoBorder];
// Sort favorites if a sort type has been selected
- if ((NSInteger)currentSortItem > -1) [self _sortFavorites];
+ if (currentSortItem != SPFavoritesSortUnsorted) [self _sortFavorites];
}
#pragma mark -
@@ -783,6 +783,8 @@
case SPFavoritesSortTypeItem:
sortKey = SPFavoriteTypeKey;
break;
+ default:
+ return;
}
NSSortDescriptor *sortDescriptor = nil;