Permalink
Browse files

Sorts the list alphabetically and prevents selected items from floati…

…ng to the bottom.
  • Loading branch information...
1 parent bb3cf3b commit 7874b27f7061971644ff200425666fcfa941e6fe @ecammit ecammit committed Apr 14, 2011
Showing with 10 additions and 1 deletion.
  1. +10 −1 Menulet.m
View
@@ -47,6 +47,14 @@ -(void)awakeFromNib
NSLog(@"AuthorizationCreate returned %@\n", err);
}
+NSInteger substringSort(id string1, id string2, void *context)
+{
+ NSString* v1 = [string1 substringFromIndex:2];
+ NSString* v2 = [string2 substringFromIndex:2];
+ return [v1 localizedCompare:v2];
+}
+
+
-(NSArray *)status
{
NSTask *task;
@@ -69,9 +77,10 @@ -(NSArray *)status
NSRange theRange;
theRange.location = 0;
theRange.length = [lines count] - 1;
- return [[lines subarrayWithRange:theRange] sortedArrayUsingSelector:@selector(localizedCompare:)];
+ return [[lines subarrayWithRange:theRange] sortedArrayUsingFunction:substringSort context:NULL];
}
+
-(IBAction)refresh:(id)sender
{
// remove items up to sepaerator

0 comments on commit 7874b27

Please sign in to comment.