Adding title to creating notification and moving title to CONST_ERROR_N_TITLE const under consts.go
This commit is contained in:
parent
715a25a6d4
commit
b51ebb0560
|
@ -12,6 +12,11 @@ const (
|
|||
cursorPosGeneralRight cursorPosConfigValue = -3
|
||||
)
|
||||
|
||||
const (
|
||||
CONST_MESSAGE_LEN = 1024
|
||||
CONST_ERROR_N_TITLE = "ERROR"
|
||||
)
|
||||
|
||||
const (
|
||||
footerStart = "State: "
|
||||
)
|
||||
|
|
|
@ -18,8 +18,7 @@ func centerText(width int, text string) string {
|
|||
)
|
||||
}
|
||||
|
||||
func createNotification(message string) (notifier, error) {
|
||||
title := "ERROR"
|
||||
func createNotification(message, title string) (notifier, error) {
|
||||
var buf string
|
||||
width, height := UI.getSizes()
|
||||
if width == 0 {
|
||||
|
|
|
@ -144,8 +144,8 @@ func (t *TUI) Run() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (t *TUI) createNotification(text string) {
|
||||
notifier, err := createNotification(text)
|
||||
func (t *TUI) createNotification(text, title string) {
|
||||
notifier, err := createNotification(text, title)
|
||||
t.selectedNotifier = ¬ifier
|
||||
t.errors <- err
|
||||
t.errors <- t.write(notifier.Buf)
|
||||
|
@ -159,7 +159,7 @@ func (t *TUI) setRoutines() error {
|
|||
go func() {
|
||||
for err := range t.errors {
|
||||
if err != nil {
|
||||
t.createNotification(err.Error())
|
||||
t.createNotification(err.Error(), CONST_ERROR_N_TITLE)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
@ -183,6 +183,7 @@ func (t *TUI) setRoutines() error {
|
|||
}
|
||||
go func() {
|
||||
for message := range t.messageChannel {
|
||||
t.createNotification(string(message), "Message!")
|
||||
}
|
||||
}()
|
||||
go func() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user