diff --git a/Sources/App/Classes/Controllers/TXMenuController.m b/Sources/App/Classes/Controllers/TXMenuController.m index 21c4abf9e..49dc30b7f 100755 --- a/Sources/App/Classes/Controllers/TXMenuController.m +++ b/Sources/App/Classes/Controllers/TXMenuController.m @@ -152,6 +152,8 @@ NS_ASSUME_NONNULL_BEGIN [RZNotificationCenter() addObserver:self selector:@selector(menuItemWillPerformedAction:) name:NSMenuWillSendActionNotification object:nil]; [RZNotificationCenter() addObserver:self selector:@selector(menuItemPerformedAction:) name:NSMenuDidSendActionNotification object:nil]; + + [RZNotificationCenter() addObserver:self selector:@selector(mainWindowSelectionChanged:) name:TVCMainWindowSelectionChangedNotification object:nil]; } - (void)setupOtherServices @@ -169,7 +171,7 @@ NS_ASSUME_NONNULL_BEGIN [self.fileTransferController clearIPAddress]; } -- (void)mainWindowSelectionDidChange +- (void)mainWindowSelectionChanged:(NSNotification *)notification { if (self.menuIsOpen == NO) { [self resetSelectedItems]; diff --git a/Sources/App/Classes/Headers/Private/TXMenuControllerPrivate.h b/Sources/App/Classes/Headers/Private/TXMenuControllerPrivate.h index 02ac36f67..5052b4dd5 100755 --- a/Sources/App/Classes/Headers/Private/TXMenuControllerPrivate.h +++ b/Sources/App/Classes/Headers/Private/TXMenuControllerPrivate.h @@ -46,8 +46,6 @@ NS_ASSUME_NONNULL_BEGIN @interface TXMenuController () @property (nonatomic, copy, nullable) NSString *pointedNickname; // Takes priority if sender of an action returns nil userInfo value -- (void)mainWindowSelectionDidChange; - - (void)populateNavigationChannelList; - (IBAction)performNavigationAction:(id)sender; diff --git a/Sources/App/Classes/Headers/TVCMainWindow.h b/Sources/App/Classes/Headers/TVCMainWindow.h index 1e01c26a0..313038f7f 100755 --- a/Sources/App/Classes/Headers/TVCMainWindow.h +++ b/Sources/App/Classes/Headers/TVCMainWindow.h @@ -64,6 +64,8 @@ TEXTUAL_EXTERN NSNotificationName const TVCMainWindowRedrawSubviewsNotification; TEXTUAL_EXTERN NSNotificationName const TVCMainWindowWillReloadThemeNotification; TEXTUAL_EXTERN NSNotificationName const TVCMainWindowDidReloadThemeNotification; +TEXTUAL_EXTERN NSNotificationName const TVCMainWindowSelectionChangedNotification; + TEXTUAL_EXTERN NSString * const TVCServerListDragType; @interface TVCMainWindow : NSWindow diff --git a/Sources/App/Classes/Library/TLOGrowlController.m b/Sources/App/Classes/Library/TLOGrowlController.m index ed3a52274..62ffa43ac 100755 --- a/Sources/App/Classes/Library/TLOGrowlController.m +++ b/Sources/App/Classes/Library/TLOGrowlController.m @@ -84,6 +84,15 @@ NSString * const TXNotificationHighlightLogStandardMessageFormat = @"%@ %@"; RZUserNotificationCenter().delegate = (id)self; [GrowlApplicationBridge setGrowlDelegate:(id)self]; + + [RZNotificationCenter() addObserver:self selector:@selector(mainWindowSelectionChanged:) name:TVCMainWindowSelectionChangedNotification object:nil]; +} + +- (void)mainWindowSelectionChanged:(NSNotification *)notification +{ + TVCMainWindow *mainWindow = mainWindow(); + + [self dismissNotificationCenterNotificationsForChannel:mainWindow.selectedChannel onClient:mainWindow.selectedClient]; } - (NSString *)titleForEvent:(TXNotificationType)event diff --git a/Sources/App/Classes/Views/Main Window/TVCMainWindow.m b/Sources/App/Classes/Views/Main Window/TVCMainWindow.m index 7e0abd383..c175cbed0 100644 --- a/Sources/App/Classes/Views/Main Window/TVCMainWindow.m +++ b/Sources/App/Classes/Views/Main Window/TVCMainWindow.m @@ -90,6 +90,8 @@ NSString * const TVCMainWindowRedrawSubviewsNotification = @"TVCMainWindowRedraw NSString * const TVCMainWindowWillReloadThemeNotification = @"TVCMainWindowWillReloadThemeNotification"; NSString * const TVCMainWindowDidReloadThemeNotification = @"TVCMainWindowDidReloadThemeNotification"; +NSString * const TVCMainWindowSelectionChangedNotification = @"TVCMainWindowSelectionChangedNotification"; + @interface TVCMainWindow () @property (nonatomic, weak, readwrite) IBOutlet TVCMainWindowChannelView *channelView; @property (nonatomic, weak, readwrite) IBOutlet TVCMainWindowTitlebarAccessoryView *titlebarAccessoryView; @@ -1800,9 +1802,7 @@ NSString * const TVCMainWindowDidReloadThemeNotification = @"TVCMainWindowDidRel /* Finish up */ [self storeLastSelectedChannel]; - [sharedGrowlController() dismissNotificationCenterNotificationsForChannel:self.selectedChannel onClient:self.selectedClient]; - - [menuController() mainWindowSelectionDidChange]; + [RZNotificationCenter() postNotificationName:TVCMainWindowSelectionChangedNotification object:self]; [TVCDockIcon updateDockIcon];