From 96b858b8bcb8ddb9a7938c08d2e9577545e85bfd Mon Sep 17 00:00:00 2001 From: Frederic Culot Date: Sat, 20 Sep 2008 12:47:06 +0000 Subject: More work on ical import. Macros to handle errors and to display messages in both command-line and curses mode added --- src/utils.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index 9d96ff4..a2107b0 100755 --- a/src/utils.c +++ b/src/utils.c @@ -1,4 +1,4 @@ -/* $calcurse: utils.c,v 1.49 2008/09/15 20:40:22 culot Exp $ */ +/* $calcurse: utils.c,v 1.50 2008/09/20 12:47:06 culot Exp $ */ /* * Calcurse - text-based organizer @@ -48,6 +48,7 @@ exit_calcurse (int status) clear (); refresh (); endwin (); + ui_mode = UI_CMDLINE; calendar_stop_date_thread (); exit (status); } @@ -95,6 +96,29 @@ aerror (const char *file, int line, const char *assertion) ierror (errmsg, IERROR_FATAL); } +void +warnbox (const char *msg) +{ + const int WINCOL = col - 2; + const int WINROW = 10; + const int MSGLEN = WINCOL - 2; + WINDOW *warnwin; + char displmsg[MSGLEN]; + + if (msg == NULL) + return; + strncpy (displmsg, msg, MSGLEN); + warnwin = popup (WINROW, WINCOL, (row - WINROW) / 2, (col - WINCOL) / 2, + "/!\\"); + custom_apply_attr (warnwin, ATTR_HIGHEST); + mvwprintw (warnwin, 5, (WINCOL - strlen (displmsg)) / 2, "%s", displmsg); + custom_remove_attr (warnwin, ATTR_HIGHEST); + wrefresh (warnwin); + wgetch (warnwin); + delwin (warnwin); + doupdate (); +} + /* * Print a message in the status bar. * Message texts for first line and second line are to be provided. -- cgit v1.2.3-54-g00ecf