Skip to content

Commit

Permalink
Corrected the names of the notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Filip Krikava committed Oct 24, 2010
1 parent 5fe8949 commit edf1376
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions ShiftIt/PreferencesWindowController.m
Expand Up @@ -27,8 +27,8 @@
NSString *const kKeyCodePrefKeySuffix = @"KeyCode";
NSString *const kModifiersPrefKeySuffix = @"Modifiers";

NSString *const kEnableActionsRequestNotification = @"kEnableActionsRequestNotification";
NSString *const kDisableActionsRequestNotification = @"kDisableActionsRequestNotification";
NSString *const kDidFinishEditingHotKeysPrefNotification = @"kEnableActionsRequestNotification";
NSString *const kDidStartEditingHotKeysPrefNotification = @"kDisableActionsRequestNotification";
NSString *const kHotKeyChangedNotification = @"kHotKeyChangedNotification";
NSString *const kActionIdentifierKey = @"kActionIdentifierKey";
NSString *const kHotKeyKeyCodeKey = @"kHotKeyKeyCodeKey";
Expand Down Expand Up @@ -173,9 +173,9 @@ -(void)dealloc{

- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem {
if ([selectedTabIdentifier_ isEqualTo:kHotKeysTabViewItemIdentifier]) {
[[NSNotificationCenter defaultCenter] postNotificationName:kDisableActionsRequestNotification object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:kDidStartEditingHotKeysPrefNotification object:nil];
} else {
[[NSNotificationCenter defaultCenter] postNotificationName:kEnableActionsRequestNotification object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:kDidFinishEditingHotKeysPrefNotification object:nil];
}
}

Expand All @@ -185,9 +185,9 @@ - (void)windowMainStatusChanged_:(NSNotification *)notification {
NSString *name = [notification name];

if ([name isEqualTo:NSWindowDidBecomeMainNotification] && [selectedTabIdentifier_ isEqualTo:kHotKeysTabViewItemIdentifier]) {
[[NSNotificationCenter defaultCenter] postNotificationName:kDisableActionsRequestNotification object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:kDidStartEditingHotKeysPrefNotification object:nil];
} else if ([name isEqualTo:NSWindowDidResignMainNotification]) {
[[NSNotificationCenter defaultCenter] postNotificationName:kEnableActionsRequestNotification object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:kDidFinishEditingHotKeysPrefNotification object:nil];
}
}

Expand Down
4 changes: 2 additions & 2 deletions ShiftIt/ShiftIt.h
Expand Up @@ -35,8 +35,8 @@ extern NSString *const kShowMenuPrefKey;
extern NSString *const kShowPreferencesRequestNotification;

// local notifications
extern NSString *const kEnableActionsRequestNotification;
extern NSString *const kDisableActionsRequestNotification;
extern NSString *const kDidFinishEditingHotKeysPrefNotification;
extern NSString *const kDidStartEditingHotKeysPrefNotification;
extern NSString *const kHotKeyChangedNotification;

// kHotKeyChangedNotification userInfo keys
Expand Down
8 changes: 4 additions & 4 deletions ShiftIt/ShiftItAppDelegate.m
Expand Up @@ -194,8 +194,8 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {

NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self selector:@selector(shiftItActionHotKeyChanged_:) name:kHotKeyChangedNotification object:nil];
[notificationCenter addObserver:self selector:@selector(handleActionsStateChangeRequest_:) name:kEnableActionsRequestNotification object:nil];
[notificationCenter addObserver:self selector:@selector(handleActionsStateChangeRequest_:) name:kDisableActionsRequestNotification object:nil];
[notificationCenter addObserver:self selector:@selector(handleActionsStateChangeRequest_:) name:kDidFinishEditingHotKeysPrefNotification object:nil];
[notificationCenter addObserver:self selector:@selector(handleActionsStateChangeRequest_:) name:kDidStartEditingHotKeysPrefNotification object:nil];

notificationCenter = [NSDistributedNotificationCenter defaultCenter];
[notificationCenter addObserver:self selector:@selector(handleShowPreferencesRequest_:) name:kShowPreferencesRequestNotification object:nil];
Expand Down Expand Up @@ -298,12 +298,12 @@ - (void)handleShowPreferencesRequest_:(NSNotification *) notification {
- (void)handleActionsStateChangeRequest_:(NSNotification *) notification {
NSString *name = [notification name];

if ([name isEqualTo:kEnableActionsRequestNotification]) {
if ([name isEqualTo:kDidFinishEditingHotKeysPrefNotification]) {
@synchronized(self) {
paused_ = NO;
FMTDevLog(@"Resuming actions");
}
} else if ([name isEqualTo:kDisableActionsRequestNotification]) {
} else if ([name isEqualTo:kDidStartEditingHotKeysPrefNotification]) {
@synchronized(self) {
paused_ = YES;
FMTDevLog(@"Pausing actions");
Expand Down

0 comments on commit edf1376

Please sign in to comment.