summaryrefslogtreecommitdiff
path: root/pkg/systray/run.go
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2019-01-15 17:19:19 +0100
committerRuben Pollan <meskio@sindominio.net>2019-01-15 17:26:06 +0100
commit52d7fa7c91dd5bad49f07e33956681b5e341c6fa (patch)
tree0cd14b39203ef5652ee2c76ac27320db4abb4ef8 /pkg/systray/run.go
parent80b6aef1206fb63f1a2985f003f6b484a23bb949 (diff)
[feat] move provider configuration into a set of constants
Diffstat (limited to 'pkg/systray/run.go')
-rw-r--r--pkg/systray/run.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/pkg/systray/run.go b/pkg/systray/run.go
index 0457ed4..73dc853 100644
--- a/pkg/systray/run.go
+++ b/pkg/systray/run.go
@@ -23,13 +23,13 @@ import (
"0xacab.org/leap/bitmask-systray/pkg/config"
)
-func Run(conf *SystrayConfig) {
+func Run(conf *Config) {
bt := bmTray{conf: conf}
go initialize(conf, &bt)
bt.start()
}
-func initialize(conf *SystrayConfig, bt *bmTray) {
+func initialize(conf *Config, bt *bmTray) {
if _, err := os.Stat(config.Path); os.IsNotExist(err) {
os.MkdirAll(config.Path, os.ModePerm)
}
@@ -51,7 +51,7 @@ func initialize(conf *SystrayConfig, bt *bmTray) {
go checkAndStartBitmask(b, notify, conf)
go listenSignals(b)
- as := bitmask.NewAutostart(conf.ApplicationName, getIconPath())
+ as := bitmask.NewAutostart(config.ApplicationName, getIconPath())
err = as.Enable()
if err != nil {
log.Printf("Error enabling autostart: %v", err)
@@ -59,7 +59,7 @@ func initialize(conf *SystrayConfig, bt *bmTray) {
bt.loop(b, notify, as)
}
-func checkAndStartBitmask(b bitmask.Bitmask, notify *notificator, conf *SystrayConfig) {
+func checkAndStartBitmask(b bitmask.Bitmask, notify *notificator, conf *Config) {
err := checkAndInstallHelpers(b, notify)
if err != nil {
log.Printf("Is bitmask running? %v", err)
@@ -92,12 +92,12 @@ func checkAndInstallHelpers(b bitmask.Bitmask, notify *notificator) error {
return nil
}
-func maybeStartVPN(b bitmask.Bitmask, conf *SystrayConfig) error {
+func maybeStartVPN(b bitmask.Bitmask, conf *Config) error {
if conf.UserStoppedVPN {
return nil
}
- err := b.StartVPN(conf.Provider)
+ err := b.StartVPN(config.Provider)
conf.setUserStoppedVPN(false)
return err
}