From 48d1781fed3f9ea5cfd2b270bd92fd2826605636 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Thu, 17 Sep 2026 10:56:19 +0200 Subject: gui: conditions as a nested tree, and a way to add a directory --- gui/internal/ui/plan.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'gui/internal/ui/plan.go') diff --git a/gui/internal/ui/plan.go b/gui/internal/ui/plan.go index 0a9b718..0adc6b1 100644 --- a/gui/internal/ui/plan.go +++ b/gui/internal/ui/plan.go @@ -469,6 +469,33 @@ func (p *planView) showPath() { p.path.SetText("no directory is included; add one with: krino new NAME PATH") } +// currentName is the directory the picker names, "" when none. +func (p *planView) currentName() string { + if d := p.currentDir(); d != nil { + return d.Name + } + return "" +} + +// refreshDirs rebuilds the directory picker after the configuration +// changed - a directory added in the Rules tab appears here too. +func (p *planView) refreshDirs(keep string) { + names := make([]string, len(p.w.engine.Dirs)) + for i, d := range p.w.engine.Dirs { + names[i] = d.Name + } + if len(names) == 0 { + names = []string{"none"} + } + p.dirs.SetModel(gtk.NewStringList(names)) + for i, d := range p.w.engine.Dirs { + if d.Name == keep { + p.dirs.SetSelected(uint(i)) + } + } + p.showPath() +} + // currentDir is the directory the picker names. func (p *planView) currentDir() *engine.Dir { i := int(p.dirs.Selected()) -- cgit v1.3