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()
|
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
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,58 +405,46 @@ extension MainWindowController: NSToolbarDelegate {
|
||||||
private extension MainWindowController {
|
private extension MainWindowController {
|
||||||
|
|
||||||
var splitViewController: NSSplitViewController? {
|
var splitViewController: NSSplitViewController? {
|
||||||
get {
|
|
||||||
guard let viewController = contentViewController else {
|
guard let viewController = contentViewController else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return viewController.childViewControllers.first as? NSSplitViewController
|
return viewController.childViewControllers.first as? NSSplitViewController
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var sidebarViewController: SidebarViewController? {
|
var sidebarViewController: SidebarViewController? {
|
||||||
get {
|
|
||||||
return splitViewController?.splitViewItems[0].viewController as? SidebarViewController
|
return splitViewController?.splitViewItems[0].viewController as? SidebarViewController
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var timelineViewController: TimelineViewController? {
|
var timelineViewController: TimelineViewController? {
|
||||||
get {
|
|
||||||
return splitViewController?.splitViewItems[1].viewController as? TimelineViewController
|
return splitViewController?.splitViewItems[1].viewController as? TimelineViewController
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sidebarSplitViewItem: NSSplitViewItem? {
|
||||||
|
return splitViewController?.splitViewItems[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
var detailSplitViewItem: NSSplitViewItem? {
|
var detailSplitViewItem: NSSplitViewItem? {
|
||||||
get {
|
|
||||||
return splitViewController?.splitViewItems[2]
|
return splitViewController?.splitViewItems[2]
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var detailViewController: DetailViewController? {
|
var detailViewController: DetailViewController? {
|
||||||
get {
|
|
||||||
return splitViewController?.splitViewItems[2].viewController as? DetailViewController
|
return splitViewController?.splitViewItems[2].viewController as? DetailViewController
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var selectedArticles: [Article]? {
|
var selectedArticles: [Article]? {
|
||||||
get {
|
|
||||||
return timelineViewController?.selectedArticles
|
return timelineViewController?.selectedArticles
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var oneSelectedArticle: Article? {
|
var oneSelectedArticle: Article? {
|
||||||
get {
|
|
||||||
if let articles = selectedArticles {
|
if let articles = selectedArticles {
|
||||||
return articles.count == 1 ? articles[0] : nil
|
return articles.count == 1 ? articles[0] : nil
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var currentLink: String? {
|
var currentLink: String? {
|
||||||
get {
|
|
||||||
return oneSelectedArticle?.preferredLink
|
return oneSelectedArticle?.preferredLink
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func canGoToNextUnread() -> Bool {
|
func canGoToNextUnread() -> Bool {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue