mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-28 00:04:25 +00:00
Add Refresh and Show/Hide Sidebar commands to status bar gear menu.
This commit is contained in:
1 parent
dcbc6a44b7
commit
a746736bf1
4 files changed
+27
-2
No files matched your search
@@ -486,7 +486,7 @@ let appName = "NetNewsWire"
|
||||
let isDisplayingSheet = mainWindowController?.isDisplayingSheet ?? false
|
||||
|
||||
if item.action == #selector(refreshAll(_:)) {
|
||||
return !AccountManager.shared.refreshInProgress && !AccountManager.shared.activeAccounts.isEmpty
|
||||
return AccountManager.shared.canRefresh
|
||||
}
|
||||
|
||||
if item.action == #selector(importOPMLFromFile(_:)) {
|
||||
|
||||
@@ -884,7 +884,22 @@ extension MainWindowController: DetailViewControllerDelegate {
|
||||
extension MainWindowController: MainWindowStatusBarViewDelegate {
|
||||
|
||||
func statusBarViewGearMenu(_ statusBarView: MainWindowStatusBarView) -> NSMenu? {
|
||||
sidebarViewController?.statusBarMenu()
|
||||
guard let menu = sidebarViewController?.statusBarMenu() else {
|
||||
return nil
|
||||
}
|
||||
|
||||
var index = 0
|
||||
if AccountManager.shared.canRefresh {
|
||||
menu.insertItem(withTitle: NSLocalizedString("Refresh", comment: "Refresh"), action: #selector(AppDelegate.refreshAll(_:)), keyEquivalent: "", at: index)
|
||||
index += 1
|
||||
}
|
||||
|
||||
let isSidebarHidden = sidebarSplitViewItem?.isCollapsed ?? false
|
||||
let sidebarTitle = isSidebarHidden ? NSLocalizedString("Show Sidebar", comment: "Command") : NSLocalizedString("Hide Sidebar", comment: "Command")
|
||||
menu.insertItem(withTitle: sidebarTitle, action: #selector(NSSplitViewController.toggleSidebar(_:)), keyEquivalent: "", at: index)
|
||||
menu.insertItem(NSMenuItem.separator(), at: index + 1)
|
||||
|
||||
return menu
|
||||
}
|
||||
|
||||
func statusBarView(_ statusBarView: MainWindowStatusBarView, moveSidebarDividerTo position: CGFloat) {
|
||||
|
||||
@@ -132,6 +132,10 @@ import ActivityLog
|
||||
return false
|
||||
}
|
||||
|
||||
public var canRefresh: Bool {
|
||||
!refreshInProgress && !activeAccounts.isEmpty
|
||||
}
|
||||
|
||||
private var isActive = false
|
||||
|
||||
public init() {
|
||||
|
||||
@@ -704,6 +704,9 @@
|
||||
"Hide Read Feeds" : {
|
||||
"comment" : "Command"
|
||||
},
|
||||
"Hide Sidebar" : {
|
||||
"comment" : "Command"
|
||||
},
|
||||
"Hide Status Bar" : {
|
||||
"comment" : "Command"
|
||||
},
|
||||
@@ -1215,6 +1218,9 @@
|
||||
"Show Reader View" : {
|
||||
"comment" : "Show Reader View"
|
||||
},
|
||||
"Show Sidebar" : {
|
||||
"comment" : "Command"
|
||||
},
|
||||
"Show Status Bar" : {
|
||||
"comment" : "Command"
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user