code cleanup

This commit is contained in:
Frederic Culot 2009-01-02 22:28:53 +00:00
parent aa7d6c5eb7
commit bf3bce0ab2
11 changed files with 211 additions and 236 deletions

View File

@ -3,6 +3,10 @@
* src/io.c (io_stop_pthread_save): do not crash when canceling the * src/io.c (io_stop_pthread_save): do not crash when canceling the
thread if it was not started before thread if it was not started before
* src/vars.c (vars_free): suppressed
* src/notify.c (notify_free_vars, notify_free_bar): suppressed
2009-01-01 Frederic Culot <frederic@culot.org> 2009-01-01 Frederic Culot <frederic@culot.org>
* src/event.c (event_free_bkp, event_llist_free): new functions * src/event.c (event_free_bkp, event_llist_free): new functions

View File

@ -1,4 +1,4 @@
/* $calcurse: apoint.c,v 1.31 2009/01/02 19:52:32 culot Exp $ */ /* $calcurse: apoint.c,v 1.32 2009/01/02 22:28:54 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -324,8 +324,8 @@ apoint_delete (conf_t *conf, unsigned *nb_events, unsigned *nb_apoints)
if (hilt > 1) if (hilt > 1)
hilt--; hilt--;
if (apad->first_onscreen >= to_be_removed) if (apad.first_onscreen >= to_be_removed)
apad->first_onscreen = apad->first_onscreen - to_be_removed; apad.first_onscreen = apad.first_onscreen - to_be_removed;
if (nb_items == 1) if (nb_items == 1)
hilt = 0; hilt = 0;
} }
@ -362,8 +362,8 @@ apoint_cut (unsigned *nb_events, unsigned *nb_apoints)
if (hilt > 1) if (hilt > 1)
hilt--; hilt--;
if (apad->first_onscreen >= to_be_removed) if (apad.first_onscreen >= to_be_removed)
apad->first_onscreen = apad->first_onscreen - to_be_removed; apad.first_onscreen = apad.first_onscreen - to_be_removed;
if (NBITEMS == 1) if (NBITEMS == 1)
hilt = 0; hilt = 0;
} }
@ -592,9 +592,9 @@ apoint_scroll_pad_down (int nb_events_inday, int win_length)
item_last_line = item_first_line; item_last_line = item_first_line;
else else
item_last_line = item_first_line + 1; item_last_line = item_first_line + 1;
pad_last_line = apad->first_onscreen + awin_length; pad_last_line = apad.first_onscreen + awin_length;
if (item_last_line >= pad_last_line) if (item_last_line >= pad_last_line)
apad->first_onscreen = item_last_line - awin_length; apad.first_onscreen = item_last_line - awin_length;
} }
/* /*
@ -607,8 +607,8 @@ apoint_scroll_pad_up (int nb_events_inday)
int item_first_line = 0; int item_first_line = 0;
item_first_line = get_item_line (hilt, nb_events_inday); item_first_line = get_item_line (hilt, nb_events_inday);
if (item_first_line < apad->first_onscreen) if (item_first_line < apad.first_onscreen)
apad->first_onscreen = item_first_line; apad.first_onscreen = item_first_line;
} }
/* /*
@ -745,11 +745,11 @@ apoint_update_panel (int which_pan)
custom_remove_attr (win[APP].p, ATTR_HIGHEST); custom_remove_attr (win[APP].p, ATTR_HIGHEST);
/* Draw the scrollbar if necessary. */ /* Draw the scrollbar if necessary. */
if ((apad->length >= app_length) || (apad->first_onscreen > 0)) if ((apad.length >= app_length) || (apad.first_onscreen > 0))
{ {
float ratio = ((float) app_length) / ((float) apad->length); float ratio = ((float) app_length) / ((float) apad.length);
int sbar_length = (int) (ratio * app_length); int sbar_length = (int) (ratio * app_length);
int highend = (int) (ratio * apad->first_onscreen); int highend = (int) (ratio * apad.first_onscreen);
bool hilt_bar = (which_pan == APP) ? true : false; bool hilt_bar = (which_pan == APP) ? true : false;
int sbar_top = highend + title_lines + 1; int sbar_top = highend + title_lines + 1;
@ -760,7 +760,7 @@ apoint_update_panel (int which_pan)
} }
wnoutrefresh (win[APP].p); wnoutrefresh (win[APP].p);
pnoutrefresh (apad->ptrwin, apad->first_onscreen, 0, pnoutrefresh (apad.ptrwin, apad.first_onscreen, 0,
win[APP].y + title_lines + 1, win[APP].x + bordr, win[APP].y + title_lines + 1, win[APP].x + bordr,
win[APP].y + win[APP].h - 2 * bordr, win[APP].y + win[APP].h - 2 * bordr,
win[APP].x + win[APP].w - 3 * bordr); win[APP].x + win[APP].w - 3 * bordr);

View File

@ -1,8 +1,8 @@
/* $calcurse: custom.c,v 1.33 2008/12/28 19:41:45 culot Exp $ */ /* $calcurse: custom.c,v 1.34 2009/01/02 22:28:54 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
* Copyright (c) 2004-2008 Frederic Culot * Copyright (c) 2004-2009 Frederic Culot
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -222,7 +222,7 @@ custom_load_conf (conf_t *conf, int background)
(void)keys_getch (win[STA].p); (void)keys_getch (win[STA].p);
} }
var = CUSTOM_CONF_NOVARIABLE; var = CUSTOM_CONF_NOVARIABLE;
pthread_mutex_lock (&nbar->mutex); pthread_mutex_lock (&nbar.mutex);
for (;;) for (;;)
{ {
if (fgets (buf, 99, data_file) == NULL) if (fgets (buf, 99, data_file) == NULL)
@ -277,23 +277,23 @@ custom_load_conf (conf_t *conf, int background)
var = 0; var = 0;
break; break;
case CUSTOM_CONF_NOTIFYBARSHOW: case CUSTOM_CONF_NOTIFYBARSHOW:
nbar->show = fill_config_var (e_conf); nbar.show = fill_config_var (e_conf);
var = 0; var = 0;
break; break;
case CUSTOM_CONF_NOTIFYBARDATE: case CUSTOM_CONF_NOTIFYBARDATE:
(void)strncpy (nbar->datefmt, e_conf, strlen (e_conf) + 1); (void)strncpy (nbar.datefmt, e_conf, strlen (e_conf) + 1);
var = 0; var = 0;
break; break;
case CUSTOM_CONF_NOTIFYBARCLOCK: case CUSTOM_CONF_NOTIFYBARCLOCK:
(void)strncpy (nbar->timefmt, e_conf, strlen (e_conf) + 1); (void)strncpy (nbar.timefmt, e_conf, strlen (e_conf) + 1);
var = 0; var = 0;
break; break;
case CUSTOM_CONF_NOTIFYBARWARNING: case CUSTOM_CONF_NOTIFYBARWARNING:
nbar->cntdwn = atoi (e_conf); nbar.cntdwn = atoi (e_conf);
var = 0; var = 0;
break; break;
case CUSTOM_CONF_NOTIFYBARCOMMAND: case CUSTOM_CONF_NOTIFYBARCOMMAND:
(void)strncpy (nbar->cmd, e_conf, strlen (e_conf) + 1); (void)strncpy (nbar.cmd, e_conf, strlen (e_conf) + 1);
var = 0; var = 0;
break; break;
case CUSTOM_CONF_OUTPUTDATEFMT: case CUSTOM_CONF_OUTPUTDATEFMT:
@ -346,7 +346,7 @@ custom_load_conf (conf_t *conf, int background)
var = CUSTOM_CONF_INPUTDATEFMT; var = CUSTOM_CONF_INPUTDATEFMT;
} }
file_close (data_file, __FILE_POS__); file_close (data_file, __FILE_POS__);
pthread_mutex_unlock (&nbar->mutex); pthread_mutex_unlock (&nbar.mutex);
} }
/* Draws the configuration bar */ /* Draws the configuration bar */
@ -436,8 +436,6 @@ display_layout_config (window_t *lwin, int mark, int cursor, int need_reset)
{ {
char label[BUFSIZ]; char label[BUFSIZ];
if (lwin->p != NULL)
delwin (lwin->p);
(void)snprintf (label, BUFSIZ, _("CalCurse %s | layout configuration"), (void)snprintf (label, BUFSIZ, _("CalCurse %s | layout configuration"),
VERSION); VERSION);
custom_confwin_init (lwin, label); custom_confwin_init (lwin, label);
@ -551,6 +549,13 @@ custom_layout_config (void)
void void
custom_confwin_init (window_t *confwin, char *label) custom_confwin_init (window_t *confwin, char *label)
{ {
if (confwin->p)
{
erase_window_part (confwin->p, confwin->x, confwin->y,
confwin->x + confwin->w, confwin->y + confwin->h);
(void)delwin (confwin->p);
}
wins_get_config (); wins_get_config ();
confwin->h = (notify_bar ())? row - 3 : row - 2; confwin->h = (notify_bar ())? row - 3 : row - 2;
confwin->p = newwin (confwin->h, col, 0, 0); confwin->p = newwin (confwin->h, col, 0, 0);
@ -636,8 +641,6 @@ display_color_config (window_t *cwin, int *mark_fore, int *mark_back,
if (need_reset) if (need_reset)
{ {
if (cwin->p != NULL)
delwin (cwin->p);
(void)snprintf (label, BUFSIZ, _("CalCurse %s | color theme"), VERSION); (void)snprintf (label, BUFSIZ, _("CalCurse %s | color theme"), VERSION);
custom_confwin_init (cwin, label); custom_confwin_init (cwin, label);
} }
@ -731,7 +734,7 @@ custom_color_config (void)
cursor = 0; cursor = 0;
need_reset = 1; need_reset = 1;
theme_changed = 0; theme_changed = 0;
conf_win.p = NULL; conf_win.p = 0;
display_color_config (&conf_win, &mark_fore, &mark_back, cursor, display_color_config (&conf_win, &mark_fore, &mark_back, cursor,
need_reset, theme_changed); need_reset, theme_changed);

View File

@ -1,4 +1,4 @@
/* $calcurse: day.c,v 1.46 2009/01/02 19:52:32 culot Exp $ */ /* $calcurse: day.c,v 1.47 2009/01/02 22:28:54 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -309,16 +309,16 @@ day_process_storage (date_t *slctd_date, bool day_changed,
date = date2sec (day, 0, 0); date = date2sec (day, 0, 0);
/* Inits */ /* Inits */
if (apad->length != 0) if (apad.length != 0)
delwin (apad->ptrwin); delwin (apad.ptrwin);
/* Store the events and appointments (recursive and normal items). */ /* Store the events and appointments (recursive and normal items). */
apad->length = day_store_items (date, &inday->nb_events, &inday->nb_apoints); apad.length = day_store_items (date, &inday->nb_events, &inday->nb_apoints);
/* Create the new pad with its new length. */ /* Create the new pad with its new length. */
if (day_changed) if (day_changed)
apad->first_onscreen = 0; apad.first_onscreen = 0;
apad->ptrwin = newpad (apad->length, apad->width); apad.ptrwin = newpad (apad.length, apad.width);
return (inday); return (inday);
} }
@ -347,7 +347,7 @@ display_item_date (int incolor, apoint_llist_node_t *i, int type, long date,
char a_st[100], a_end[100]; char a_st[100], a_end[100];
int recur = 0; int recur = 0;
win = apad->ptrwin; win = apad.ptrwin;
apoint_sec2str (i, type, date, a_st, a_end); apoint_sec2str (i, type, date, a_st, a_end);
if (type == RECUR_EVNT || type == RECUR_APPT) if (type == RECUR_EVNT || type == RECUR_APPT)
recur = 1; recur = 1;
@ -377,7 +377,7 @@ display_item (int incolor, char *msg, int recur, int note, int len, int y,
int ch_recur, ch_note; int ch_recur, ch_note;
char buf[len]; char buf[len];
win = apad->ptrwin; win = apad.ptrwin;
ch_recur = (recur) ? '*' : ' '; ch_recur = (recur) ? '*' : ' ';
ch_note = (note) ? '>' : ' '; ch_note = (note) ? '>' : ' ';
if (incolor == 0) if (incolor == 0)
@ -442,8 +442,8 @@ day_write_pad (long date, int width, int length, int incolor)
/* Draw a line between events and appointments. */ /* Draw a line between events and appointments. */
if (line > 0 && draw_line) if (line > 0 && draw_line)
{ {
wmove (apad->ptrwin, line, 0); wmove (apad.ptrwin, line, 0);
whline (apad->ptrwin, 0, width); whline (apad.ptrwin, 0, width);
draw_line = false; draw_line = false;
} }
/* Last print the appointments for current day. */ /* Last print the appointments for current day. */

View File

@ -1,4 +1,4 @@
/* $calcurse: io.c,v 1.53 2009/01/02 19:52:32 culot Exp $ */ /* $calcurse: io.c,v 1.54 2009/01/02 22:28:54 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -298,9 +298,9 @@ static void
ical_export_valarm (FILE *stream) ical_export_valarm (FILE *stream)
{ {
(void)fprintf (stream, "BEGIN:VALARM\n"); (void)fprintf (stream, "BEGIN:VALARM\n");
pthread_mutex_lock (&nbar->mutex); pthread_mutex_lock (&nbar.mutex);
(void)fprintf (stream, "TRIGGER:-P%dS\n", nbar->cntdwn); (void)fprintf (stream, "TRIGGER:-P%dS\n", nbar.cntdwn);
pthread_mutex_unlock (&nbar->mutex); pthread_mutex_unlock (&nbar.mutex);
(void)fprintf (stream, "ACTION:DISPLAY\n"); (void)fprintf (stream, "ACTION:DISPLAY\n");
(void)fprintf (stream, "END:VALARM\n"); (void)fprintf (stream, "END:VALARM\n");
} }
@ -871,34 +871,34 @@ io_save_cal (conf_t *conf, io_save_display_t display)
(void)fprintf (data_file, "%d\n", wins_layout ()); (void)fprintf (data_file, "%d\n", wins_layout ());
if (ui_mode == UI_CURSES) if (ui_mode == UI_CURSES)
pthread_mutex_lock (&nbar->mutex); pthread_mutex_lock (&nbar.mutex);
(void)fprintf (data_file, (void)fprintf (data_file,
"\n# If this option is set to yes, " "\n# If this option is set to yes, "
"notify-bar will be displayed :\n"); "notify-bar will be displayed :\n");
(void)fprintf (data_file, "notify-bar_show=\n"); (void)fprintf (data_file, "notify-bar_show=\n");
(void)fprintf (data_file, "%s\n", (nbar->show) ? "yes" : "no"); (void)fprintf (data_file, "%s\n", (nbar.show) ? "yes" : "no");
(void)fprintf (data_file, (void)fprintf (data_file,
"\n# Format of the date to be displayed inside notify-bar :\n"); "\n# Format of the date to be displayed inside notify-bar :\n");
(void)fprintf (data_file, "notify-bar_date=\n"); (void)fprintf (data_file, "notify-bar_date=\n");
(void)fprintf (data_file, "%s\n", nbar->datefmt); (void)fprintf (data_file, "%s\n", nbar.datefmt);
(void)fprintf (data_file, (void)fprintf (data_file,
"\n# Format of the time to be displayed inside notify-bar :\n"); "\n# Format of the time to be displayed inside notify-bar :\n");
(void)fprintf (data_file, "notify-bar_clock=\n"); (void)fprintf (data_file, "notify-bar_clock=\n");
(void)fprintf (data_file, "%s\n", nbar->timefmt); (void)fprintf (data_file, "%s\n", nbar.timefmt);
(void)fprintf (data_file, (void)fprintf (data_file,
"\n# Warn user if he has an appointment within next " "\n# Warn user if he has an appointment within next "
"'notify-bar_warning' seconds :\n"); "'notify-bar_warning' seconds :\n");
(void)fprintf (data_file, "notify-bar_warning=\n"); (void)fprintf (data_file, "notify-bar_warning=\n");
(void)fprintf (data_file, "%d\n", nbar->cntdwn); (void)fprintf (data_file, "%d\n", nbar.cntdwn);
(void)fprintf (data_file, (void)fprintf (data_file,
"\n# Command used to notify user of " "\n# Command used to notify user of "
"an upcoming appointment :\n"); "an upcoming appointment :\n");
(void)fprintf (data_file, "notify-bar_command=\n"); (void)fprintf (data_file, "notify-bar_command=\n");
(void)fprintf (data_file, "%s\n", nbar->cmd); (void)fprintf (data_file, "%s\n", nbar.cmd);
(void)fprintf (data_file, (void)fprintf (data_file,
"\n# Format of the date to be displayed " "\n# Format of the date to be displayed "
@ -913,7 +913,7 @@ io_save_cal (conf_t *conf, io_save_display_t display)
(void)fprintf (data_file, "%d\n", conf->input_datefmt); (void)fprintf (data_file, "%d\n", conf->input_datefmt);
if (ui_mode == UI_CURSES) if (ui_mode == UI_CURSES)
pthread_mutex_unlock (&nbar->mutex); pthread_mutex_unlock (&nbar.mutex);
file_close (data_file, __FILE_POS__); file_close (data_file, __FILE_POS__);
} }

View File

@ -1,8 +1,8 @@
/* $calcurse: notify.c,v 1.33 2008/12/28 13:13:59 culot Exp $ */ /* $calcurse: notify.c,v 1.34 2009/01/02 22:28:54 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
* Copyright (c) 2004-2008 Frederic Culot * Copyright (c) 2004-2009 Frederic Culot
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -40,8 +40,8 @@
#include "mem.h" #include "mem.h"
#include "notify.h" #include "notify.h"
static struct notify_vars_s *notify = NULL; static struct notify_vars_s notify;
static struct notify_app_s *notify_app = NULL; static struct notify_app_s notify_app;
static pthread_attr_t detached_thread_attr; static pthread_attr_t detached_thread_attr;
static pthread_t notify_t_main; static pthread_t notify_t_main;
@ -51,9 +51,9 @@ notify_bar (void)
{ {
int display_bar = 0; int display_bar = 0;
pthread_mutex_lock (&nbar->mutex); pthread_mutex_lock (&nbar.mutex);
display_bar = (nbar->show) ? 1 : 0; display_bar = (nbar.show) ? 1 : 0;
pthread_mutex_unlock (&nbar->mutex); pthread_mutex_unlock (&nbar.mutex);
return (display_bar); return (display_bar);
} }
@ -66,28 +66,21 @@ notify_init_vars (void)
char *date_format = "%a %F"; char *date_format = "%a %F";
char *cmd = "printf '\\a'"; char *cmd = "printf '\\a'";
nbar = (struct nbar_s *) mem_malloc (sizeof (struct nbar_s)); pthread_mutex_init (&nbar.mutex, NULL);
pthread_mutex_init (&nbar->mutex, NULL); nbar.show = 1;
nbar->show = 1; nbar.cntdwn = 300;
nbar->cntdwn = 300; (void)strncpy (nbar.datefmt, date_format, strlen (date_format) + 1);
(void)strncpy (nbar->datefmt, date_format, strlen (date_format) + 1); (void)strncpy (nbar.timefmt, time_format, strlen (time_format) + 1);
(void)strncpy (nbar->timefmt, time_format, strlen (time_format) + 1); (void)strncpy (nbar.cmd, cmd, strlen (cmd) + 1);
(void)strncpy (nbar->cmd, cmd, strlen (cmd) + 1);
if ((nbar->shell = getenv ("SHELL")) == NULL) if ((nbar.shell = getenv ("SHELL")) == NULL)
nbar->shell = "/bin/sh"; nbar.shell = "/bin/sh";
(void)pthread_attr_init (&detached_thread_attr); (void)pthread_attr_init (&detached_thread_attr);
(void)pthread_attr_setdetachstate (&detached_thread_attr, (void)pthread_attr_setdetachstate (&detached_thread_attr,
PTHREAD_CREATE_DETACHED); PTHREAD_CREATE_DETACHED);
} }
void
notify_free_vars (void)
{
mem_free (nbar);
}
/* Extract the appointment file name from the complete file path. */ /* Extract the appointment file name from the complete file path. */
static void static void
extract_aptsfile (void) extract_aptsfile (void)
@ -96,11 +89,11 @@ extract_aptsfile (void)
file = strrchr (path_apts, '/'); file = strrchr (path_apts, '/');
if (!file) if (!file)
notify->apts_file = path_apts; notify.apts_file = path_apts;
else else
{ {
notify->apts_file = file; notify.apts_file = file;
notify->apts_file++; notify.apts_file++;
} }
} }
@ -112,28 +105,18 @@ extract_aptsfile (void)
void void
notify_init_bar (void) notify_init_bar (void)
{ {
notify = (struct notify_vars_s *) mem_malloc (sizeof (struct notify_vars_s)); pthread_mutex_init (&notify.mutex, NULL);
notify_app = (struct notify_app_s *) mem_malloc (sizeof (struct notify_app_s)); pthread_mutex_init (&notify_app.mutex, NULL);
pthread_mutex_init (&notify->mutex, NULL); notify_app.got_app = 0;
pthread_mutex_init (&notify_app->mutex, NULL); notify.win = newwin (win[NOT].h, win[NOT].w, win[NOT].y, win[NOT].x);
notify_app->got_app = 0;
notify->win = newwin (win[NOT].h, win[NOT].w, win[NOT].y, win[NOT].x);
extract_aptsfile (); extract_aptsfile ();
} }
void
notify_free_bar (void)
{
mem_free (notify_app);
mem_free (notify);
}
/* Stop the notify-bar main thread. */ /* Stop the notify-bar main thread. */
void void
notify_stop_main_thread (void) notify_stop_main_thread (void)
{ {
pthread_cancel (notify_t_main); pthread_cancel (notify_t_main);
return;
} }
/* /*
@ -143,8 +126,8 @@ notify_stop_main_thread (void)
void void
notify_reinit_bar (void) notify_reinit_bar (void)
{ {
delwin (notify->win); delwin (notify.win);
notify->win = newwin (win[NOT].h, win[NOT].w, win[NOT].y, win[NOT].x); notify.win = newwin (win[NOT].h, win[NOT].w, win[NOT].y, win[NOT].x);
} }
/* Launch user defined command as a notification. */ /* Launch user defined command as a notification. */
@ -176,74 +159,74 @@ notify_update_bar (void)
char buf[BUFSIZ]; char buf[BUFSIZ];
date_pos = space; date_pos = space;
pthread_mutex_lock (&notify->mutex); pthread_mutex_lock (&notify.mutex);
file_pos = strlen (notify->date) + strlen (notify->time) + 7 + 2 * space; file_pos = strlen (notify.date) + strlen (notify.time) + 7 + 2 * space;
app_pos = file_pos + strlen (notify->apts_file) + 2 + space; app_pos = file_pos + strlen (notify.apts_file) + 2 + space;
txt_max_len = col - (app_pos + 12 + space); txt_max_len = col - (app_pos + 12 + space);
custom_apply_attr (notify->win, ATTR_HIGHEST); custom_apply_attr (notify.win, ATTR_HIGHEST);
wattron (notify->win, A_UNDERLINE | A_REVERSE); wattron (notify.win, A_UNDERLINE | A_REVERSE);
mvwhline (notify->win, 0, 0, ACS_HLINE, col); mvwhline (notify.win, 0, 0, ACS_HLINE, col);
mvwprintw (notify->win, 0, date_pos, "[ %s | %s ]", mvwprintw (notify.win, 0, date_pos, "[ %s | %s ]",
notify->date, notify->time); notify.date, notify.time);
mvwprintw (notify->win, 0, file_pos, "(%s)", notify->apts_file); mvwprintw (notify.win, 0, file_pos, "(%s)", notify.apts_file);
pthread_mutex_lock (&notify_app->mutex); pthread_mutex_lock (&notify_app.mutex);
if (notify_app->got_app) if (notify_app.got_app)
{ {
if (strlen (notify_app->txt) > txt_max_len) if (strlen (notify_app.txt) > txt_max_len)
{ {
too_long = 1; too_long = 1;
(void)strncpy (buf, notify_app->txt, txt_max_len - 3); (void)strncpy (buf, notify_app.txt, txt_max_len - 3);
buf[txt_max_len - 3] = '\0'; buf[txt_max_len - 3] = '\0';
} }
time_left = notify_app->time - notify->time_in_sec; time_left = notify_app.time - notify.time_in_sec;
if (time_left > 0) if (time_left > 0)
{ {
hours_left = (time_left / HOURINSEC); hours_left = (time_left / HOURINSEC);
minutes_left = (time_left - hours_left * HOURINSEC) / MININSEC; minutes_left = (time_left - hours_left * HOURINSEC) / MININSEC;
pthread_mutex_lock (&nbar->mutex); pthread_mutex_lock (&nbar.mutex);
if (time_left < nbar->cntdwn && (notify_app->state & APOINT_NOTIFY)) if (time_left < nbar.cntdwn && (notify_app.state & APOINT_NOTIFY))
blinking = 1; blinking = 1;
else else
blinking = 0; blinking = 0;
if (blinking) if (blinking)
wattron (notify->win, A_BLINK); wattron (notify.win, A_BLINK);
if (too_long) if (too_long)
mvwprintw (notify->win, 0, app_pos, "> %02d:%02d :: %s.. <", mvwprintw (notify.win, 0, app_pos, "> %02d:%02d :: %s.. <",
hours_left, minutes_left, buf); hours_left, minutes_left, buf);
else else
mvwprintw (notify->win, 0, app_pos, "> %02d:%02d :: %s <", mvwprintw (notify.win, 0, app_pos, "> %02d:%02d :: %s <",
hours_left, minutes_left, notify_app->txt); hours_left, minutes_left, notify_app.txt);
if (blinking) if (blinking)
wattroff (notify->win, A_BLINK); wattroff (notify.win, A_BLINK);
if (blinking && !(notify_app->state & APOINT_NOTIFIED)) if (blinking && !(notify_app.state & APOINT_NOTIFIED))
{ {
notify_app->state |= APOINT_NOTIFIED; notify_app.state |= APOINT_NOTIFIED;
launch_cmd (nbar->cmd, nbar->shell); launch_cmd (nbar.cmd, nbar.shell);
} }
pthread_mutex_unlock (&nbar->mutex); pthread_mutex_unlock (&nbar.mutex);
} }
else else
{ {
notify_app->got_app = 0; notify_app.got_app = 0;
pthread_mutex_unlock (&notify_app->mutex); pthread_mutex_unlock (&notify_app.mutex);
pthread_mutex_unlock (&notify->mutex); pthread_mutex_unlock (&notify.mutex);
notify_check_next_app (); notify_check_next_app ();
return; return;
} }
} }
pthread_mutex_unlock (&notify_app->mutex); pthread_mutex_unlock (&notify_app.mutex);
wattroff (notify->win, A_UNDERLINE | A_REVERSE); wattroff (notify.win, A_UNDERLINE | A_REVERSE);
custom_remove_attr (notify->win, ATTR_HIGHEST); custom_remove_attr (notify.win, ATTR_HIGHEST);
wrefresh (notify->win); wrefresh (notify.win);
pthread_mutex_unlock (&notify->mutex); pthread_mutex_unlock (&notify.mutex);
} }
/* Update the notication bar content */ /* Update the notication bar content */
@ -264,22 +247,22 @@ notify_main_thread (void *arg)
{ {
ntimer = time (NULL); ntimer = time (NULL);
ntime = localtime (&ntimer); ntime = localtime (&ntimer);
pthread_mutex_lock (&notify->mutex); pthread_mutex_lock (&notify.mutex);
notify->time_in_sec = ntimer; notify.time_in_sec = ntimer;
pthread_mutex_lock (&nbar->mutex); pthread_mutex_lock (&nbar.mutex);
strftime (notify->time, NOTIFY_FIELD_LENGTH, nbar->timefmt, ntime); strftime (notify.time, NOTIFY_FIELD_LENGTH, nbar.timefmt, ntime);
strftime (notify->date, NOTIFY_FIELD_LENGTH, nbar->datefmt, ntime); strftime (notify.date, NOTIFY_FIELD_LENGTH, nbar.datefmt, ntime);
pthread_mutex_unlock (&nbar->mutex); pthread_mutex_unlock (&nbar.mutex);
pthread_mutex_unlock (&notify->mutex); pthread_mutex_unlock (&notify.mutex);
notify_update_bar (); notify_update_bar ();
(void)sleep (thread_sleep); (void)sleep (thread_sleep);
elapse += thread_sleep; elapse += thread_sleep;
if (elapse >= check_app) if (elapse >= check_app)
{ {
elapse = 0; elapse = 0;
pthread_mutex_lock (&notify_app->mutex); pthread_mutex_lock (&notify_app.mutex);
got_app = notify_app->got_app; got_app = notify_app.got_app;
pthread_mutex_unlock (&notify_app->mutex); pthread_mutex_unlock (&notify_app.mutex);
if (!got_app) if (!got_app)
notify_check_next_app (); notify_check_next_app ();
} }
@ -305,19 +288,19 @@ notify_thread_app (void *arg)
tmp_app = *recur_apoint_check_next (&tmp_app, current_time, get_today ()); tmp_app = *recur_apoint_check_next (&tmp_app, current_time, get_today ());
tmp_app = *apoint_check_next (&tmp_app, current_time); tmp_app = *apoint_check_next (&tmp_app, current_time);
pthread_mutex_lock (&notify_app->mutex); pthread_mutex_lock (&notify_app.mutex);
if (tmp_app.got_app) if (tmp_app.got_app)
{ {
notify_app->got_app = 1; notify_app.got_app = 1;
notify_app->time = tmp_app.time; notify_app.time = tmp_app.time;
notify_app->txt = strdup (tmp_app.txt); notify_app.txt = strdup (tmp_app.txt);
notify_app->state = tmp_app.state; notify_app.state = tmp_app.state;
} }
else else
{ {
notify_app->got_app = 0; notify_app.got_app = 0;
} }
pthread_mutex_unlock (&notify_app->mutex); pthread_mutex_unlock (&notify_app.mutex);
if (tmp_app.txt != NULL) if (tmp_app.txt != NULL)
mem_free (tmp_app.txt); mem_free (tmp_app.txt);
@ -346,28 +329,28 @@ notify_check_added (char *mesg, long start, char state)
long gap; long gap;
current_time = time (NULL); current_time = time (NULL);
pthread_mutex_lock (&notify_app->mutex); pthread_mutex_lock (&notify_app.mutex);
if (!notify_app->got_app) if (!notify_app.got_app)
{ {
gap = start - current_time; gap = start - current_time;
if (gap >= 0 && gap <= DAYINSEC) if (gap >= 0 && gap <= DAYINSEC)
update_notify = 1; update_notify = 1;
} }
else if (start < notify_app->time && start >= current_time) else if (start < notify_app.time && start >= current_time)
{ {
update_notify = 1; update_notify = 1;
} }
else if (start == notify_app->time && state != notify_app->state) else if (start == notify_app.time && state != notify_app.state)
update_notify = 1; update_notify = 1;
if (update_notify) if (update_notify)
{ {
notify_app->got_app = 1; notify_app.got_app = 1;
notify_app->time = start; notify_app.time = start;
notify_app->txt = strdup (mesg); notify_app.txt = strdup (mesg);
notify_app->state = state; notify_app.state = state;
} }
pthread_mutex_unlock (&notify_app->mutex); pthread_mutex_unlock (&notify_app.mutex);
notify_update_bar (); notify_update_bar ();
} }
@ -380,33 +363,33 @@ notify_check_repeated (recur_apoint_llist_node_t *i)
time_t current_time; time_t current_time;
current_time = time (NULL); current_time = time (NULL);
pthread_mutex_lock (&notify_app->mutex); pthread_mutex_lock (&notify_app.mutex);
if ((real_app_time = recur_item_inday (i->start, i->exc, i->rpt->type, if ((real_app_time = recur_item_inday (i->start, i->exc, i->rpt->type,
i->rpt->freq, i->rpt->until, i->rpt->freq, i->rpt->until,
get_today ()) > current_time)) get_today ()) > current_time))
{ {
if (!notify_app->got_app) if (!notify_app.got_app)
{ {
if (real_app_time - current_time <= DAYINSEC) if (real_app_time - current_time <= DAYINSEC)
update_notify = 1; update_notify = 1;
} }
else if (real_app_time < notify_app->time && else if (real_app_time < notify_app.time &&
real_app_time >= current_time) real_app_time >= current_time)
{ {
update_notify = 1; update_notify = 1;
} }
else if (real_app_time == notify_app->time && else if (real_app_time == notify_app.time &&
i->state != notify_app->state) i->state != notify_app.state)
update_notify = 1; update_notify = 1;
} }
if (update_notify) if (update_notify)
{ {
notify_app->got_app = 1; notify_app.got_app = 1;
notify_app->time = real_app_time; notify_app.time = real_app_time;
notify_app->txt = strdup (i->mesg); notify_app.txt = strdup (i->mesg);
notify_app->state = i->state; notify_app.state = i->state;
} }
pthread_mutex_unlock (&notify_app->mutex); pthread_mutex_unlock (&notify_app.mutex);
notify_update_bar (); notify_update_bar ();
} }
@ -415,12 +398,12 @@ notify_same_item (long time)
{ {
int same = 0; int same = 0;
pthread_mutex_lock (&(notify_app->mutex)); pthread_mutex_lock (&(notify_app.mutex));
if (notify_app->got_app && notify_app->time == time) if (notify_app.got_app && notify_app.time == time)
same = 1; same = 1;
pthread_mutex_unlock (&(notify_app->mutex)); pthread_mutex_unlock (&(notify_app.mutex));
return (same); return same;
} }
int int
@ -431,12 +414,12 @@ notify_same_recur_item (recur_apoint_llist_node_t *i)
item_start = recur_item_inday (i->start, i->exc, i->rpt->type, item_start = recur_item_inday (i->start, i->exc, i->rpt->type,
i->rpt->freq, i->rpt->until, get_today ()); i->rpt->freq, i->rpt->until, get_today ());
pthread_mutex_lock (&notify_app->mutex); pthread_mutex_lock (&notify_app.mutex);
if (notify_app->got_app && item_start == notify_app->time) if (notify_app.got_app && item_start == notify_app.time)
same = 1; same = 1;
pthread_mutex_unlock (&(notify_app->mutex)); pthread_mutex_unlock (&(notify_app.mutex));
return (same); return same;
} }
/* Launch the notify-bar main thread. */ /* Launch the notify-bar main thread. */
@ -445,7 +428,6 @@ notify_start_main_thread (void)
{ {
pthread_create (&notify_t_main, NULL, notify_main_thread, NULL); pthread_create (&notify_t_main, NULL, notify_main_thread, NULL);
notify_check_next_app (); notify_check_next_app ();
return;
} }
/* Print options related to the notify-bar. */ /* Print options related to the notify-bar. */
@ -493,18 +475,18 @@ notify_print_options (WINDOW *optwin, int col)
_("(Command used to notify user of an upcoming appointment)"), _("(Command used to notify user of an upcoming appointment)"),
BUFSIZ); BUFSIZ);
pthread_mutex_lock (&nbar->mutex); pthread_mutex_lock (&nbar.mutex);
(void)strncpy (opt[DATE].value, nbar->datefmt, BUFSIZ); (void)strncpy (opt[DATE].value, nbar.datefmt, BUFSIZ);
(void)strncpy (opt[CLOCK].value, nbar->timefmt, BUFSIZ); (void)strncpy (opt[CLOCK].value, nbar.timefmt, BUFSIZ);
(void)snprintf (opt[WARN].value, BUFSIZ, "%d", nbar->cntdwn); (void)snprintf (opt[WARN].value, BUFSIZ, "%d", nbar.cntdwn);
(void)strncpy (opt[CMD].value, nbar->cmd, BUFSIZ); (void)strncpy (opt[CMD].value, nbar.cmd, BUFSIZ);
l = strlen (opt[SHOW].name); l = strlen (opt[SHOW].name);
x = x_pos + x_offset + l; x = x_pos + x_offset + l;
mvwprintw (optwin, y_pos, x_pos, "[1] %s", opt[SHOW].name); mvwprintw (optwin, y_pos, x_pos, "[1] %s", opt[SHOW].name);
erase_window_part (optwin, x, y_pos, maxcol, y_pos); erase_window_part (optwin, x, y_pos, maxcol, y_pos);
print_bool_option_incolor (optwin, nbar->show, y_pos, x); print_bool_option_incolor (optwin, nbar.show, y_pos, x);
mvwprintw (optwin, y_pos + 1, x_pos, opt[SHOW].desc); mvwprintw (optwin, y_pos + 1, x_pos, opt[SHOW].desc);
for (i = 1; i < NB_OPT; i++) for (i = 1; i < NB_OPT; i++)
@ -529,7 +511,7 @@ notify_print_options (WINDOW *optwin, int col)
mvwprintw (optwin, y + 1, x_pos, opt[i].desc); mvwprintw (optwin, y + 1, x_pos, opt[i].desc);
} }
pthread_mutex_unlock (&nbar->mutex); pthread_mutex_unlock (&nbar.mutex);
wmove (win[STA].p, 1, 0); wmove (win[STA].p, 1, 0);
wnoutrefresh (optwin); wnoutrefresh (optwin);
doupdate (); doupdate ();
@ -553,9 +535,11 @@ notify_config_bar (void)
char *cmd_str = _("Enter the notification command "); char *cmd_str = _("Enter the notification command ");
int ch = 0, change_win = 1; int ch = 0, change_win = 1;
buf = (char *) mem_malloc (BUFSIZ); buf = mem_malloc (BUFSIZ);
(void)snprintf (label, BUFSIZ, _("CalCurse %s | notify-bar options"), (void)snprintf (label, BUFSIZ, _("CalCurse %s | notify-bar options"),
VERSION); VERSION);
conf_win.p = 0;
custom_confwin_init (&conf_win, label); custom_confwin_init (&conf_win, label);
while (ch != 'q') while (ch != 'q')
@ -577,66 +561,65 @@ notify_config_bar (void)
custom_confwin_init (&conf_win, label); custom_confwin_init (&conf_win, label);
break; break;
case '1': case '1':
pthread_mutex_lock (&nbar->mutex); pthread_mutex_lock (&nbar.mutex);
nbar->show = !nbar->show; nbar.show = !nbar.show;
pthread_mutex_unlock (&nbar->mutex); pthread_mutex_unlock (&nbar.mutex);
if (notify_bar ()) if (notify_bar ())
notify_start_main_thread (); notify_start_main_thread ();
else else
notify_stop_main_thread (); notify_stop_main_thread ();
delwin (conf_win.p);
change_win = 1; change_win = 1;
break; break;
case '2': case '2':
status_mesg (date_str, ""); status_mesg (date_str, "");
pthread_mutex_lock (&nbar->mutex); pthread_mutex_lock (&nbar.mutex);
(void)strncpy (buf, nbar->datefmt, strlen (nbar->datefmt) + 1); (void)strncpy (buf, nbar.datefmt, strlen (nbar.datefmt) + 1);
pthread_mutex_unlock (&nbar->mutex); pthread_mutex_unlock (&nbar.mutex);
if (updatestring (win[STA].p, &buf, 0, 1) == 0) if (updatestring (win[STA].p, &buf, 0, 1) == 0)
{ {
pthread_mutex_lock (&nbar->mutex); pthread_mutex_lock (&nbar.mutex);
(void)strncpy (nbar->datefmt, buf, strlen (buf) + 1); (void)strncpy (nbar.datefmt, buf, strlen (buf) + 1);
pthread_mutex_unlock (&nbar->mutex); pthread_mutex_unlock (&nbar.mutex);
} }
change_win = 0; change_win = 0;
break; break;
case '3': case '3':
status_mesg (time_str, ""); status_mesg (time_str, "");
pthread_mutex_lock (&nbar->mutex); pthread_mutex_lock (&nbar.mutex);
(void)strncpy (buf, nbar->timefmt, strlen (nbar->timefmt) + 1); (void)strncpy (buf, nbar.timefmt, strlen (nbar.timefmt) + 1);
pthread_mutex_unlock (&nbar->mutex); pthread_mutex_unlock (&nbar.mutex);
if (updatestring (win[STA].p, &buf, 0, 1) == 0) if (updatestring (win[STA].p, &buf, 0, 1) == 0)
{ {
pthread_mutex_lock (&nbar->mutex); pthread_mutex_lock (&nbar.mutex);
(void)strncpy (nbar->timefmt, buf, strlen (buf) + 1); (void)strncpy (nbar.timefmt, buf, strlen (buf) + 1);
pthread_mutex_unlock (&nbar->mutex); pthread_mutex_unlock (&nbar.mutex);
} }
change_win = 0; change_win = 0;
break; break;
case '4': case '4':
status_mesg (count_str, ""); status_mesg (count_str, "");
pthread_mutex_lock (&nbar->mutex); pthread_mutex_lock (&nbar.mutex);
printf (buf, "%d", nbar->cntdwn); printf (buf, "%d", nbar.cntdwn);
pthread_mutex_unlock (&nbar->mutex); pthread_mutex_unlock (&nbar.mutex);
if (updatestring (win[STA].p, &buf, 0, 1) == 0 && if (updatestring (win[STA].p, &buf, 0, 1) == 0 &&
is_all_digit (buf) && atoi (buf) >= 0 && atoi (buf) <= DAYINSEC) is_all_digit (buf) && atoi (buf) >= 0 && atoi (buf) <= DAYINSEC)
{ {
pthread_mutex_lock (&nbar->mutex); pthread_mutex_lock (&nbar.mutex);
nbar->cntdwn = atoi (buf); nbar.cntdwn = atoi (buf);
pthread_mutex_unlock (&nbar->mutex); pthread_mutex_unlock (&nbar.mutex);
} }
change_win = 0; change_win = 0;
break; break;
case '5': case '5':
status_mesg (cmd_str, ""); status_mesg (cmd_str, "");
pthread_mutex_lock (&nbar->mutex); pthread_mutex_lock (&nbar.mutex);
(void)strncpy (buf, nbar->cmd, strlen (nbar->cmd) + 1); (void)strncpy (buf, nbar.cmd, strlen (nbar.cmd) + 1);
pthread_mutex_unlock (&nbar->mutex); pthread_mutex_unlock (&nbar.mutex);
if (updatestring (win[STA].p, &buf, 0, 1) == 0) if (updatestring (win[STA].p, &buf, 0, 1) == 0)
{ {
pthread_mutex_lock (&nbar->mutex); pthread_mutex_lock (&nbar.mutex);
(void)strncpy (nbar->cmd, buf, strlen (buf) + 1); (void)strncpy (nbar.cmd, buf, strlen (buf) + 1);
pthread_mutex_unlock (&nbar->mutex); pthread_mutex_unlock (&nbar.mutex);
} }
change_win = 0; change_win = 0;
break; break;

View File

@ -1,4 +1,4 @@
/* $calcurse: notify.h,v 1.15 2008/12/28 13:13:59 culot Exp $ */ /* $calcurse: notify.h,v 1.16 2009/01/02 22:28:54 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -54,9 +54,7 @@ struct notify_app_s
int notify_bar (void); int notify_bar (void);
void notify_init_vars (void); void notify_init_vars (void);
void notify_free_vars (void);
void notify_init_bar (void); void notify_init_bar (void);
void notify_free_bar (void);
void notify_start_main_thread (void); void notify_start_main_thread (void);
void notify_stop_main_thread (void); void notify_stop_main_thread (void);
void notify_reinit_bar (void); void notify_reinit_bar (void);

View File

@ -1,4 +1,4 @@
/* $calcurse: utils.c,v 1.64 2009/01/01 17:50:41 culot Exp $ */ /* $calcurse: utils.c,v 1.65 2009/01/02 22:28:54 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -36,7 +36,6 @@
#include "utils.h" #include "utils.h"
#include "i18n.h" #include "i18n.h"
#include "notify.h"
#include "wins.h" #include "wins.h"
#include "custom.h" #include "custom.h"
#include "keys.h" #include "keys.h"
@ -47,7 +46,6 @@
#include "todo.h" #include "todo.h"
#include "day.h" #include "day.h"
#include "keys.h" #include "keys.h"
#include "vars.h"
#include "mem.h" #include "mem.h"
#define NB_CAL_CMDS 24 /* number of commands while in cal view */ #define NB_CAL_CMDS 24 /* number of commands while in cal view */
@ -71,9 +69,6 @@ exit_calcurse (int status)
} }
calendar_stop_date_thread (); calendar_stop_date_thread ();
io_stop_psave_thread (); io_stop_psave_thread ();
vars_free ();
notify_free_vars ();
notify_free_bar ();
day_saved_item_free (); day_saved_item_free ();
day_free_list (); day_free_list ();
event_llist_free (); event_llist_free ();

View File

@ -1,4 +1,4 @@
/* $calcurse: vars.c,v 1.13 2008/12/28 19:41:45 culot Exp $ */ /* $calcurse: vars.c,v 1.14 2009/01/02 22:28:54 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -92,10 +92,10 @@ char path_notes[] = "";
char path_keys[] = ""; char path_keys[] = "";
/* Variable to handle pads. */ /* Variable to handle pads. */
struct pad_s *apad; struct pad_s apad;
/* Variable to store notify-bar settings. */ /* Variable to store notify-bar settings. */
struct nbar_s *nbar; struct nbar_s nbar;
/* /*
* Variables init * Variables init
@ -135,9 +135,8 @@ vars_init (conf_t *conf)
calendar_set_first_day_of_week (MONDAY); calendar_set_first_day_of_week (MONDAY);
/* Pad structure to scroll text inside the appointment panel */ /* Pad structure to scroll text inside the appointment panel */
apad = (struct pad_s *) mem_malloc (sizeof (struct pad_s)); apad.length = 1;
apad->length = 1; apad.first_onscreen = 0;
apad->first_onscreen = 0;
/* Attribute definitions for color and non-color terminals */ /* Attribute definitions for color and non-color terminals */
custom_init_attr (); custom_init_attr ();
@ -145,9 +144,3 @@ vars_init (conf_t *conf)
/* Start at the current date */ /* Start at the current date */
calendar_init_slctd_day (); calendar_init_slctd_day ();
} }
void
vars_free (void)
{
mem_free (apad);
}

View File

@ -1,8 +1,8 @@
/* $calcurse: vars.h,v 1.28 2008/12/28 19:41:45 culot Exp $ */ /* $calcurse: vars.h,v 1.29 2009/01/02 22:28:54 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
* Copyright (c) 2004-2008 Frederic Culot * Copyright (c) 2004-2009 Frederic Culot
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -119,10 +119,9 @@ extern char path_apts[BUFSIZ];
extern char path_conf[BUFSIZ]; extern char path_conf[BUFSIZ];
extern char path_keys[BUFSIZ]; extern char path_keys[BUFSIZ];
extern char path_notes[BUFSIZ]; extern char path_notes[BUFSIZ];
extern struct pad_s *apad; extern struct pad_s apad;
extern struct nbar_s *nbar; extern struct nbar_s nbar;
void vars_init (conf_t *conf); void vars_init (conf_t *conf);
void vars_free (void);
#endif /* CALCURSE_VARS_H */ #endif /* CALCURSE_VARS_H */

View File

@ -1,4 +1,4 @@
/* $calcurse: wins.c,v 1.21 2008/12/28 19:41:45 culot Exp $ */ /* $calcurse: wins.c,v 1.22 2009/01/02 22:28:54 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -103,8 +103,8 @@ wins_init (void)
win[APP].p = newwin (win[APP].h, win[APP].w, win[APP].y, win[APP].x); win[APP].p = newwin (win[APP].h, win[APP].w, win[APP].y, win[APP].x);
(void)snprintf (label, BUFSIZ, _("Appointments")); (void)snprintf (label, BUFSIZ, _("Appointments"));
wins_show (win[APP].p, label); wins_show (win[APP].p, label);
apad->width = win[APP].w - 3; apad.width = win[APP].w - 3;
apad->ptrwin = newpad (apad->length, apad->width); apad.ptrwin = newpad (apad.length, apad.width);
win[TOD].p = newwin (win[TOD].h, win[TOD].w, win[TOD].y, win[TOD].x); win[TOD].p = newwin (win[TOD].h, win[TOD].w, win[TOD].y, win[TOD].x);
(void)snprintf (label, BUFSIZ, _("ToDo")); (void)snprintf (label, BUFSIZ, _("ToDo"));
@ -195,7 +195,7 @@ wins_reinit (void)
delwin (win[STA].p); delwin (win[STA].p);
delwin (win[CAL].p); delwin (win[CAL].p);
delwin (win[APP].p); delwin (win[APP].p);
delwin (apad->ptrwin); delwin (apad.ptrwin);
delwin (win[TOD].p); delwin (win[TOD].p);
wins_get_config (); wins_get_config ();
wins_init (); wins_init ();