@@ -12,7 +12,8 @@ class WindowController: NSWindowController {
1212
1313 @IBOutlet weak var loadingIndicator : NSProgressIndicator !
1414 @IBOutlet weak var tabControl : NSSegmentedControl !
15-
15+ @IBOutlet weak var refreshButton : NSButton !
16+
1617 override func windowDidLoad( ) {
1718 super. windowDidLoad ( )
1819 NotificationCenter . default. addObserver ( self , selector: #selector( self . reopen ( notification: ) ) , name: Notification . Name ( " reopen " ) , object: nil )
@@ -23,6 +24,7 @@ class WindowController: NSWindowController {
2324
2425 var frame = self . window? . frame
2526 frame? . size = NSSize ( width: 620 , height: 350 )
27+ refreshButton. isHidden = true
2628 self . window? . setFrame ( frame!, display: true )
2729 }
2830
@@ -32,6 +34,7 @@ class WindowController: NSWindowController {
3234
3335 @objc func changeTab( notification: Notification ) {
3436 tabControl. setSelected ( true , forSegment: notification. object as! Int )
37+ refreshButton. isHidden = ( notification. object as! Int == 0 )
3538 }
3639
3740 @objc func reopen( notification: Notification ) {
@@ -42,9 +45,11 @@ class WindowController: NSWindowController {
4245 if notification. name. rawValue == " show-loading " {
4346 self . loadingIndicator. isHidden = false
4447 self . loadingIndicator. startAnimation ( self )
48+ self . refreshButton. isEnabled = false
4549 } else {
4650 self . loadingIndicator. isHidden = true
4751 self . loadingIndicator. stopAnimation ( self )
52+ self . refreshButton. isEnabled = true
4853 }
4954 }
5055
@@ -59,4 +64,8 @@ class WindowController: NSWindowController {
5964 print ( response)
6065 } )
6166 }
67+
68+ @IBAction func refresh( _ sender: Any ) {
69+ NotificationCenter . default. post ( name: NSNotification . Name ( " refresh-list " ) , object: nil )
70+ }
6271}
0 commit comments