Disable Publish menu item while publishing

This commit is contained in:
Matt Baer 2017-07-31 19:33:49 -04:00
parent 81964d9ffa
commit cb93c3874f
3 changed files with 8 additions and 0 deletions

View File

@ -7,12 +7,14 @@
//
import Cocoa
import Foundation
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
var vc: ViewController?
@IBOutlet weak var filePublishItem: NSMenuItem!
@IBOutlet weak var nightModeItem: NSMenuItem!
@IBOutlet weak var formatFontSerifItem: NSMenuItem!
@IBOutlet weak var formatFontSansItem: NSMenuItem!
@ -85,6 +87,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
@IBAction func publishDoc(_ sender: Any) {
filePublishItem.isEnabled = false
vc?.publish()
}

View File

@ -368,6 +368,7 @@ DQ
</application>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="Write_as" customModuleProvider="target">
<connections>
<outlet property="filePublishItem" destination="Vdf-ed-k4A" id="TU2-UK-bgQ"/>
<outlet property="formatFontMonoItem" destination="WRG-CD-K1S" id="919-ab-Ig1"/>
<outlet property="formatFontSansItem" destination="Vjx-xi-njq" id="LIr-Ct-Ied"/>
<outlet property="formatFontSerifItem" destination="GB9-OM-e27" id="rVW-JC-eyr"/>

View File

@ -110,6 +110,10 @@ class ViewController: NSViewController, NSTextViewDelegate, NSUserNotificationCe
notification.informativeText = "The link is copied — press ⌘+V to share it."
notification.soundName = NSUserNotificationDefaultSoundName
if let ad = NSApplication.shared().delegate as? AppDelegate {
ad.filePublishItem.isEnabled = true
}
NSUserNotificationCenter.default.deliver(notification)
}
}