aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c_ldirs.go12
-rw-r--r--i_ui.go21
2 files changed, 25 insertions, 8 deletions
diff --git a/c_ldirs.go b/c_ldirs.go
index ceee953..468b542 100644
--- a/c_ldirs.go
+++ b/c_ldirs.go
@@ -106,3 +106,15 @@ func (ldirs *DirsList) path(node *DirsNode) string {
}
return path
}
+
+func (ldirs *DirsList) count() (uint64, uint64) {
+ curr := ldirs.head
+ var count_dirs uint64
+ var count_hosts uint64
+
+ for count_dirs = 0; curr != nil; count_dirs++ {
+ count_hosts += curr.lhost.count()
+ curr = curr.next
+ }
+ return count_dirs, count_hosts
+}
diff --git a/i_ui.go b/i_ui.go
index e63428c..ec38cf6 100644
--- a/i_ui.go
+++ b/i_ui.go
@@ -132,7 +132,7 @@ func i_bottom_text(ui HardUI) {
}
func i_draw_zhosts_box(ui HardUI) {
- text := "Hosts list empty. Add hosts by pressing (a)"
+ text := "Hosts list empty. Add hosts/folders by pressing (a/m)"
left, right :=
(ui.dim[W] / 2) - (len(text) / 2) - 5,
(ui.dim[W] / 2) + (len(text) / 2) + 5
@@ -206,7 +206,7 @@ func i_draw_delete_box(ui HardUI, host *HostNode) {
ui.def_style, "o")
}
-func i_host_panel(ui HardUI, opts HardOpts, lhost *HostList) {
+func i_host_panel(ui HardUI, opts HardOpts, ldirs *DirsList) {
i_draw_box(ui.s, 0, 0,
ui.dim[W] / 3, ui.dim[H] - 2,
" Hosts ", false)
@@ -430,7 +430,8 @@ func i_ui(data *HardData) {
var err error
ui := &data.ui
ui.s, err = tcell.NewScreen()
- ui.sel_max = data.lhost.count()
+ count_dirs, count_hosts := data.ldirs.count()
+ ui.sel_max = count_dirs + count_hosts
if err != nil {
c_die("view", err)
@@ -449,14 +450,18 @@ func i_ui(data *HardData) {
ui.dim[W], ui.dim[H], _ = term.GetSize(0)
ui.s.Clear()
i_bottom_text(*ui)
- i_host_panel(data.ui, data.opts, data.lhost)
- i_info_panel(data.ui, data.lhost)
- if data.lhost.head == nil {
+ i_host_panel(data.ui, data.opts, data.ldirs)
+ // TODO - info panel
+
+ // i_info_panel(data.ui, data.lhost)
+ if ui.sel_max == 0 {
i_draw_zhosts_box(*ui)
}
if ui.mode == DELETE_MODE {
- host := data.lhost.sel(ui.sel)
- i_draw_delete_box(*ui, host)
+ // TODO - delete mode
+
+ // host := data.lhost.sel(ui.sel)
+ // i_draw_delete_box(*ui, host)
}
ui.s.Show()
i_events(data)