aboutsummaryrefslogtreecommitdiffstats
path: root/src/i_ui.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-02-01 20:20:20 +0100
committerJoe <rbo@gmx.us>2024-02-01 20:20:20 +0100
commit2601e660db5ffb7a57e2496c24f9bbb52a0158f3 (patch)
tree1b5144ee08df2f2066c039e43c4bafe8786421d9 /src/i_ui.go
parentuseless changes (diff)
downloadhardflip-2601e660db5ffb7a57e2496c24f9bbb52a0158f3.tar.gz
hardflip-2601e660db5ffb7a57e2496c24f9bbb52a0158f3.tar.bz2
hardflip-2601e660db5ffb7a57e2496c24f9bbb52a0158f3.tar.xz
hardflip-2601e660db5ffb7a57e2496c24f9bbb52a0158f3.tar.zst
hardflip-2601e660db5ffb7a57e2496c24f9bbb52a0158f3.zip
conf
Diffstat (limited to '')
-rw-r--r--src/i_ui.go23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/i_ui.go b/src/i_ui.go
index 69563e0..7d25d93 100644
--- a/src/i_ui.go
+++ b/src/i_ui.go
@@ -321,21 +321,23 @@ func i_draw_load_ui(ui *HardUI) {
func i_load_ui(data_dir string,
opts HardOpts,
- ui *HardUI) (*DirsList, *ItemsList, []error) {
+ ui *HardUI,
+ load_err *[]error) (*DirsList, *ItemsList, []error) {
ui.mode = LOAD_MODE
- ldirs, load_err := c_load_data_dir(data_dir, opts, ui)
+ ldirs := c_load_data_dir(data_dir, opts, ui, load_err)
litems := c_load_litems(ldirs)
if ui.mode != ERROR_MODE {
ui.mode = NORMAL_MODE
}
- if len(load_err) == 0 {
- load_err = nil
+ if len(*load_err) == 0 {
+ *load_err = nil
}
- return ldirs, litems, load_err
+ return ldirs, litems, *load_err
}
-func i_ui(data_dir string, opts HardOpts) {
+func i_ui(data_dir string) {
ui := HardUI{}
+ opts := HardOpts{}
var err error
ui.s, err = tcell.NewScreen()
@@ -368,7 +370,14 @@ func i_ui(data_dir string, opts HardOpts) {
Foreground(tcell.ColorBlue).Dim(true)
ui.s.SetStyle(ui.style[STYLE_DEF])
ui.dim[W], ui.dim[H], _ = term.GetSize(0)
- ldirs, litems, load_err := i_load_ui(data_dir, opts, &ui)
+ var load_err []error
+ conf_dir := c_get_conf_dir(&load_err)
+ if conf_dir == "" {
+ opts = DEFAULT_OPTS
+ } else {
+ opts = c_get_options(conf_dir, &load_err)
+ }
+ ldirs, litems, load_err := i_load_ui(data_dir, opts, &ui, &load_err)
data := HardData{
litems,
ldirs,