Skip to content

Commit 4224acb

Browse files
committed
Fix lots of trailing white space
1 parent d3cc8c7 commit 4224acb

File tree

5 files changed

+70
-69
lines changed

5 files changed

+70
-69
lines changed

Finicky/Finicky/AppDelegate.swift

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@ class AppDelegate: NSObject, NSApplicationDelegate {
1515

1616
@IBOutlet weak var window: NSWindow!
1717
@IBOutlet var statusItemMenu: NSMenu!
18-
18+
1919
var statusItem: NSStatusItem!
2020
var configLoader: FNConfigLoader!
2121
var shortUrlResolver: FNShortUrlResolver!
2222
var urlsToLoad = Array<String>()
23-
23+
2424
static var defaultBrowser: String! = "com.google.Chrome"
25-
25+
2626
func applicationDidFinishLaunching(aNotification: NSNotification) {
2727
var bundleId = "net.kassett.Finicky"
2828
LSSetDefaultHandlerForURLScheme("http", bundleId)
2929
LSSetDefaultHandlerForURLScheme("https", bundleId)
30-
30+
3131
var img: NSImage! = NSImage(named: "statusitem")
3232
img.setTemplate(true)
33-
33+
3434
let bar = NSStatusBar.systemStatusBar()
3535
// Workaround for some bug: -1 instead of NSVariableStatusItemLength
3636
statusItem = bar.statusItemWithLength(CGFloat(-1))
@@ -39,11 +39,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
3939
statusItem.image = img
4040
toggleDockIcon(showIcon: false)
4141
}
42-
42+
4343
@IBAction func reloadConfig(sender: NSMenuItem) {
4444
configLoader.reload()
4545
}
46-
46+
4747
@IBAction func showAboutPanel(sender: NSMenuItem) {
4848
NSApp.orderFrontStandardAboutPanel(sender)
4949
}
@@ -58,21 +58,21 @@ class AppDelegate: NSObject, NSApplicationDelegate {
5858
}
5959
return result
6060
}
61-
61+
6262
func handleGetURLEvent(event: NSAppleEventDescriptor?, withReplyEvent: NSAppleEventDescriptor?) {
6363
var url : NSURL = NSURL(string: event!.paramDescriptorForKeyword(AEKeyword(keyDirectObject))!.stringValue!)!
6464
let pid = event!.attributeDescriptorForKeyword(AEKeyword(keySenderPIDAttr))!.int32Value
6565
let sourceBundleIdentifier = NSRunningApplication(processIdentifier: pid)?.bundleIdentifier
66-
66+
6767
let callback = callUrlHandlers(sourceBundleIdentifier!)
68-
68+
6969
if shortUrlResolver.isShortUrl(url) {
7070
shortUrlResolver.resolveUrl(url, callback: callback)
7171
} else {
7272
callback(url: url)
7373
}
7474
}
75-
75+
7676
func callUrlHandlers(sourceBundleIdentifier: String)(url: NSURL) {
7777
let flags = getFlags()
7878
var bundleIdentifier : String! = AppDelegate.defaultBrowser
@@ -81,27 +81,27 @@ class AppDelegate: NSObject, NSApplicationDelegate {
8181
let strategy = FinickyAPI.callUrlHandlers(newUrl, sourceBundleIdentifier: sourceBundleIdentifier, flags: flags)
8282
if strategy["url"] != nil {
8383
newUrl = NSURL(string: strategy["url"]!)!
84-
84+
8585
let bundleId : String! = strategy["bundleIdentifier"] as String!
86-
86+
8787
if bundleId != nil && !bundleId.isEmpty {
8888
bundleIdentifier = strategy["bundleIdentifier"]!
8989
}
90-
90+
9191
if bundleIdentifier != nil && !bundleIdentifier.isEmpty {
9292
openUrlWithBrowser(newUrl, bundleIdentifier:bundleIdentifier)
9393
}
9494
}
9595
}
96-
96+
9797
func openUrlWithBrowser(url: NSURL, bundleIdentifier: String) {
9898
var eventDescriptor: NSAppleEventDescriptor? = NSAppleEventDescriptor()
9999
var errorInfo : NSDictionary? = nil
100100
var appleEventManager:NSAppleEventManager = NSAppleEventManager.sharedAppleEventManager()
101101
var urls = [url]
102102
NSWorkspace.sharedWorkspace().openURLs(urls, withAppBundleIdentifier: bundleIdentifier, options: NSWorkspaceLaunchOptions.Default, additionalEventParamDescriptor: nil, launchIdentifiers: nil)
103103
}
104-
104+
105105
func getFlags() -> Dictionary<String, Bool> {
106106
return [
107107
"cmd": NSEvent.modifierFlags() & .CommandKeyMask != nil,
@@ -110,16 +110,16 @@ class AppDelegate: NSObject, NSApplicationDelegate {
110110
"alt": NSEvent.modifierFlags() & .AlternateKeyMask != nil
111111
]
112112
}
113-
113+
114114
func applicationWillFinishLaunching(aNotification: NSNotification) {
115115
configLoader = FNConfigLoader()
116116
configLoader.reload()
117117
shortUrlResolver = FNShortUrlResolver()
118-
118+
119119
var appleEventManager:NSAppleEventManager = NSAppleEventManager.sharedAppleEventManager()
120120
appleEventManager.setEventHandler(self, andSelector: "handleGetURLEvent:withReplyEvent:", forEventClass: AEEventClass(kInternetEventClass), andEventID: AEEventID(kAEGetURL))
121121
}
122-
122+
123123
func applicationWillTerminate(aNotification: NSNotification) {
124124
}
125125
}

Finicky/Finicky/FNAPI.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,35 @@ import JavaScriptCore
1616
}
1717

1818
@objc class FinickyAPI : NSObject, FinickyAPIExports {
19-
19+
2020
private static var urlHandlers = Array<JSValue>()
21-
21+
2222
class func setDefaultBrowser(browser: String?) -> Void {
2323
AppDelegate.defaultBrowser = browser
2424
}
25-
25+
2626
static func log(message: String?) -> Void {
2727
if message != nil {
2828
NSLog(message!)
2929
}
3030
}
31-
31+
3232
class func onUrl(handler: JSValue) -> Void {
3333
urlHandlers.append(handler)
3434
}
35-
35+
3636
class func reset() -> Void {
3737
urlHandlers.removeAll(keepCapacity: true)
3838
}
39-
39+
4040
/**
4141
Get strategy from registered handlers
42-
42+
4343
@param originalUrl The original url that triggered finicky to start
44-
44+
4545
@param sourceBundleIdentifier Bundle identifier of the application that triggered the url to open
46-
47-
@return A dictionary keyed with "url" and "bundleIdentifier" with
46+
47+
@return A dictionary keyed with "url" and "bundleIdentifier" with
4848
the new url and bundle identifier to spawn
4949
*/
5050

@@ -53,12 +53,12 @@ import JavaScriptCore
5353
"url": originalUrl.absoluteString!,
5454
"bundleIdentifier": ""
5555
]
56-
56+
5757
var options : Dictionary<String, AnyObject> = [
5858
"sourceBundleIdentifier": sourceBundleIdentifier,
5959
"flags": flags
6060
]
61-
61+
6262
for handler in urlHandlers {
6363
let url = strategy["url"]!
6464
let val = handler.callWithArguments([url, options])
@@ -69,18 +69,18 @@ import JavaScriptCore
6969
if handlerStrategy["url"] != nil {
7070
strategy["url"] = (handlerStrategy["url"] as! String)
7171
}
72-
72+
7373
if handlerStrategy["bundleIdentifier"] != nil {
7474
strategy["bundleIdentifier"] = (handlerStrategy["bundleIdentifier"] as! String)
7575
}
76-
76+
7777
if handlerStrategy["last"] != nil {
7878
break
7979
}
8080
}
8181
}
82-
}
82+
}
8383
return strategy
8484
}
85-
85+
8686
}

Finicky/Finicky/FNConfigLoader.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ import JavaScriptCore
1212
var FNConfigPath: String = "~/.finicky.js"
1313

1414
class FNConfigLoader {
15-
15+
1616
var configPaths: NSMutableSet;
1717
var configWatcher: FNPathWatcher?;
1818
var monitor : FNPathWatcher!;
19-
19+
2020
init() {
2121
self.configPaths = NSMutableSet()
2222
}
23-
23+
2424
func resetConfigPaths() {
2525
FinickyAPI.reset()
2626
configPaths.removeAllObjects()
2727
configPaths.addObject(FNConfigPath)
2828
}
29-
29+
3030
func setupConfigWatcher() {
3131

3232
let url = NSURL(fileURLWithPath: FNConfigPath.stringByExpandingTildeInPath)!
@@ -35,34 +35,34 @@ class FNConfigLoader {
3535
})
3636
monitor.start()
3737
}
38-
38+
3939
func reload() {
4040
self.resetConfigPaths()
4141
var error:NSError?
4242
let filename: String = FNConfigPath.stringByStandardizingPath
4343
var config: String? = String(contentsOfFile: filename, encoding: NSUTF8StringEncoding, error: &error)
44-
44+
4545
if config == nil {
46-
println("Config file could not be read or found")
46+
println("Config file could not be read or found")
4747
return
4848
}
49-
49+
5050
if let theError = error {
5151
print("\(theError.localizedDescription)")
5252
}
53-
53+
5454
var ctx: JSContext = JSContext()
55-
55+
5656
ctx.exceptionHandler = {
5757
context, exception in
5858
println("JS Error: \(exception)")
5959
}
60-
60+
6161
self.setupAPI(ctx)
6262
ctx.evaluateScript(config!)
6363
setupConfigWatcher()
6464
}
65-
65+
6666
func setupAPI(ctx: JSContext) {
6767
ctx.setObject(FinickyAPI.self, forKeyedSubscript: "api")
6868
ctx.setObject(FinickyAPI.self, forKeyedSubscript: "finicky")

Finicky/Finicky/FNPathWatcher.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99
import Foundation
1010

1111
public class FNPathWatcher {
12-
12+
1313
enum State {
1414
case On, Off
1515
}
16-
16+
1717
private let source: dispatch_source_t
1818
private let descriptor: CInt
1919
private var state: State = .Off
20-
20+
2121
/// Creates a folder monitor object with monitoring enabled.
2222
public init(url: NSURL, handler: ()->Void) {
23-
23+
2424
state = .Off
2525
descriptor = open(url.fileSystemRepresentation, O_EVTONLY)
2626
let queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
@@ -35,23 +35,23 @@ public class FNPathWatcher {
3535
//dispatch_source_set_cancel_handler({})
3636
start()
3737
}
38-
38+
3939
/// Starts sending notifications if currently stopped
4040
public func start() {
4141
if state == .Off {
4242
state = .On
4343
dispatch_resume(source)
4444
}
4545
}
46-
46+
4747
/// Stops sending notifications if currently enabled
4848
public func stop() {
4949
if state == .On {
5050
state = .Off
5151
dispatch_suspend(source)
5252
}
5353
}
54-
54+
5555
deinit {
5656
close(descriptor)
5757
dispatch_source_cancel(source)

0 commit comments

Comments
 (0)