diff options
Diffstat (limited to 'gui/internal/ui/plan.go')
| -rw-r--r-- | gui/internal/ui/plan.go | 27 |
1 files changed, 27 insertions, 0 deletions
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()) |
