adium 2739:cf07b4bc17d9: Programmatically force alternating rows...

commits at adium.im commits at adium.im
Mon Oct 19 18:39:18 UTC 2009


details:	http://hg.adium.im/adium/rev/cf07b4bc17d9
revision:	2739:cf07b4bc17d9
author:		Zachary West <zacw at adium.im>
date:		Sat Oct 17 16:37:39 2009 -0400

Programmatically force alternating rows. I didn't feel like updating the nibs for this.

AIAlternatingRowOutlineView needs to die off, and just preserve the gradient selection, since (for a while now!) alternating rows has been an OS feature.

In either case, fixes #12941.
Subject: adium 2740:79c0c819a092: Run `make localizable-strings`. b10 missed a few strings, here. /sigh.

details:	http://hg.adium.im/adium/rev/79c0c819a092
revision:	2740:79c0c819a092
author:		Zachary West <zacw at adium.im>
date:		Sat Oct 17 17:01:56 2009 -0400

Run `make localizable-strings`. b10 missed a few strings, here. /sigh.

Refs #12240.
Subject: adium 2741:545ce4868ddd: When loading a service icon from service ID and the pack doesn't specify one, ask the first service with that ID for it.

details:	http://hg.adium.im/adium/rev/545ce4868ddd
revision:	2741:545ce4868ddd
author:		Zachary West <zacw at adium.im>
date:		Sat Oct 17 17:20:24 2009 -0400

When loading a service icon from service ID and the pack doesn't specify one, ask the first service with that ID for it.

This also will return 'nil' instead of a dead path for service icons which are not supported by an icon pack, but which a service specifies as a default. Refs #12697. (We don't know the paths of default service icons, yet)
Subject: adium 2742:2b36c67b4a96: This gets released; retain it.

details:	http://hg.adium.im/adium/rev/2b36c67b4a96
revision:	2742:2b36c67b4a96
author:		Zachary West <zacw at adium.im>
date:		Sat Oct 17 17:22:17 2009 -0400

This gets released; retain it.
Subject: adium 2743:df2c24e3844c: Add -[AIService pathForDefaultServiceIconOfType:], and use it for replacing %serviceIconImg% in headers. Fixes #12697.

details:	http://hg.adium.im/adium/rev/df2c24e3844c
revision:	2743:df2c24e3844c
author:		Zachary West <zacw at adium.im>
date:		Sat Oct 17 17:35:57 2009 -0400

Add -[AIService pathForDefaultServiceIconOfType:], and use it for replacing %serviceIconImg% in headers. Fixes #12697.
Subject: adium 2744:666f93364bb5: Replace %serviceIconPath% in all messages, and in the header. Fixes #12665 (though not quite the same).

details:	http://hg.adium.im/adium/rev/666f93364bb5
revision:	2744:666f93364bb5
author:		Zachary West <zacw at adium.im>
date:		Sat Oct 17 17:42:31 2009 -0400

Replace %serviceIconPath% in all messages, and in the header. Fixes #12665 (though not quite the same).

You probably don't want all content messages replacing with an <img /> with a set id, so let's limit it just to base template replacements (header, in other words).

diffs (348 lines):

diff -r 58dcead8d4c0 -r 666f93364bb5 Frameworks/Adium Framework/Resources/en.lproj/Localizable.strings
Binary file Frameworks/Adium Framework/Resources/en.lproj/Localizable.strings has changed
diff -r 58dcead8d4c0 -r 666f93364bb5 Frameworks/Adium Framework/Source/AIService.h
--- a/Frameworks/Adium Framework/Source/AIService.h	Mon Oct 19 14:02:54 2009 -0400
+++ b/Frameworks/Adium Framework/Source/AIService.h	Sat Oct 17 17:42:31 2009 -0400
@@ -53,6 +53,7 @@
 @property (readonly, nonatomic) NSString *UIDPlaceholder;
 @property (readonly, nonatomic) AIServiceImportance serviceImportance;
 - (NSImage *)defaultServiceIconOfType:(AIServiceIconType)iconType;
+- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType;
 
 //Service Properties
 @property (readonly, nonatomic) NSCharacterSet *allowedCharacters;
diff -r 58dcead8d4c0 -r 666f93364bb5 Frameworks/Adium Framework/Source/AIService.m
--- a/Frameworks/Adium Framework/Source/AIService.m	Mon Oct 19 14:02:54 2009 -0400
+++ b/Frameworks/Adium Framework/Source/AIService.m	Sat Oct 17 17:42:31 2009 -0400
@@ -238,6 +238,19 @@
 	return nil;
 }
 
+/*!
+ * @brief Path for default icon
+ *
+ * For use in message views, this is the path to a default icon as described above.
+ *
+ * @param iconType The AIServiceIconType of the icon to return.
+ * @return The path to the image, otherwise nil.
+ */
+- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
+{
+	return nil;
+}
+
 //Service Properties ---------------------------------------------------------------------------------------------------
 #pragma mark Service Properties
 /*!
diff -r 58dcead8d4c0 -r 666f93364bb5 Frameworks/Adium Framework/Source/AIServiceIcons.m
--- a/Frameworks/Adium Framework/Source/AIServiceIcons.m	Mon Oct 19 14:02:54 2009 -0400
+++ b/Frameworks/Adium Framework/Source/AIServiceIcons.m	Sat Oct 17 17:42:31 2009 -0400
@@ -17,6 +17,7 @@
 #import <Adium/AIListObject.h>
 #import <Adium/AIService.h>
 #import <Adium/AIServiceIcons.h>
+#import <Adium/AIAccountControllerProtocol.h>
 
 static NSMutableDictionary	*serviceIcons[NUMBER_OF_SERVICE_ICON_TYPES][NUMBER_OF_ICON_DIRECTIONS];
 
@@ -68,7 +69,18 @@
 
 + (NSString *)pathForServiceIconForServiceID:(NSString *)serviceID type:(AIServiceIconType)iconType
 {
-	return [serviceIconBasePath stringByAppendingPathComponent:[serviceIconNames[iconType] objectForKey:serviceID]];
+	NSString *iconName = [serviceIconNames[iconType] objectForKey:serviceID];
+	
+	if (iconName) {
+		return [serviceIconBasePath stringByAppendingPathComponent:iconName];
+	} else {
+		AIService *service = [adium.accountController firstServiceWithServiceID:serviceID];
+		if (service) {
+			return [service pathForDefaultServiceIconOfType:iconType];
+		} else {
+			return nil;
+		}
+	}
 }
 
 //Retrieve the correct service icon for a service by ID
@@ -85,19 +97,24 @@
 
 		if (path) {
 			serviceIcon = [[NSImage alloc] initWithContentsOfFile:path];
+		} else {
+			AIService *service = [adium.accountController firstServiceWithServiceID:serviceID];
+			if (service) {
+				serviceIcon = [[service defaultServiceIconOfType:iconType] retain];
+			}
+		}
 
+		if (serviceIcon) {
+			if (iconDirection == AIIconFlipped) [serviceIcon setFlipped:YES];
+			[serviceIcons[iconType][iconDirection] setObject:serviceIcon forKey:serviceID];
+			[serviceIcon release];
+		} else {
+			//Attempt to load the default service icon
+			serviceIcon = [self defaultServiceIconForType:iconType serviceID:serviceID];
 			if (serviceIcon) {
+				//Cache the default service icon (until the pack is changed) so we have it immediately next time
 				if (iconDirection == AIIconFlipped) [serviceIcon setFlipped:YES];
 				[serviceIcons[iconType][iconDirection] setObject:serviceIcon forKey:serviceID];
-				[serviceIcon release];
-			} else {
-				//Attempt to load the default service icon
-				serviceIcon = [self defaultServiceIconForType:iconType serviceID:serviceID];
-				if (serviceIcon) {
-					//Cache the default service icon (until the pack is changed) so we have it immediately next time
-					if (iconDirection == AIIconFlipped) [serviceIcon setFlipped:YES];
-					[serviceIcons[iconType][iconDirection] setObject:serviceIcon forKey:serviceID];
-				}
 			}
 		}
 	}
diff -r 58dcead8d4c0 -r 666f93364bb5 Plugins/Purple Service/AIMobileMeService.m
--- a/Plugins/Purple Service/AIMobileMeService.m	Mon Oct 19 14:02:54 2009 -0400
+++ b/Plugins/Purple Service/AIMobileMeService.m	Sat Oct 17 17:42:31 2009 -0400
@@ -75,4 +75,21 @@
 					  forClass:[self class] loadLazily:YES];
 }
 
+/*!
+ * @brief Path for default icon
+ *
+ * For use in message views, this is the path to a default icon as described above.
+ *
+ * @param iconType The AIServiceIconType of the icon to return.
+ * @return The path to the image, otherwise nil.
+ */
+- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
+{
+	if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
+		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"MobileMe-small"];
+	} else {
+		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"MobileMe-large"];		
+	}
+}
+
 @end
diff -r 58dcead8d4c0 -r 666f93364bb5 Plugins/Purple Service/ESIRCService.m
--- a/Plugins/Purple Service/ESIRCService.m	Mon Oct 19 14:02:54 2009 -0400
+++ b/Plugins/Purple Service/ESIRCService.m	Sat Oct 17 17:42:31 2009 -0400
@@ -111,4 +111,21 @@
 	return baseImage;
 }
 
+/*!
+ * @brief Path for default icon
+ *
+ * For use in message views, this is the path to a default icon as described above.
+ *
+ * @param iconType The AIServiceIconType of the icon to return.
+ * @return The path to the image, otherwise nil.
+ */
+- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
+{
+	if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
+		return nil; //xxx add small IRC icon
+	} else {
+		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"irc"];		
+	}
+}
+
 @end
diff -r 58dcead8d4c0 -r 666f93364bb5 Plugins/Purple Service/ESSimpleService.m
--- a/Plugins/Purple Service/ESSimpleService.m	Mon Oct 19 14:02:54 2009 -0400
+++ b/Plugins/Purple Service/ESSimpleService.m	Sat Oct 17 17:42:31 2009 -0400
@@ -83,4 +83,17 @@
 	return [NSImage imageNamed:@"simple" forClass:[self class] loadLazily:YES];
 }
 
+/*!
+ * @brief Path for default icon
+ *
+ * For use in message views, this is the path to a default icon as described above.
+ *
+ * @param iconType The AIServiceIconType of the icon to return.
+ * @return The path to the image, otherwise nil.
+ */
+- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
+{
+	return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"simple"];		
+}
+
 @end
diff -r 58dcead8d4c0 -r 666f93364bb5 Plugins/Purple Service/PurpleFacebookService.m
--- a/Plugins/Purple Service/PurpleFacebookService.m	Mon Oct 19 14:02:54 2009 -0400
+++ b/Plugins/Purple Service/PurpleFacebookService.m	Sat Oct 17 17:42:31 2009 -0400
@@ -93,4 +93,21 @@
 	}
 }
 
+/*!
+ * @brief Path for default icon
+ *
+ * For use in message views, this is the path to a default icon as described above.
+ *
+ * @param iconType The AIServiceIconType of the icon to return.
+ * @return The path to the image, otherwise nil.
+ */
+- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
+{
+	if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
+		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"facebook-small"];
+	} else {
+		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"facebook"];		
+	}
+}
+
 @end
diff -r 58dcead8d4c0 -r 666f93364bb5 Plugins/Purple Service/PurpleMySpaceService.m
--- a/Plugins/Purple Service/PurpleMySpaceService.m	Mon Oct 19 14:02:54 2009 -0400
+++ b/Plugins/Purple Service/PurpleMySpaceService.m	Sat Oct 17 17:42:31 2009 -0400
@@ -98,4 +98,21 @@
 					  forClass:[self class] loadLazily:YES];
 }
 
+/*!
+ * @brief Path for default icon
+ *
+ * For use in message views, this is the path to a default icon as described above.
+ *
+ * @param iconType The AIServiceIconType of the icon to return.
+ * @return The path to the image, otherwise nil.
+ */
+- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
+{
+	if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
+		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"MySpace-small"];
+	} else {
+		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"MySpace-large"];		
+	}
+}
+
 @end
diff -r 58dcead8d4c0 -r 666f93364bb5 Plugins/Purple Service/en.lproj/Localizable.strings
Binary file Plugins/Purple Service/en.lproj/Localizable.strings has changed
diff -r 58dcead8d4c0 -r 666f93364bb5 Plugins/Twitter Plugin/AILaconicaService.m
--- a/Plugins/Twitter Plugin/AILaconicaService.m	Mon Oct 19 14:02:54 2009 -0400
+++ b/Plugins/Twitter Plugin/AILaconicaService.m	Sat Oct 17 17:42:31 2009 -0400
@@ -102,5 +102,21 @@
 	}
 }
 
+/*!
+ * @brief Path for default icon
+ *
+ * For use in message views, this is the path to a default icon as described above.
+ *
+ * @param iconType The AIServiceIconType of the icon to return.
+ * @return The path to the image, otherwise nil.
+ */
+- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
+{
+	if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
+		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"laconica-small"];
+	} else {
+		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"laconica"];		
+	}
+}
 
 @end
diff -r 58dcead8d4c0 -r 666f93364bb5 Plugins/Twitter Plugin/AITwitterService.m
--- a/Plugins/Twitter Plugin/AITwitterService.m	Mon Oct 19 14:02:54 2009 -0400
+++ b/Plugins/Twitter Plugin/AITwitterService.m	Sat Oct 17 17:42:31 2009 -0400
@@ -107,5 +107,21 @@
 	}
 }
 
+/*!
+ * @brief Path for default icon
+ *
+ * For use in message views, this is the path to a default icon as described above.
+ *
+ * @param iconType The AIServiceIconType of the icon to return.
+ * @return The path to the image, otherwise nil.
+ */
+- (NSString *)pathForDefaultServiceIconOfType:(AIServiceIconType)iconType
+{
+	if ((iconType == AIServiceIconSmall) || (iconType == AIServiceIconList)) {
+		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"twitter-small"];
+	} else {
+		return [[NSBundle bundleForClass:[self class]] pathForImageResource:@"twitter"];		
+	}
+}
 
 @end
diff -r 58dcead8d4c0 -r 666f93364bb5 Plugins/Twitter Plugin/en.lproj/Localizable.strings
Binary file Plugins/Twitter Plugin/en.lproj/Localizable.strings has changed
diff -r 58dcead8d4c0 -r 666f93364bb5 Plugins/WebKit Message View/AIWebkitMessageViewStyle.m
--- a/Plugins/WebKit Message View/AIWebkitMessageViewStyle.m	Mon Oct 19 14:02:54 2009 -0400
+++ b/Plugins/WebKit Message View/AIWebkitMessageViewStyle.m	Sat Oct 17 17:42:31 2009 -0400
@@ -856,6 +856,10 @@
 	[inString replaceKeyword:@"%service%" 
 				  withString:[content.chat.account.service shortDescription]];
 	
+	[inString replaceKeyword:@"%serviceIconPath%"
+				  withString:[AIServiceIcons pathForServiceIconForServiceID:content.chat.account.service.serviceID
+																	   type:AIServiceIconLarge]];
+	
 	//message stuff
 	if ([content isKindOfClass:[AIContentMessage class]]) {
 		
@@ -1181,6 +1185,9 @@
 	[inString replaceKeyword:@"%serviceIconImg%"
 				  withString:serviceIconTag];
 	
+	[inString replaceKeyword:@"%serviceIconPath%"
+				  withString:serviceIconPath];
+	
 	[inString replaceKeyword:@"%timeOpened%"
 				  withString:[timeStampFormatter stringFromDate:[chat dateOpened]]];
 	
diff -r 58dcead8d4c0 -r 666f93364bb5 Plugins/WebKit Message View/en.lproj/Localizable.strings
Binary file Plugins/WebKit Message View/en.lproj/Localizable.strings has changed
diff -r 58dcead8d4c0 -r 666f93364bb5 Resources/en.lproj/Localizable.strings
Binary file Resources/en.lproj/Localizable.strings has changed
diff -r 58dcead8d4c0 -r 666f93364bb5 Source/ESStatusPreferences.h
--- a/Source/ESStatusPreferences.h	Mon Oct 19 14:02:54 2009 -0400
+++ b/Source/ESStatusPreferences.h	Sat Oct 17 17:42:31 2009 -0400
@@ -8,7 +8,7 @@
 
 #import "AIPreferencePane.h"
 
- at class AIAutoScrollView, AIStatus;
+ at class AIAutoScrollView, AIStatus, AIAlternatingRowOutlineView;
 
 @interface ESStatusPreferences : AIPreferencePane {
 	//Status state tableview
@@ -16,8 +16,8 @@
 	IBOutlet	NSButton			*button_deleteState;
 	IBOutlet	NSButton			*button_addGroup;
 
-	IBOutlet	NSOutlineView		*outlineView_stateList;
-	IBOutlet	AIAutoScrollView	*scrollView_stateList;
+	IBOutlet	AIAlternatingRowOutlineView		*outlineView_stateList;
+	IBOutlet	AIAutoScrollView				*scrollView_stateList;
 	
 	NSArray				*draggingItems;
 	
diff -r 58dcead8d4c0 -r 666f93364bb5 Source/ESStatusPreferences.m
--- a/Source/ESStatusPreferences.m	Mon Oct 19 14:02:54 2009 -0400
+++ b/Source/ESStatusPreferences.m	Sat Oct 17 17:42:31 2009 -0400
@@ -19,6 +19,7 @@
 #import <AIUtilities/AIAutoScrollView.h>
 #import <AIUtilities/AIVerticallyCenteredTextCell.h>
 #import <AIUtilities/AIOutlineViewAdditions.h>
+#import <AIUtilities/AIAlternatingRowOutlineView.h>
 #import <AIUtilities/AIImageDrawingAdditions.h>
 
 #define STATE_DRAG_TYPE	@"AIState"
@@ -62,6 +63,9 @@
 	//Configure the controls
 	[self configureStateList];
 
+	[outlineView_stateList setDrawsBackground:NO];
+	[outlineView_stateList setUsesAlternatingRowBackgroundColors:YES];
+	
 	//Manually size and position our buttons
 	{
 		NSRect	newFrame, oldFrame;




More information about the commits mailing list