aboutsummaryrefslogtreecommitdiffstats
path: root/i_ui.go
diff options
context:
space:
mode:
Diffstat (limited to 'i_ui.go')
-rw-r--r--i_ui.go40
1 files changed, 20 insertions, 20 deletions
diff --git a/i_ui.go b/i_ui.go
index d6c3c63..0ac7e60 100644
--- a/i_ui.go
+++ b/i_ui.go
@@ -57,12 +57,11 @@ import (
type HardUI struct {
s tcell.Screen
list_start int
- delete_mode bool
+ mode uint8
delete_id uint64
sel uint64
sel_max uint64
def_style tcell.Style
- bot_style tcell.Style
dim [2]int
}
@@ -144,6 +143,23 @@ func i_draw_zhosts_box(ui HardUI) {
ui.def_style, text)
}
+func i_draw_delete_box(ui HardUI, host *HostNode) {
+ // file_path := data.data_dir + "/" + host.Folder + host.Filename
+ text := "Do you really want to delete host " +
+ host.Folder + host.Filename + "?"
+ left, right :=
+ (ui.dim[W] / 2) - (len(text) / 2) - 5,
+ (ui.dim[W] / 2) + (len(text) / 2) + 5
+ top, bot :=
+ (ui.dim[H] / 2) - 3,
+ (ui.dim[H] / 2) + 3
+ i_draw_box(ui.s, left, top, right, bot, "")
+ // if err := os.Remove(file_path); err != nil {
+ // c_die("can't remove " + file_path, err)
+ // }
+ // i_reload_data(data, sel, sel_max)
+}
+
func i_host_panel(ui HardUI, lhost *HostList) {
i_draw_box(ui.s, 0, 0,
ui.dim[W] / 3, ui.dim[H] - 2,
@@ -377,9 +393,6 @@ func i_ui(data *HardData) {
ui.def_style = tcell.StyleDefault.
Background(tcell.ColorReset).
Foreground(tcell.ColorReset)
- ui.bot_style = tcell.StyleDefault.
- Background(tcell.ColorReset).
- Foreground(tcell.ColorGrey)
ui.s.SetStyle(ui.def_style)
for {
ui.dim[W], ui.dim[H], _ = term.GetSize(0)
@@ -390,22 +403,9 @@ func i_ui(data *HardData) {
if data.lhost.head == nil {
i_draw_zhosts_box(*ui)
}
- if ui.delete_mode == true {
+ if ui.mode == DELETE_MODE {
host := data.lhost.sel(ui.sel)
- // file_path := data.data_dir + "/" + host.Folder + host.Filename
- text := "Do you really want to delete host " +
- host.Folder + host.Filename + "?"
- left, right :=
- (ui.dim[W] / 2) - (len(text) / 2) - 5,
- (ui.dim[W] / 2) + (len(text) / 2) + 5
- top, bot :=
- (ui.dim[H] / 2) - 3,
- (ui.dim[H] / 2) + 3
- i_draw_box(ui.s, left, top, right, bot, text)
- // if err := os.Remove(file_path); err != nil {
- // c_die("can't remove " + file_path, err)
- // }
- // i_reload_data(data, sel, sel_max)
+ i_draw_delete_box(*ui, host)
}
ui.s.Show()
i_events(data)