Skip to content
This repository was archived by the owner on Apr 16, 2020. It is now read-only.

Commit 357302f

Browse files
committed
Add menu item to check for updates
1 parent 97ca006 commit 357302f

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

SpechtLite/AppDelegate.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import Cocoa
22
import NEKit
3+
import Sparkle
34

45
@NSApplicationMain
56
class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
7+
8+
@IBOutlet weak var updater: SUUpdater!
69
var barItem: NSStatusItem!
710
var configurations: [String: (String, Bool)] = [:]
811
var currentConfiguration: String?
@@ -49,6 +52,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
4952
menu.addItemWithTitle("Open config folder", action: #selector(AppDelegate.openConfigFolder(_:)), keyEquivalent: "c")
5053
menu.addItemWithTitle("Reload config", action: #selector(AppDelegate.reloadClicked(_:)), keyEquivalent: "r")
5154
menu.addItem(NSMenuItem.separatorItem())
55+
menu.addItemWithTitle("Check for updates", action: #selector(AppDelegate.update(_:)), keyEquivalent: "u")
56+
menu.addItem(NSMenuItem.separatorItem())
5257
menu.addItemWithTitle("Exit", action: #selector(AppDelegate.terminate(_:)), keyEquivalent: "q")
5358
}
5459

@@ -144,6 +149,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
144149
}
145150
}
146151

152+
func update(sender: AnyObject? = nil) {
153+
updater.checkForUpdates(sender)
154+
}
155+
147156
func alertError(errorDescription: String) {
148157
let alert = NSAlert()
149158
alert.messageText = errorDescription

SpechtLite/Base.lproj/MainMenu.xib

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
</customObject>
1313
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
1414
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
15-
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="SpechtLite" customModuleProvider="target"/>
15+
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="SpechtLite" customModuleProvider="target">
16+
<connections>
17+
<outlet property="updater" destination="Bul-pB-hbt" id="BRk-07-EOM"/>
18+
</connections>
19+
</customObject>
1620
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
1721
<customObject id="Bul-pB-hbt" customClass="SUUpdater"/>
1822
</objects>

0 commit comments

Comments
 (0)