From 33a093950eb2b1a62957826baa77547ca18de293 Mon Sep 17 00:00:00 2001 From: Charlie Qiu Date: Thu, 9 Jun 2016 05:44:18 +0800 Subject: [PATCH] Rename is_valid to isValid --- ShadowsocksX-NG/AppDelegate.swift | 10 +++++++++- ShadowsocksX-NG/PreferencesWindowController.swift | 6 +++--- ShadowsocksX-NG/ServerProfile.swift | 2 +- ShadowsocksX-NG/ServerProfileManager.swift | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ShadowsocksX-NG/AppDelegate.swift b/ShadowsocksX-NG/AppDelegate.swift index b5e920e..a619ca9 100644 --- a/ShadowsocksX-NG/AppDelegate.swift +++ b/ShadowsocksX-NG/AppDelegate.swift @@ -145,6 +145,14 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele } + @IBAction func selectPACMode(sender: NSMenuItem) { + + } + + @IBAction func selectGlobalMode(sender: NSMenuItem) { + + } + @IBAction func editServerPreferences(sender: NSMenuItem) { if preferencesWinCtrl != nil { preferencesWinCtrl.close() @@ -212,7 +220,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele if mgr.activeProfileId == p.uuid { item.state = 1 } - if !p.is_valid() { + if !p.isValid() { item.enabled = false } item.action = #selector(AppDelegate.selectServer) diff --git a/ShadowsocksX-NG/PreferencesWindowController.swift b/ShadowsocksX-NG/PreferencesWindowController.swift index 66c15e9..c33334e 100644 --- a/ShadowsocksX-NG/PreferencesWindowController.swift +++ b/ShadowsocksX-NG/PreferencesWindowController.swift @@ -55,7 +55,7 @@ class PreferencesWindowController: NSWindowController } @IBAction func addProfile(sender: NSButton) { - if editingProfile != nil && !editingProfile.is_valid(){ + if editingProfile != nil && !editingProfile.isValid(){ return } profilesTableView.beginUpdates() @@ -85,7 +85,7 @@ class PreferencesWindowController: NSWindowController @IBAction func ok(sender: NSButton) { if editingProfile != nil { - if !editingProfile.is_valid() { + if !editingProfile.isValid() { // TODO Shake window? return } @@ -190,7 +190,7 @@ class PreferencesWindowController: NSWindowController return true } if editingProfile != nil { - if !editingProfile.is_valid() { + if !editingProfile.isValid() { return false } } diff --git a/ShadowsocksX-NG/ServerProfile.swift b/ShadowsocksX-NG/ServerProfile.swift index 994d31e..fa8e913 100644 --- a/ShadowsocksX-NG/ServerProfile.swift +++ b/ShadowsocksX-NG/ServerProfile.swift @@ -76,7 +76,7 @@ class ServerProfile: NSObject { return conf } - func is_valid() -> Bool { + func isValid() -> Bool { func validateIpAddress(ipToValidate: String) -> Bool { var sin = sockaddr_in() diff --git a/ShadowsocksX-NG/ServerProfileManager.swift b/ShadowsocksX-NG/ServerProfileManager.swift index d75e203..1a39312 100644 --- a/ShadowsocksX-NG/ServerProfileManager.swift +++ b/ShadowsocksX-NG/ServerProfileManager.swift @@ -36,7 +36,7 @@ class ServerProfileManager: NSObject { let defaults = NSUserDefaults.standardUserDefaults() var _profiles = [AnyObject]() for profile in profiles { - if profile.is_valid() { + if profile.isValid() { let _profile = profile.toDictionary() _profiles.append(_profile) }