mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-11 17:06:46 +01:00
48 lines
1.1 KiB
Swift
48 lines
1.1 KiB
Swift
//
|
|
// NNW3OpenPanelAccessoryViewController.swift
|
|
// NetNewsWire
|
|
//
|
|
// Created by Brent Simmons on 10/14/19.
|
|
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
//
|
|
|
|
import AppKit
|
|
import Account
|
|
|
|
final class NNW3OpenPanelAccessoryViewController: NSViewController {
|
|
|
|
@IBOutlet weak var accountPopUpButton: NSPopUpButton!
|
|
|
|
var selectedAccount: Account? {
|
|
accountPopUpButton.selectedItem?.representedObject as? Account
|
|
}
|
|
|
|
init() {
|
|
super.init(nibName: "NNW3OpenPanelAccessoryView", bundle: nil)
|
|
}
|
|
|
|
// MARK: - NSViewController
|
|
|
|
required init?(coder: NSCoder) {
|
|
preconditionFailure("NNW3OpenPanelAccessoryViewController.init(coder) not implemented by design.")
|
|
}
|
|
|
|
override func viewDidLoad() {
|
|
accountPopUpButton.removeAllItems()
|
|
|
|
let menu = NSMenu()
|
|
accountPopUpButton.menu = menu
|
|
|
|
for account in AccountManager.shared.sortedActiveAccounts {
|
|
let menuItem = NSMenuItem()
|
|
menuItem.title = account.nameForDisplay
|
|
menuItem.representedObject = account
|
|
menu.addItem(menuItem)
|
|
|
|
if account.accountID == AppDefaults.importOPMLAccountID {
|
|
accountPopUpButton.select(menuItem)
|
|
}
|
|
}
|
|
}
|
|
}
|