summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2018-11-29 13:55:27 +0100
committerRuben Pollan <meskio@sindominio.net>2018-11-29 13:55:27 +0100
commit59daf6c6ed64d58e8903db35637527fa46ed9c94 (patch)
treef75274c4a8a8faa6b1a2b11a52314bf1c8db44bc
parent1e55f578d2682ea1ebad17e9035ab7f7fbd7f091 (diff)
[feat] don't need the cancel button
We can do just with two buttons and changing the names.
-rw-r--r--systray.go20
-rw-r--r--transifex/messages.json1
2 files changed, 5 insertions, 16 deletions
diff --git a/systray.go b/systray.go
index 4e4e3d5..a37c0e8 100644
--- a/systray.go
+++ b/systray.go
@@ -37,7 +37,6 @@ type bmTray struct {
mTurnOn *systray.MenuItem
mTurnOff *systray.MenuItem
mDonate *systray.MenuItem
- mCancel *systray.MenuItem
activeGateway *gatewayTray
autostart autostart
}
@@ -75,8 +74,6 @@ func (bt *bmTray) onReady() {
bt.mTurnOn.Hide()
bt.mTurnOff = systray.AddMenuItem(printer.Sprintf("Turn off"), "")
bt.mTurnOff.Hide()
- bt.mCancel = systray.AddMenuItem(printer.Sprintf("Cancel"), printer.Sprintf("Cancel connection to %s", applicationName))
- bt.mCancel.Hide()
systray.AddSeparator()
if bt.conf.SelectGateway {
@@ -114,11 +111,6 @@ func (bt *bmTray) onReady() {
bt.changeStatus("stopping")
bt.bm.StopVPN()
bt.conf.setUserStoppedVPN(true)
- case <-bt.mCancel.ClickedCh:
- log.Println("cancel")
- bt.changeStatus("stopping")
- bt.bm.StopVPN()
- bt.conf.setUserStoppedVPN(true)
case <-mHelp.ClickedCh:
open.Run("https://riseup.net/vpn/support")
@@ -195,7 +187,6 @@ func (bt *bmTray) addGateways() {
}
func (bt *bmTray) changeStatus(status string) {
- bt.mTurnOn.SetTitle(printer.Sprintf("Turn on"))
if bt.waitCh != nil {
bt.waitCh <- true
bt.waitCh = nil
@@ -205,25 +196,25 @@ func (bt *bmTray) changeStatus(status string) {
switch status {
case "on":
systray.SetIcon(icon.On)
+ bt.mTurnOff.SetTitle(printer.Sprintf("Turn off"))
statusStr = printer.Sprintf("%s on", applicationName)
bt.mTurnOn.Hide()
bt.mTurnOff.Show()
- bt.mCancel.Hide()
case "off":
systray.SetIcon(icon.Off)
+ bt.mTurnOn.SetTitle(printer.Sprintf("Turn on"))
statusStr = printer.Sprintf("%s off", applicationName)
bt.mTurnOn.Show()
bt.mTurnOff.Hide()
- bt.mCancel.Hide()
case "starting":
bt.waitCh = make(chan bool)
go bt.waitIcon()
+ bt.mTurnOff.SetTitle(printer.Sprintf("Cancel"))
statusStr = printer.Sprintf("Connecting to %s", applicationName)
bt.mTurnOn.Hide()
- bt.mTurnOff.Hide()
- bt.mCancel.Show()
+ bt.mTurnOff.Show()
case "stopping":
bt.waitCh = make(chan bool)
@@ -231,15 +222,14 @@ func (bt *bmTray) changeStatus(status string) {
statusStr = printer.Sprintf("Stopping %s", applicationName)
bt.mTurnOn.Hide()
bt.mTurnOff.Hide()
- bt.mCancel.Hide()
case "failed":
systray.SetIcon(icon.Blocked)
bt.mTurnOn.SetTitle(printer.Sprintf("Retry"))
+ bt.mTurnOff.SetTitle(printer.Sprintf("Turn off"))
statusStr = printer.Sprintf("%s blocking internet", applicationName)
bt.mTurnOn.Show()
bt.mTurnOff.Show()
- bt.mCancel.Hide()
}
systray.SetTooltip(statusStr)
diff --git a/transifex/messages.json b/transifex/messages.json
index f332f74..19610a8 100644
--- a/transifex/messages.json
+++ b/transifex/messages.json
@@ -2,7 +2,6 @@
"About": "About",
"About...": "About...",
"Cancel": "Cancel",
- "Cancel connection to {ApplicationName}": "Cancel connection to {ApplicationName}",
"Checking status...": "Checking status...",
"Connecting to {ApplicationName}": "Connecting to {ApplicationName}",
"Donate": "Donate",