adium-1.4 3173:bb3a063ecb37: Lazily building the menu won't work...
commits at adium.im
commits at adium.im
Sat Oct 30 08:54:01 UTC 2010
details: http://hg.adium.im/adium-1.4/rev/bb3a063ecb37
revision: 3173:bb3a063ecb37
author: Evan Schoenberg
date: Sat Oct 30 03:53:55 2010 -0500
Lazily building the menu won't work for NSPopUpControls. Make it optional
diffs (91 lines):
diff -r 25b5814b1ae3 -r bb3a063ecb37 Frameworks/Adium Framework/Source/AIContactMenu.h
--- a/Frameworks/Adium Framework/Source/AIContactMenu.h Sat Oct 30 03:19:23 2010 -0500
+++ b/Frameworks/Adium Framework/Source/AIContactMenu.h Sat Oct 30 03:53:55 2010 -0500
@@ -25,6 +25,7 @@
BOOL shouldUseUserIcon;
BOOL shouldSetTooltip;
BOOL shouldIncludeContactListMenuItem;
+ BOOL populateMenuLazily;
}
+ (id)contactMenuWithDelegate:(id<AIContactMenuDelegate>)inDelegate forContactsInObject:(AIListObject *)inContainingObject;
@@ -43,6 +44,7 @@
- (BOOL)contactMenuShouldUseUserIcon:(AIContactMenu *)inContactMenu;
- (BOOL)contactMenuShouldSetTooltip:(AIContactMenu *)inContactMenu;
- (BOOL)contactMenuShouldIncludeContactListMenuItem:(AIContactMenu *)inContactMenu;
+- (BOOL)contactMenuShouldPopulateMenuLazily:(AIContactMenu *)inContactMenu;
// Called on each rebuild:
- (BOOL)contactMenuShouldDisplayGroupHeaders:(AIContactMenu *)inContactMenu; //only applies to contained groups
diff -r 25b5814b1ae3 -r bb3a063ecb37 Frameworks/Adium Framework/Source/AIContactMenu.m
--- a/Frameworks/Adium Framework/Source/AIContactMenu.m Sat Oct 30 03:19:23 2010 -0500
+++ b/Frameworks/Adium Framework/Source/AIContactMenu.m Sat Oct 30 03:53:55 2010 -0500
@@ -134,6 +134,8 @@
shouldIncludeContactListMenuItem = ([delegate respondsToSelector:@selector(contactMenuShouldIncludeContactListMenuItem:)] &&
[delegate contactMenuShouldIncludeContactListMenuItem:self]);
+ populateMenuLazily = ([delegate respondsToSelector:@selector(contactMenuShouldPopulateMenuLazily:)] &&
+ [delegate contactMenuShouldPopulateMenuLazily:self]);
}
- (id<AIContactMenuDelegate> )delegate
@@ -271,14 +273,19 @@
// The group isn't clickable.
[menuItem setEnabled:NO];
+ if (populateMenuLazily) {
+ /* Note that we'll call _updateMenuItem before the item is actually displayed, to set
+ * the title, image, etc. */
+ } else {
+ [self _updateMenuItem:menuItem];
+ }
+
// Add the group and contained objects to the array.
[menuItemArray addObject:menuItem];
[menuItemArray addObjectsFromArray:[self contactMenusForListObjects:containedListObjects]];
-
+
[menuItem release];
-
- /* Note that we'll call _updateMenuItem before the item is actually displayed, to set
- * the title, image, etc. */
+
}
} else {
// Just add the menu item.
@@ -290,8 +297,12 @@
[menuItemArray addObject:menuItem];
[menuItem release];
- /* Note that we'll call _updateMenuItem before the item is actually displayed, to set
- * the title, image, etc. */
+ if (populateMenuLazily) {
+ /* Note that we'll call _updateMenuItem before the item is actually displayed, to set
+ * the title, image, etc. */
+ } else {
+ [self _updateMenuItem:menuItem];
+ }
}
}
@@ -384,6 +395,20 @@
} else {
[self rebuildMenu];
}
+ } else {
+ if (populateMenuLazily) {
+ /* Note that we'll call _updateMenuItem before the item is actually displayed, to set
+ * the title, image, etc. */
+ } else {
+ [self _updateMenuItem:menuItem];
+ }
+ }
+ } else {
+ if (populateMenuLazily) {
+ /* Note that we'll call _updateMenuItem before the item is actually displayed, to set
+ * the title, image, etc. */
+ } else {
+ [self _updateMenuItem:menuItem];
}
}
}
More information about the commits
mailing list