diff --git a/config.go b/config.go index 516bfa3..d717b11 100644 --- a/config.go +++ b/config.go @@ -14,14 +14,14 @@ type config struct { Threshold int DisplayMonitorSources bool EnableUpdates bool - LastUsedInput *string + LastUsedInput string } const configFile = "config.toml" func initializeConfigIfNot() { log.Println("Checking if config needs to be initialized") - conf := config{Threshold: 95, DisplayMonitorSources: false, EnableUpdates: true, LastUsedInput: nil} // if you're a package maintainer and you mess with this, we have a problem. + conf := config{Threshold: 95, DisplayMonitorSources: false, EnableUpdates: true, LastUsedInput: ""} // if you're a package maintainer and you mess with this, we have a problem. // Unless you set -tags release on the build the updater is *not* compiled in any. DO NOT MESS WITH THIS! // This isn't and never was the proper location to disable the updater. diff --git a/main.go b/main.go index 6e9b8b6..a46e7e7 100644 --- a/main.go +++ b/main.go @@ -244,11 +244,11 @@ func paConnectionWatchdog(ctx *ntcontext) { func getSourcesWithPreSelectedInput(ctx *ntcontext) []input { inputs := getSources(ctx.paClient) - preselectedInputId := ctx.config.LastUsedInput + preselectedInputID := &ctx.config.LastUsedInput inputExists := false - if preselectedInputId != nil { + if preselectedInputID != nil { for _, input := range inputs { - inputExists = inputExists || input.ID == *preselectedInputId + inputExists = inputExists || input.ID == *preselectedInputID } } @@ -257,12 +257,12 @@ func getSourcesWithPreSelectedInput(ctx *ntcontext) []input { if err != nil { log.Printf("Failed to load default source: %+v\n", err) } else { - preselectedInputId = &defaultSource + preselectedInputID = &defaultSource } } - if preselectedInputId != nil { + if preselectedInputID != nil { for i := range inputs { - if inputs[i].ID == *preselectedInputId { + if inputs[i].ID == *preselectedInputID { inputs[i].checked = true } } diff --git a/ui.go b/ui.go index dcda581..53d5133 100644 --- a/ui.go +++ b/ui.go @@ -202,7 +202,7 @@ func updatefn(ctx *ntcontext, w *nucular.Window) { time.Sleep(time.Millisecond * 500) } } - ctx.config.LastUsedInput = &inp.ID + ctx.config.LastUsedInput = inp.ID go writeConfig(ctx.config) ctx.loadingScreen = false (*ctx.masterWindow).Changed()