From ab0cc2c6065f758f323b177674f020b6be7296e9 Mon Sep 17 00:00:00 2001
From: Frederic Culot <calcurse@culot.org>
Date: Mon, 23 Jul 2007 19:26:38 +0000
Subject: exit_calcurse() added and status_bar() modified to use wins_slctd()

---
 src/utils.c | 16 ++++++++++++++--
 src/utils.h |  5 +++--
 2 files changed, 17 insertions(+), 4 deletions(-)

(limited to 'src')

diff --git a/src/utils.c b/src/utils.c
index f2213b8..ed620fd 100755
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,4 +1,4 @@
-/*	$calcurse: utils.c,v 1.31 2007/07/21 19:33:24 culot Exp $	*/
+/*	$calcurse: utils.c,v 1.32 2007/07/23 19:26:38 culot Exp $	*/
 
 /*
  * Calcurse - text-based organizer
@@ -42,6 +42,16 @@
 
 static unsigned status_page;
 
+/* General routine to exit calcurse properly. */
+void 
+exit_calcurse(void)
+{
+	endwin();
+	erase();
+	calendar_stop_date_thread();
+	exit(EXIT_SUCCESS);
+}
+
 /* 
  * Print a message in the status bar.
  * Message texts for first line and second line are to be provided.
@@ -383,8 +393,9 @@ border_nocolor(WINDOW *window)
  * utils.h, depending on which panel the added keybind is assigned to.
  */
 void 
-status_bar(int which_pan)
+status_bar(void)
 {
+	window_e which_pan;
 	int cmd_length, space_between_cmds, start, end, i, j = 0;
 	const int pos[NB_PANELS + 1] = 
 		{0, NB_CAL_CMDS, NB_CAL_CMDS + NB_APP_CMDS, TOTAL_CMDS};
@@ -434,6 +445,7 @@ status_bar(int which_pan)
 
 	/* Drawing the keybinding with attribute and label without. */
 	erase_status_bar();
+	which_pan = wins_slctd();
 	start = pos[which_pan] + 2*CMDS_PER_LINE*(status_page - 1);
 	end = MIN(start + 2*CMDS_PER_LINE, pos[which_pan + 1]);
 	for (i = start; i < end; i += 2) {
diff --git a/src/utils.h b/src/utils.h
index 8de9849..6e7ff1a 100755
--- a/src/utils.h
+++ b/src/utils.h
@@ -1,4 +1,4 @@
-/*	$calcurse: utils.h,v 1.20 2007/07/21 19:33:24 culot Exp $	*/
+/*	$calcurse: utils.h,v 1.21 2007/07/23 19:26:38 culot Exp $	*/
 
 /*
  * Calcurse - text-based organizer
@@ -53,6 +53,7 @@ typedef struct { /* structure defining a keybinding */
 	char *label;
 } binding_t;
 
+void	exit_calcurse(void);
 void 	status_mesg(char *, char *);
 void	erase_status_bar(void);
 void 	erase_window_part(WINDOW *, int, int, int, int);
@@ -67,7 +68,7 @@ int 	updatestring(WINDOW *, char **, int, int);
 int 	is_all_digit(char *);
 void 	border_color(WINDOW *);
 void 	border_nocolor(WINDOW *);
-void 	status_bar(int);
+void 	status_bar(void);
 long 	date2sec(date_t, unsigned, unsigned);
 char   *date_sec2hour_str(long);
 char   *date_sec2date_str(long);
-- 
cgit v1.2.3-70-g09d2