Skip to content

Commit

Permalink
Merge pull request #669 from JohnCoates/revert-651-menu
Browse files Browse the repository at this point in the history
Revert "Makes menu creation code more condensed"
  • Loading branch information
glouel committed Nov 19, 2018
2 parents 95e7b90 + 1fb4b02 commit 46b37b4
Showing 1 changed file with 29 additions and 10 deletions.
39 changes: 29 additions & 10 deletions Aerial/Source/Controllers/PreferencesWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1377,16 +1377,35 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo
// MARK: - Menu
@IBAction func outlineViewSettingsClick(_ button: NSButton) {
let menu = NSMenu()
menu.items = [
NSMenuItem(title: "Check Only Cached", action: #selector(outlineViewCheckCached), keyEquivalent: ""),
NSMenuItem(title: "Check Only 4K", action: #selector(outlineViewCheck4K), keyEquivalent: ""),
NSMenuItem(title: "Check All", action: #selector(outlineViewCheckAll), keyEquivalent: ""),
NSMenuItem(title: "Uncheck All", action: #selector(outlineViewUncheckAll), keyEquivalent: ""),
NSMenuItem.separator(),
NSMenuItem(title: "Download Checked", action: #selector(outlineViewDownloadChecked), keyEquivalent: ""),
NSMenuItem(title: "Download All", action: #selector(outlineViewDownloadAll), keyEquivalent: ""),
]
NSMenu.popUpContextMenu(menu, with: NSApp.currentEvent!, for: button)

menu.insertItem(withTitle: "Check Only Cached",
action: #selector(PreferencesWindowController.outlineViewCheckCached(button:)),
keyEquivalent: "",
at: 0)
menu.insertItem(withTitle: "Check Only 4K",
action: #selector(PreferencesWindowController.outlineViewCheck4K(button:)),
keyEquivalent: "",
at: 1)
menu.insertItem(withTitle: "Check All",
action: #selector(PreferencesWindowController.outlineViewCheckAll(button:)),
keyEquivalent: "",
at: 2)
menu.insertItem(withTitle: "Uncheck All",
action: #selector(PreferencesWindowController.outlineViewUncheckAll(button:)),
keyEquivalent: "",
at: 3)
menu.insertItem(NSMenuItem.separator(), at: 4)
menu.insertItem(withTitle: "Download Checked",
action: #selector(PreferencesWindowController.outlineViewDownloadChecked(button:)),
keyEquivalent: "",
at: 5)
menu.insertItem(withTitle: "Download All",
action: #selector(PreferencesWindowController.outlineViewDownloadAll(button:)),
keyEquivalent: "",
at: 6)

let event = NSApp.currentEvent
NSMenu.popUpContextMenu(menu, with: event!, for: button)
}

@objc func outlineViewUncheckAll(button: NSButton) {
Expand Down

0 comments on commit 46b37b4

Please sign in to comment.