summaryrefslogtreecommitdiffstats
path: root/src/curses-ui/message_box.vala
diff options
context:
space:
mode:
authorHolger Cremer <HolgerCremer@gmail.com>2015-06-10 22:23:24 +0200
committerHolger Cremer <HolgerCremer@gmail.com>2015-06-10 22:23:24 +0200
commit609f72b68df7d8c5a029d5faf1867ef68a5ff6ef (patch)
treefa545c306893ecdee61e23a6707e6b70d15694de /src/curses-ui/message_box.vala
parentc2b6e54ba93bb2f28e65626417e2cee29f8eec64 (diff)
downloadserial-barcode-scanner-609f72b68df7d8c5a029d5faf1867ef68a5ff6ef.tar.bz2
show a popup for invalid product or missing login
Diffstat (limited to 'src/curses-ui/message_box.vala')
-rw-r--r--src/curses-ui/message_box.vala11
1 files changed, 10 insertions, 1 deletions
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();
}