aboutsummaryrefslogtreecommitdiffstats
path: root/Source/NSNotificationAdditions.m
diff options
context:
space:
mode:
authorsqlprodev <sqlprodev@northofthree.com>2011-04-14 19:57:45 +0000
committersqlprodev <sqlprodev@northofthree.com>2011-04-14 19:57:45 +0000
commit8c2e3126426c0c4c9e5bc2392879a850d3373641 (patch)
tree8a6963b5efd578e8586bd808d5f204a81a85c6dc /Source/NSNotificationAdditions.m
parentad7328e56541556d23f527303deddaefd4253ef2 (diff)
downloadsequelpro-8c2e3126426c0c4c9e5bc2392879a850d3373641.tar.gz
sequelpro-8c2e3126426c0c4c9e5bc2392879a850d3373641.tar.bz2
sequelpro-8c2e3126426c0c4c9e5bc2392879a850d3373641.zip
SP_REFACTOR: Workaround for naming conflict with postNotificationOnMainThread: which also exists in TCMPortMapper.framework; NSUserDefaults access now permitted in SP_REFACTOR blocks for a few prefs keys
Diffstat (limited to 'Source/NSNotificationAdditions.m')
-rw-r--r--Source/NSNotificationAdditions.m60
1 files changed, 59 insertions, 1 deletions
diff --git a/Source/NSNotificationAdditions.m b/Source/NSNotificationAdditions.m
index ae949347..8b64c1f2 100644
--- a/Source/NSNotificationAdditions.m
+++ b/Source/NSNotificationAdditions.m
@@ -27,42 +27,84 @@
#import "pthread.h"
@interface NSNotificationCenter (NSNotificationCenterAdditions_PrivateAPI)
+#ifndef SP_REFACTOR
+ (void)_postNotification:(NSNotification *)notification;
+ (void)_postNotificationName:(NSDictionary *)info;
+ (void)_postNotificationForwarder:(NSDictionary *)info;
+#else
++ (void)_sequelProPostNotification:(NSNotification *)notification;
++ (void)_sequelProPostNotificationName:(NSDictionary *)info;
++ (void)_sequelProPostNotificationForwarder:(NSDictionary *)info;
+#endif
@end
@implementation NSNotificationCenter (NSNotificationCenterAdditions)
+#ifndef SP_REFACTOR
- (void)postNotificationOnMainThread:(NSNotification *)notification
+#else
+- (void)sequelProPostNotificationOnMainThread:(NSNotification *)notification
+#endif
{
if (pthread_main_np()) return [self postNotification:notification];
+#ifndef SP_REFACTOR
[self postNotificationOnMainThread:notification waitUntilDone:NO];
+#else
+ [self sequelProPostNotificationOnMainThread:notification waitUntilDone:NO];
+#endif
}
+#ifndef SP_REFACTOR
- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)shouldWaitUntilDone
+#else
+- (void)sequelProPostNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)shouldWaitUntilDone
+#endif
{
if (pthread_main_np()) return [self postNotification:notification];
-
+
+#ifndef SP_REFACTOR
[self performSelectorOnMainThread:@selector(_postNotification:) withObject:notification waitUntilDone:shouldWaitUntilDone];
+#else
+ [self performSelectorOnMainThread:@selector(_sequelProPostNotification:) withObject:notification waitUntilDone:shouldWaitUntilDone];
+#endif
}
+#ifndef SP_REFACTOR
- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object
+#else
+- (void)sequelProPostNotificationOnMainThreadWithName:(NSString *)name object:(id)object
+#endif
{
if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:nil];
+#ifndef SP_REFACTOR
[self postNotificationOnMainThreadWithName:name object:object userInfo:nil waitUntilDone:NO];
+#else
+ [self sequelProPostNotificationOnMainThreadWithName:name object:object userInfo:nil waitUntilDone:NO];
+#endif
}
+#ifndef SP_REFACTOR
- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo
+#else
+- (void)sequelProPostNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo
+#endif
{
if(pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo];
+#ifndef SP_REFACTOR
[self postNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO];
+#else
+ [self sequelProPostNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO];
+#endif
}
+#ifndef SP_REFACTOR
- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)shouldWaitUntilDone
+#else
+- (void)sequelProPostNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)shouldWaitUntilDone
+#endif
{
if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo];
@@ -72,7 +114,11 @@
if (object) [info setObject:object forKey:@"object"];
if (userInfo) [info setObject:userInfo forKey:@"userInfo"];
+#ifndef SP_REFACTOR
[[self class] performSelectorOnMainThread:@selector(_postNotificationName:) withObject:info waitUntilDone:shouldWaitUntilDone];
+#else
+ [[self class] performSelectorOnMainThread:@selector(_sequelProPostNotificationName:) withObject:info waitUntilDone:shouldWaitUntilDone];
+#endif
[info release];
}
@@ -81,12 +127,20 @@
@implementation NSNotificationCenter (NSNotificationCenterAdditions_PrivateAPI)
+#ifndef SP_REFACTOR
+ (void)_postNotification:(NSNotification *)notification
+#else
++ (void)_sequelProPostNotification:(NSNotification *)notification
+#endif
{
[[self defaultCenter] postNotification:notification];
}
+#ifndef SP_REFACTOR
+ (void)_postNotificationName:(NSDictionary *)info
+#else
++ (void)_sequelProPostNotificationName:(NSDictionary *)info
+#endif
{
NSString *name = [info objectForKey:@"name"];
@@ -97,7 +151,11 @@
[[self defaultCenter] postNotificationName:name object:object userInfo:userInfo];
}
+#ifndef SP_REFACTOR
+ (void)_postNotificationForwarder:(NSDictionary *)info
+#else
++ (void)_sequelProPostNotificationForwarder:(NSDictionary *)info
+#endif
{
NSString *name = [info objectForKey:@"name"];