Skip to content
Snippets Groups Projects
Unverified Commit 59daf6c6 authored by meskio's avatar meskio :tent:
Browse files

[feat] don't need the cancel button

We can do just with two buttons and changing the names.
parent 1e55f578
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -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",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment