mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-31 11:14:54 +01:00
Set the menu item state for the sort-by menu items.
This commit is contained in:
parent
8968d00d6d
commit
6e63ce5968
@ -132,11 +132,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
|
||||
authorAvatarDownloader = AuthorAvatarDownloader(imageDownloader: imageDownloader)
|
||||
feedIconDownloader = FeedIconDownloader(imageDownloader: imageDownloader)
|
||||
|
||||
updateSortMenuItems()
|
||||
createAndShowMainWindow()
|
||||
|
||||
NSAppleEventManager.shared().setEventHandler(self, andSelector: #selector(AppDelegate.getURL(_:_:)), forEventClass: AEEventClass(kInternetEventClass), andEventID: AEEventID(kAEGetURL))
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(feedSettingDidChange(_:)), name: .FeedSettingDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange(_:)), name: UserDefaults.didChangeNotification, object: nil)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.unreadCount = AccountManager.shared.unreadCount
|
||||
@ -221,6 +223,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
|
||||
inspectorWindowController.objects = objectsForInspector()
|
||||
}
|
||||
|
||||
@objc func userDefaultsDidChange(_ note: Notification) {
|
||||
|
||||
updateSortMenuItems()
|
||||
}
|
||||
|
||||
// MARK: Main Window
|
||||
|
||||
func windowControllerWithName(_ storyboardName: String) -> NSWindowController {
|
||||
@ -498,4 +505,11 @@ private extension AppDelegate {
|
||||
inspectorWindowController.saveState()
|
||||
}
|
||||
}
|
||||
|
||||
func updateSortMenuItems() {
|
||||
|
||||
let sortByNewestOnTop = AppDefaults.shared.timelineSortDirection == .orderedDescending
|
||||
sortByNewestArticleOnTopMenuItem.state = sortByNewestOnTop ? .on : .off
|
||||
sortByOldestArticleOnTopMenuItem.state = sortByNewestOnTop ? .off : .on
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user