[Adium-commits] adium 1962:03f8cce32c58: Don't establish preferences right away, ...

adium-commits at adiumx.com adium-commits at adiumx.com
Fri Apr 24 20:19:51 UTC 2009


details:	http://hg.adiumx.com/adium/rev/03f8cce32c58
revision:	1962:03f8cce32c58
author:		Zachary West <zacw at adiumx.com>
date:		Fri Apr 24 16:19:45 2009 -0400

Don't establish preferences right away, since it's dependent on internalObjectID, which will end up causing the list bookmarks to set an inappropriate value.

diffstat:

 Frameworks/Adium Framework/Source/AIListObject.m |  27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diffs (52 lines):

diff -r 06e7207bb467 -r 03f8cce32c58 Frameworks/Adium Framework/Source/AIListObject.m
--- a/Frameworks/Adium Framework/Source/AIListObject.m	Fri Apr 24 16:09:03 2009 -0400
+++ b/Frameworks/Adium Framework/Source/AIListObject.m	Fri Apr 24 16:19:45 2009 -0400
@@ -37,6 +37,7 @@
 
 @interface AIListObject ()
 - (void)setContainingGroup:(AIListGroup *)inGroup;
+- (void)setupObservedValues;
 @end
 
 /*!
@@ -60,17 +61,9 @@
 
 		largestOrder = 1.0;
 		smallestOrder = 1.0;
-
-		[adium.preferenceController addObserver:self
-									forKeyPath:@"Always Visible.Visible"
-									  ofObject:self
-									   options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial
-									   context:NULL];
 		
-		[self observeValueForKeyPath:@"Always Visible.Visible"
-							ofObject:nil
-							  change:nil
-							 context:NULL];
+		// Delay until the next run loop so bookmarks can instantiate their values first.
+		[self performSelector:@selector(setupObservedValues) withObject:nil afterDelay:0.0];
 	}
 
 	return self;
@@ -88,6 +81,20 @@
 	[super dealloc];
 }
 
+- (void)setupObservedValues
+{
+	[adium.preferenceController addObserver:self
+	 forKeyPath:@"Always Visible.Visible"
+	 ofObject:self
+	 options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial
+	 context:NULL];
+	
+	[self observeValueForKeyPath:@"Always Visible.Visible"
+						ofObject:nil
+						  change:nil
+						 context:NULL];	
+}
+
 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
 {
 	if ([keyPath hasSuffix:@"Visible"]) {




More information about the commits mailing list