aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/aerc.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-02-01 00:08:47 +0100
committerRobin Jarry <robin@jarry.cc>2023-02-02 21:50:49 +0100
commitb638f3fa8f5c3bc48d578d3109c2235e7023e07f (patch)
tree3500fe6a985820496d286e857e5749d7798bb159 /widgets/aerc.go
parentc10cb370bb943fa6bb6a947e0a515674f1ee1958 (diff)
downloadaerc-b638f3fa8f5c3bc48d578d3109c2235e7023e07f.tar.gz
config: warn for all deprecated settings
index-format may be used in contextual [ui] sections. Display a warning for every converted section so that users don't miss any. Fixes: 535300cfdbfc ("config: add columns based index format") Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Diffstat (limited to 'widgets/aerc.go')
-rw-r--r--widgets/aerc.go43
1 files changed, 22 insertions, 21 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go
index f1e512f3..e8d65539 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -126,31 +126,32 @@ func NewAerc(
}
}
- if config.Ui.IndexFormat != "" {
- ini := config.ColumnDefsToIni(
- config.Ui.IndexColumns, "index-columns")
- title := "DEPRECATION WARNING"
- text := `
-The index-format setting is deprecated. It has been replaced by index-columns.
-
-Your configuration in this instance was automatically converted to:
-
-[ui]
-` + ini + `
-Your configuration file was not changed. To make this change permanent and to
-dismiss this deprecation warning on launch, copy the above lines into aerc.conf
-and remove index-format from it. See aerc-config(5) for more details.
-
-index-format will be removed in aerc 0.17.
-`
- aerc.AddDialog(NewSelectorDialog(
- title, text, []string{"OK"}, 0,
+ aerc.showConfigWarnings()
+
+ return aerc
+}
+
+func (aerc *Aerc) showConfigWarnings() {
+ var dialogs []ui.DrawableInteractive
+
+ callback := func(string, error) {
+ aerc.CloseDialog()
+ if len(dialogs) > 0 {
+ d := dialogs[0]
+ dialogs = dialogs[1:]
+ aerc.AddDialog(d)
+ }
+ }
+
+ for _, w := range config.Warnings {
+ dialogs = append(dialogs, NewSelectorDialog(
+ w.Title, w.Body, []string{"OK"}, 0,
aerc.SelectedAccountUiConfig(),
- func(string, error) { aerc.CloseDialog() },
+ callback,
))
}
- return aerc
+ callback("", nil)
}
func (aerc *Aerc) OnBeep(f func() error) {