From 9a400b562a83ed0ef9449cded72152d1e4860f5c Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Mon, 11 Mar 2013 11:39:08 +0100 Subject: [PATCH] Symbols for mapping userInfo key names. --- Classes/NJMappingMenuController.m | 6 +++--- Classes/NJMappingsController.m | 4 ++-- Info.plist | 2 +- Other Sources/NJEvents.h | 11 +++++++---- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Classes/NJMappingMenuController.m b/Classes/NJMappingMenuController.m index 0fa6183..882a984 100644 --- a/Classes/NJMappingMenuController.m +++ b/Classes/NJMappingMenuController.m @@ -52,8 +52,8 @@ } - (void)mappingsListDidChange:(NSNotification *)note { - NSArray *mappings = note.userInfo[@"mappings"]; - NJMapping *currentMapping = note.userInfo[@"mapping"]; + NSArray *mappings = note.userInfo[NJMappingListKey]; + NJMapping *currentMapping = note.userInfo[NJMappingKey]; NSMenuItem *toRemove; while (self.menu.numberOfItems > self.firstMappingIndex && (toRemove = [self.menu itemAtIndex:self.firstMappingIndex]) @@ -92,7 +92,7 @@ } - (void)mappingDidChange:(NSNotification *)note { - NJMapping *mapping = note.userInfo[@"mapping"]; + NJMapping *mapping = note.userInfo[NJMappingKey]; for (NSMenuItem *item in self.menu.itemArray) if ([item.representedObject isKindOfClass:NJMapping.class]) item.state = mapping == item.representedObject; diff --git a/Classes/NJMappingsController.m b/Classes/NJMappingsController.m index ad257cf..d7310c0 100644 --- a/Classes/NJMappingsController.m +++ b/Classes/NJMappingsController.m @@ -52,8 +52,8 @@ [NSNotificationCenter.defaultCenter postNotificationName:NJEventMappingListChanged object:self - userInfo:@{ @"mappings": _mappings, - @"mapping": _currentMapping }]; + userInfo:@{ NJMappingListKey: _mappings, + NJMappingKey: _currentMapping }]; } - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state diff --git a/Info.plist b/Info.plist index 5eb91a7..74f1265 100644 --- a/Info.plist +++ b/Info.plist @@ -46,7 +46,7 @@ CFBundleSignature ???? CFBundleVersion - 123 + 124 LSApplicationCategoryType public.app-category.utilities NSHumanReadableCopyright diff --git a/Other Sources/NJEvents.h b/Other Sources/NJEvents.h index ce87b24..5485154 100644 --- a/Other Sources/NJEvents.h +++ b/Other Sources/NJEvents.h @@ -6,7 +6,10 @@ // // -#define NJEventMappingChanged @"NJEventMappingChanged" -#define NJEventMappingListChanged @"NJEventMappingListChanged" -#define NJEventTranslationActivated @"NJEventTranslationActivated" -#define NJEventTranslationDeactivated @"NJEventTranslationDeactivated" +#define NJEventMappingChanged @"com.yukkurigames.Enjoyable.MappingChanged" +#define NJEventMappingListChanged @"com.yukkurigames.Enjoyable.MappingListChanged" +#define NJEventTranslationActivated @"com.yukkurigames.Enjoyable.EventTranslationActivated" +#define NJEventTranslationDeactivated @"com.yukkurigames.Enjoyable.EventTranslationDeactivated" + +#define NJMappingKey @"com.yukkurigames.Enjoyable.Mapping" +#define NJMappingListKey @"com.yukkurigames.Enjoyable.MappingList" -- 2.20.1