adium 5451:4b5cb79723c9: Mix disabled and enabled Xtras. Refs #1...

commits at adium.im commits at adium.im
Sun Apr 28 19:20:34 UTC 2013


details:	http://hg.adium.im/adium/rev/4b5cb79723c9
revision:	5451:4b5cb79723c9
branch:		adium-1.6
author:		Frank Dowsett <wixardy at adium.im>
date:		Sun Apr 28 14:55:38 2013 -0400

Mix disabled and enabled Xtras. Refs #15490
Subject: adium 5452:1bfcbf06c354: Save the last used Xtra category.

details:	http://hg.adium.im/adium/rev/1bfcbf06c354
revision:	5452:1bfcbf06c354
branch:		adium-1.6
author:		Frank Dowsett <wixardy at adium.im>
date:		Sun Apr 28 15:19:21 2013 -0400

Save the last used Xtra category.

diffs (59 lines):

diff -r 90248ee3467f -r 1bfcbf06c354 Source/AIXtrasManager.m
--- a/Source/AIXtrasManager.m	Tue Sep 11 12:24:11 2012 +0200
+++ b/Source/AIXtrasManager.m	Sun Apr 28 15:19:21 2013 -0400
@@ -27,6 +27,7 @@
 #import <Adium/AICorePluginLoader.h>
 
 #define ADIUM_XTRAS_PAGE		AILocalizedString(@"http://xtras.adium.im/","Adium xtras page. Localized only if a translated version exists.")
+#define XTRAS_LAST_CATEGORY_KEY @"Xtras Last Category"
 
 @interface AIXtrasManager ()
 - (void)updateForSelectedCategory;
@@ -81,7 +82,11 @@
 
 	[self showXtras];
 
-	[tableView_categories selectRowIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
+	NSUInteger lastCategory = [[adium.preferenceController preferenceForKey:XTRAS_LAST_CATEGORY_KEY group:PREF_GROUP_GENERAL] integerValue];
+	if (lastCategory < categories.count)
+		[tableView_categories selectRowIndexes:[NSIndexSet indexSetWithIndex:lastCategory] byExtendingSelection:NO];
+	else
+		[tableView_categories selectRowIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
 	
 	[self updateForSelectedCategory];
 }
@@ -111,6 +116,10 @@
 {
 	return [[categoryA objectForKey:@"Name"] localizedCaseInsensitiveCompare:[categoryB objectForKey:@"Name"]];
 }
+NSInteger xtraSort(id xtra1, id xtra2, void * context)
+{
+	return [[(AIXtraInfo *)xtra1 name] localizedCaseInsensitiveCompare:[(AIXtraInfo *)xtra2 name]];
+}
 
 - (void)loadXtras
 {
@@ -192,9 +201,11 @@
 				[xtraInfo setEnabled:NO];
 				[contents addObject:xtraInfo];
 			}
-		}		
+		}
 	}
-
+	
+	[contents sortUsingFunction:xtraSort context:NULL];
+	
 	return contents;
 }
 
@@ -245,6 +256,9 @@
 		[xtraList selectRowIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
 	}
 	
+	//Save the last viewed category
+	[adium.preferenceController setPreference:[NSString stringWithFormat:@"%ld", [tableView_categories selectedRow]] forKey:XTRAS_LAST_CATEGORY_KEY group:PREF_GROUP_GENERAL];
+	
 	[self updatePreview];
 }
 




More information about the commits mailing list