Add actions for sort menu items.

This commit is contained in:
Brent Simmons 2018-01-27 15:11:02 -08:00
parent b32d45cd60
commit 7e0917cb4e
2 changed files with 21 additions and 1 deletions

View File

@ -28,7 +28,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
var appName: String!
@IBOutlet var debugMenuItem: NSMenuItem!
@IBOutlet var sortByOldestArticleOnTopMenuItem: NSMenuItem!
@IBOutlet var sortByNewestArticleOnTopMenuItem: NSMenuItem!
lazy var genericFeedImage: NSImage? = {
let path = "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/BookmarkIcon.icns"
let image = NSImage(contentsOfFile: path)
@ -460,6 +462,16 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
createAndShowMainWindow()
mainWindowController!.gotoStarred(sender)
}
@IBAction func sortByOldestArticleOnTop(_ sender: Any?) {
AppDefaults.shared.timelineSortDirection = .orderedAscending
}
@IBAction func sortByNewestArticleOnTop(_ sender: Any?) {
AppDefaults.shared.timelineSortDirection = .orderedDescending
}
}
private extension AppDelegate {

View File

@ -335,9 +335,15 @@
<items>
<menuItem title="Newest Article on Top" id="TNS-TV-n0U">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="sortByNewestArticleOnTop:" target="Ady-hI-5gd" id="gkW-hU-IQJ"/>
</connections>
</menuItem>
<menuItem title="Oldest Article on Top" id="iii-kP-qoF">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="sortByOldestArticleOnTop:" target="Ady-hI-5gd" id="8jC-1r-5RH"/>
</connections>
</menuItem>
</items>
</menu>
@ -544,6 +550,8 @@
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="Evergreen" customModuleProvider="target">
<connections>
<outlet property="debugMenuItem" destination="UqE-mp-gtV" id="OnR-lr-Zlt"/>
<outlet property="sortByNewestArticleOnTopMenuItem" destination="TNS-TV-n0U" id="gix-Nd-9k4"/>
<outlet property="sortByOldestArticleOnTopMenuItem" destination="iii-kP-qoF" id="fTe-Tf-EWG"/>
</connections>
</customObject>
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>