Update "Open in Browser" menu item title as well
This commit is contained in:
parent
1ab17b2574
commit
baf2dcf0c7
|
@ -59,6 +59,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
|
|||
@IBOutlet var sortByNewestArticleOnTopMenuItem: NSMenuItem!
|
||||
@IBOutlet var groupArticlesByFeedMenuItem: NSMenuItem!
|
||||
@IBOutlet var checkForUpdatesMenuItem: NSMenuItem!
|
||||
@IBOutlet var openInBrowserMenuItem: NSMenuItem!
|
||||
|
||||
var unreadCount = 0 {
|
||||
didSet {
|
||||
|
@ -110,6 +111,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
|
|||
NotificationCenter.default.addObserver(self, selector: #selector(inspectableObjectsDidChange(_:)), name: .InspectableObjectsDidChange, object: nil)
|
||||
NSWorkspace.shared.notificationCenter.addObserver(self, selector: #selector(didWakeNotification(_:)), name: NSWorkspace.didWakeNotification, object: nil)
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(defaultBrowserDidChange(_:)), name: .DefaultBrowserDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(defaultBrowserDidChange(_:)), name: NSApplication.willBecomeActiveNotification, object: nil)
|
||||
|
||||
appDelegate = self
|
||||
}
|
||||
|
||||
|
@ -726,6 +730,30 @@ private extension AppDelegate {
|
|||
let groupByFeedEnabled = AppDefaults.timelineGroupByFeed
|
||||
groupArticlesByFeedMenuItem.state = groupByFeedEnabled ? .on : .off
|
||||
}
|
||||
|
||||
func updateOpenInBrowserMenuItem() {
|
||||
var browserName = NSLocalizedString("Browser", comment: "Browser")
|
||||
|
||||
var currentBrowser: MacWebBrowser?
|
||||
|
||||
if let browserID = AppDefaults.defaultBrowserID {
|
||||
currentBrowser = MacWebBrowser(bundleIdentifier: browserID)
|
||||
} else {
|
||||
currentBrowser = MacWebBrowser.default
|
||||
}
|
||||
|
||||
if let currentBrowser = currentBrowser {
|
||||
browserName = currentBrowser.name!
|
||||
}
|
||||
|
||||
let format = NSLocalizedString("Open in %@", comment: "Open in Browser menu item title format")
|
||||
openInBrowserMenuItem.title = String(format: format, browserName)
|
||||
|
||||
}
|
||||
|
||||
@objc func defaultBrowserDidChange(_ note: Notification) {
|
||||
updateOpenInBrowserMenuItem()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -659,6 +659,7 @@
|
|||
<outlet property="checkForUpdatesMenuItem" destination="1nF-7O-aKU" id="JmT-jc-DJ8"/>
|
||||
<outlet property="debugMenuItem" destination="UqE-mp-gtV" id="OnR-lr-Zlt"/>
|
||||
<outlet property="groupArticlesByFeedMenuItem" destination="Zxm-O6-NRE" id="gwn-VT-2YZ"/>
|
||||
<outlet property="openInBrowserMenuItem" destination="4iQ-1v-dTa" id="8fC-GY-YmU"/>
|
||||
<outlet property="sortByNewestArticleOnTopMenuItem" destination="TNS-TV-n0U" id="gix-Nd-9k4"/>
|
||||
<outlet property="sortByOldestArticleOnTopMenuItem" destination="iii-kP-qoF" id="fTe-Tf-EWG"/>
|
||||
</connections>
|
||||
|
|
Loading…
Reference in New Issue