From 609f72b68df7d8c5a029d5faf1867ef68a5ff6ef Mon Sep 17 00:00:00 2001 From: Holger Cremer Date: Wed, 10 Jun 2015 22:23:24 +0200 Subject: show a popup for invalid product or missing login --- src/curses-ui/message_box.vala | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/curses-ui/message_box.vala') diff --git a/src/curses-ui/message_box.vala b/src/curses-ui/message_box.vala index cc258b4..e786517 100644 --- a/src/curses-ui/message_box.vala +++ b/src/curses-ui/message_box.vala @@ -20,6 +20,10 @@ public class MessageBox { Window subwin; DateTime last; + public const short INFO_COLOR = 5; + public const short WARN_COLOR = 6; + public const short ERROR_COLOR = 7; + public MessageBox() { win = new Window(LINES-9, COLS - 2, 8, 1); win.bkgdset(COLOR_PAIR(0)); @@ -34,9 +38,13 @@ public class MessageBox { subwin.refresh(); last = new DateTime.from_unix_utc(0); + + init_pair (INFO_COLOR, Color.WHITE, Color.BLACK); + init_pair (WARN_COLOR, Color.YELLOW, Color.BLACK); + init_pair (ERROR_COLOR, Color.RED, Color.BLACK); } - public void add(string msg) { + public void add(string msg, short color_pair = MessageBox.INFO_COLOR) { var now = new DateTime.now_local(); if(now.get_day_of_year() != last.get_day_of_year() || now.get_year() != last.get_year()) { @@ -47,6 +55,7 @@ public class MessageBox { last = now; string curtime = now.format("%H:%M:%S"); + subwin.bkgdset(COLOR_PAIR(color_pair)); subwin.addstr("\n[" + curtime + "] " + msg); subwin.refresh(); } -- cgit v1.2.3