Update the title bar when searching
This commit is contained in:
parent
bc7692f4ba
commit
04736ded79
@ -642,6 +642,7 @@ extension MainWindowController: NSSearchFieldDelegate {
|
|||||||
let smartFeed = SmartFeed(delegate: SearchFeedDelegate(searchString: searchString))
|
let smartFeed = SmartFeed(delegate: SearchFeedDelegate(searchString: searchString))
|
||||||
timelineContainerViewController?.setRepresentedObjects([smartFeed], mode: .search)
|
timelineContainerViewController?.setRepresentedObjects([smartFeed], mode: .search)
|
||||||
searchSmartFeed = smartFeed
|
searchSmartFeed = smartFeed
|
||||||
|
updateWindowTitle()
|
||||||
}
|
}
|
||||||
|
|
||||||
func forceSearchToEnd() {
|
func forceSearchToEnd() {
|
||||||
@ -651,10 +652,12 @@ extension MainWindowController: NSSearchFieldDelegate {
|
|||||||
if let searchField = currentSearchField {
|
if let searchField = currentSearchField {
|
||||||
searchField.stringValue = ""
|
searchField.stringValue = ""
|
||||||
}
|
}
|
||||||
|
updateWindowTitle()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func startSearchingIfNeeded() {
|
private func startSearchingIfNeeded() {
|
||||||
timelineSourceMode = .search
|
timelineSourceMode = .search
|
||||||
|
updateWindowTitle()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func stopSearchingIfNeeded() {
|
private func stopSearchingIfNeeded() {
|
||||||
@ -662,6 +665,7 @@ extension MainWindowController: NSSearchFieldDelegate {
|
|||||||
lastSentSearchString = nil
|
lastSentSearchString = nil
|
||||||
timelineSourceMode = .regular
|
timelineSourceMode = .regular
|
||||||
timelineContainerViewController?.setRepresentedObjects(nil, mode: .search)
|
timelineContainerViewController?.setRepresentedObjects(nil, mode: .search)
|
||||||
|
updateWindowTitle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1234,6 +1238,15 @@ private extension MainWindowController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateWindowTitle() {
|
func updateWindowTitle() {
|
||||||
|
guard timelineSourceMode != .search else {
|
||||||
|
let localizedLabel = NSLocalizedString("Search: %@", comment: "Search")
|
||||||
|
window?.title = NSString.localizedStringWithFormat(localizedLabel as NSString, searchString ?? "") as String
|
||||||
|
if #available(macOS 11.0, *) {
|
||||||
|
window?.subtitle = ""
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func setSubtitle(_ count: Int) {
|
func setSubtitle(_ count: Int) {
|
||||||
let localizedLabel = NSLocalizedString("%d unread", comment: "Unread")
|
let localizedLabel = NSLocalizedString("%d unread", comment: "Unread")
|
||||||
let formattedLabel = NSString.localizedStringWithFormat(localizedLabel as NSString, count)
|
let formattedLabel = NSString.localizedStringWithFormat(localizedLabel as NSString, count)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user