change pointer struct member to regular string

pull/71/head
lawl 3 years ago
parent 43b50806e7
commit b6b8d8eb3c

@ -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.

@ -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
}
}

@ -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()

Loading…
Cancel
Save