Change the name of the Show/Hide Sidebar command as needed. Fix #98.
This commit is contained in:
parent
a3a9d467dc
commit
78530dbb96
|
@ -153,6 +153,21 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
|||
return canShowShareMenu()
|
||||
}
|
||||
|
||||
if item.action == #selector(toggleSidebar(_:)) {
|
||||
|
||||
guard let splitViewItem = sidebarSplitViewItem else {
|
||||
return false
|
||||
}
|
||||
|
||||
let sidebarIsShowing = !splitViewItem.isCollapsed
|
||||
if let menuItem = item as? NSMenuItem {
|
||||
let title = sidebarIsShowing ? NSLocalizedString("Hide Sidebar", comment: "Menu item") : NSLocalizedString("Show Sidebar", comment: "Menu item")
|
||||
menuItem.title = title
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -390,58 +405,46 @@ extension MainWindowController: NSToolbarDelegate {
|
|||
private extension MainWindowController {
|
||||
|
||||
var splitViewController: NSSplitViewController? {
|
||||
get {
|
||||
guard let viewController = contentViewController else {
|
||||
return nil
|
||||
}
|
||||
return viewController.childViewControllers.first as? NSSplitViewController
|
||||
}
|
||||
}
|
||||
|
||||
var sidebarViewController: SidebarViewController? {
|
||||
get {
|
||||
return splitViewController?.splitViewItems[0].viewController as? SidebarViewController
|
||||
}
|
||||
}
|
||||
|
||||
var timelineViewController: TimelineViewController? {
|
||||
get {
|
||||
return splitViewController?.splitViewItems[1].viewController as? TimelineViewController
|
||||
}
|
||||
|
||||
var sidebarSplitViewItem: NSSplitViewItem? {
|
||||
return splitViewController?.splitViewItems[0]
|
||||
}
|
||||
|
||||
var detailSplitViewItem: NSSplitViewItem? {
|
||||
get {
|
||||
return splitViewController?.splitViewItems[2]
|
||||
}
|
||||
}
|
||||
|
||||
var detailViewController: DetailViewController? {
|
||||
get {
|
||||
return splitViewController?.splitViewItems[2].viewController as? DetailViewController
|
||||
}
|
||||
}
|
||||
|
||||
var selectedArticles: [Article]? {
|
||||
get {
|
||||
return timelineViewController?.selectedArticles
|
||||
}
|
||||
}
|
||||
|
||||
var oneSelectedArticle: Article? {
|
||||
get {
|
||||
if let articles = selectedArticles {
|
||||
return articles.count == 1 ? articles[0] : nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
var currentLink: String? {
|
||||
get {
|
||||
return oneSelectedArticle?.preferredLink
|
||||
}
|
||||
}
|
||||
|
||||
func canGoToNextUnread() -> Bool {
|
||||
|
||||
|
|
Loading…
Reference in New Issue