aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils.c
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2008-09-20 12:47:06 +0000
committerFrederic Culot <calcurse@culot.org>2008-09-20 12:47:06 +0000
commit96b858b8bcb8ddb9a7938c08d2e9577545e85bfd (patch)
tree116c0e30a2cba24eccf29727b21547978d754b47 /src/utils.c
parent62077a18f5ca760dc7798470ca4c457f905c7cd5 (diff)
downloadcalcurse-96b858b8bcb8ddb9a7938c08d2e9577545e85bfd.tar.gz
calcurse-96b858b8bcb8ddb9a7938c08d2e9577545e85bfd.zip
More work on ical import. Macros to handle errors and to display messages in both command-line and curses mode added
Diffstat (limited to 'src/utils.c')
-rwxr-xr-xsrc/utils.c26
1 files changed, 25 insertions, 1 deletions
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.