aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/MCPKit/Support files
diff options
context:
space:
mode:
Diffstat (limited to 'Frameworks/MCPKit/Support files')
-rw-r--r--Frameworks/MCPKit/Support files/NSNotificationAdditions.h10
-rw-r--r--Frameworks/MCPKit/Support files/NSNotificationAdditions.m50
2 files changed, 37 insertions, 23 deletions
diff --git a/Frameworks/MCPKit/Support files/NSNotificationAdditions.h b/Frameworks/MCPKit/Support files/NSNotificationAdditions.h
index 33c8ec10..7d0d6f9a 100644
--- a/Frameworks/MCPKit/Support files/NSNotificationAdditions.h
+++ b/Frameworks/MCPKit/Support files/NSNotificationAdditions.h
@@ -25,11 +25,11 @@
@interface NSNotificationCenter (NSNotificationCenterAdditions)
-- (void) postNotificationOnMainThread:(NSNotification *) notification;
-- (void) postNotificationOnMainThread:(NSNotification *) notification waitUntilDone:(BOOL) wait;
+- (void)postNotificationOnMainThread:(NSNotification *)notification;
+- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)wait;
-- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object;
-- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo;
-- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo waitUntilDone:(BOOL) wait;
+- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object;
+- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo;
+- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)wait;
@end
diff --git a/Frameworks/MCPKit/Support files/NSNotificationAdditions.m b/Frameworks/MCPKit/Support files/NSNotificationAdditions.m
index f27a4d5c..d615231e 100644
--- a/Frameworks/MCPKit/Support files/NSNotificationAdditions.m
+++ b/Frameworks/MCPKit/Support files/NSNotificationAdditions.m
@@ -24,50 +24,64 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import "NSNotificationAdditions.h"
-#import <pthread.h>
+#import "pthread.h"
@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"];
+
+ 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];
+ [[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];