From 4991c2cdc41c792b0ffad37592dbaaeb78a37609 Mon Sep 17 00:00:00 2001 From: Charlie Qiu Date: Sun, 12 Jun 2016 08:03:27 +0800 Subject: [PATCH] Add new menu item: "Apply User Rules For PAC" --- ShadowsocksX-NG/AppDelegate.swift | 15 +++++++++++++++ ShadowsocksX-NG/Base.lproj/MainMenu.xib | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/ShadowsocksX-NG/AppDelegate.swift b/ShadowsocksX-NG/AppDelegate.swift index d13ec44..f44be5a 100644 --- a/ShadowsocksX-NG/AppDelegate.swift +++ b/ShadowsocksX-NG/AppDelegate.swift @@ -173,6 +173,21 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele NSWorkspace.sharedWorkspace().openURL(url) } + @IBAction func applyUserRulesForPAC(sender: NSMenuItem) { + if GeneratePACFile() { + // Popup a user notification + let notification = NSUserNotification() + notification.title = "PAC has been updated by User Rules.".localized + NSUserNotificationCenter.defaultUserNotificationCenter() + .deliverNotification(notification) + } else { + let notification = NSUserNotification() + notification.title = "It's failed to update PAC by User Rules.".localized + NSUserNotificationCenter.defaultUserNotificationCenter() + .deliverNotification(notification) + } + } + @IBAction func showQRCodeForCurrentServer(sender: NSMenuItem) { var errMsg: String? let mgr = ServerProfileManager() diff --git a/ShadowsocksX-NG/Base.lproj/MainMenu.xib b/ShadowsocksX-NG/Base.lproj/MainMenu.xib index 8d214d5..9849699 100644 --- a/ShadowsocksX-NG/Base.lproj/MainMenu.xib +++ b/ShadowsocksX-NG/Base.lproj/MainMenu.xib @@ -90,6 +90,12 @@ + + + + + +