diff options
author | stuconnolly <stuart02@gmail.com> | 2010-10-24 11:30:12 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-10-24 11:30:12 +0000 |
commit | 729acc2f2d4954130798ed382dca478eade14302 (patch) | |
tree | b3ee47681377aa2e274470118f54e9767221c493 /Source/NSNotificationAdditions.m | |
parent | c965b60b6ec45f56aa406296b5c35f48360f175a (diff) | |
download | sequelpro-729acc2f2d4954130798ed382dca478eade14302.tar.gz sequelpro-729acc2f2d4954130798ed382dca478eade14302.tar.bz2 sequelpro-729acc2f2d4954130798ed382dca478eade14302.zip |
- Split out all of SPExportController's delegate methods to their own category.
- Prepare for the implementation of PDF and HTML export by hiding the export options box for export types that don't need it.
- Fix some spacing issues on the export dialog.
- Create a new SPCategoryAdditions header that is included in the apps precompiled header, making all additions available to all classes.
- Update strings files.
Diffstat (limited to 'Source/NSNotificationAdditions.m')
-rw-r--r-- | Source/NSNotificationAdditions.m | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/Source/NSNotificationAdditions.m b/Source/NSNotificationAdditions.m index 78233de4..53917dae 100644 --- a/Source/NSNotificationAdditions.m +++ b/Source/NSNotificationAdditions.m @@ -28,48 +28,62 @@ @implementation NSNotificationCenter (NSNotificationCenterAdditions) -- (void) postNotificationOnMainThread:(NSNotification *) notification { - if( pthread_main_np() ) return [self postNotification:notification]; +- (void)postNotificationOnMainThread:(NSNotification *)notification +{ + if (pthread_main_np()) return [self postNotification:notification]; + [self postNotificationOnMainThread:notification waitUntilDone:NO]; } -- (void) postNotificationOnMainThread:(NSNotification *) notification waitUntilDone:(BOOL) wait { - if( pthread_main_np() ) return [self postNotification:notification]; - [[self class] performSelectorOnMainThread:@selector( _postNotification: ) withObject:notification waitUntilDone:wait]; +- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)wait +{ + if (pthread_main_np()) return [self postNotification:notification]; + + [[self class] performSelectorOnMainThread:@selector(_postNotification:) withObject:notification waitUntilDone:wait]; } -+ (void) _postNotification:(NSNotification *) notification { ++ (void)_postNotification:(NSNotification *)notification +{ [[self defaultCenter] postNotification:notification]; } -- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object { - if( pthread_main_np() ) return [self postNotificationName:name object:object userInfo:nil]; +- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object +{ + if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:nil]; + [self postNotificationOnMainThreadWithName:name object:object userInfo:nil waitUntilDone:NO]; } -- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo { - if( pthread_main_np() ) return [self postNotificationName:name object:object userInfo:userInfo]; +- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo +{ + if(pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo]; + [self postNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO]; } -- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo waitUntilDone:(BOOL) wait { - if( pthread_main_np() ) return [self postNotificationName:name object:object userInfo:userInfo]; - +- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)wait +{ + if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo]; + NSMutableDictionary *info = [[NSMutableDictionary allocWithZone:nil] initWithCapacity:3]; - if( name ) [info setObject:name forKey:@"name"]; - if( object ) [info setObject:object forKey:@"object"]; - if( userInfo ) [info setObject:userInfo forKey:@"userInfo"]; - - [[self class] performSelectorOnMainThread:@selector( _postNotificationName: ) withObject:info waitUntilDone:wait]; - + + if (name) [info setObject:name forKey:@"name"]; + if (object) [info setObject:object forKey:@"object"]; + if (userInfo) [info setObject:userInfo forKey:@"userInfo"]; + + [[self class] performSelectorOnMainThread:@selector(_postNotificationName:) withObject:info waitUntilDone:wait]; + [info release]; } -+ (void) _postNotificationName:(NSDictionary *) info { ++ (void)_postNotificationName:(NSDictionary *)info +{ NSString *name = [info objectForKey:@"name"]; + id object = [info objectForKey:@"object"]; + NSDictionary *userInfo = [info objectForKey:@"userInfo"]; - + [[self defaultCenter] postNotificationName:name object:object userInfo:userInfo]; } |