Add TVCMainWindowSelectionChangedNotification and use it in a few places

This commit is contained in:
Michael
2018-09-12 12:26:06 -04:00
parent 2703d532de
commit f30b2a5eb0
5 changed files with 17 additions and 6 deletions
@@ -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];
@@ -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;
@@ -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
@@ -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
@@ -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];