Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Sorts the list alphabetically and prevents selected items from floati…

…ng to the bottom.
  • Loading branch information...
commit 7874b27f7061971644ff200425666fcfa941e6fe 1 parent bb3cf3b
@ecammit ecammit authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 Menulet.m
View
11 Menulet.m
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.