mirror of
https://github.com/lil-org/tokenary.git
synced 2024-12-12 12:33:42 +03:00
Move accounts menu setup in a separate function
This commit is contained in:
parent
70d9090abb
commit
f734e658a7
@ -34,13 +34,7 @@ class AccountsListViewController: NSViewController {
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
let menu = NSMenu()
|
||||
menu.delegate = self
|
||||
menu.addItem(NSMenuItem(title: "Copy address", action: #selector(didClickCopyAddress(_:)), keyEquivalent: ""))
|
||||
menu.addItem(.separator())
|
||||
menu.addItem(NSMenuItem(title: "Show private key", action: #selector(didClickExportAccount(_:)), keyEquivalent: "")) // TODO: show different texts for secret words export
|
||||
menu.addItem(NSMenuItem(title: "Remove account", action: #selector(didClickRemoveAccount(_:)), keyEquivalent: ""))
|
||||
tableView.menu = menu
|
||||
setupAccountsMenu()
|
||||
|
||||
if accounts.isEmpty {
|
||||
reloadAccounts()
|
||||
@ -50,6 +44,16 @@ class AccountsListViewController: NSViewController {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(didBecomeActive), name: NSApplication.didBecomeActiveNotification, object: nil)
|
||||
}
|
||||
|
||||
private func setupAccountsMenu() {
|
||||
let menu = NSMenu()
|
||||
menu.delegate = self
|
||||
menu.addItem(NSMenuItem(title: "Copy address", action: #selector(didClickCopyAddress(_:)), keyEquivalent: ""))
|
||||
menu.addItem(.separator())
|
||||
menu.addItem(NSMenuItem(title: "Show private key", action: #selector(didClickExportAccount(_:)), keyEquivalent: "")) // TODO: show different texts for secret words export
|
||||
menu.addItem(NSMenuItem(title: "Remove account", action: #selector(didClickRemoveAccount(_:)), keyEquivalent: ""))
|
||||
tableView.menu = menu
|
||||
}
|
||||
|
||||
private func reloadAccounts() {
|
||||
accounts = AccountsService.getAccounts()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user