Simplify day storage

The function day_process_storage() is a wrapper for day_store_items().
It has an unused second argument, and is only used twice to load the
selected day. It has been removed.

A new function, get_slctd_day(), is the equivalant of get_today() and
replaces the very awkwardly named ui_calendar_get_slctd_day_sec().

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lars Henriksen
2018-12-13 20:29:22 +01:00
committed by Lukas Fleischer
parent 06a4449afa
commit 8dd694b569
6 changed files with 15 additions and 44 deletions

View File

@@ -368,28 +368,6 @@ day_store_items(time_t date, int include_captions)
day_items_nb = events + apts;
}
/*
* Store the events and appointments for the selected day, and write
* those items in a pad. If selected day is null, then store items for current
* day. This is useful to speed up the appointment panel update.
*/
void day_process_storage(struct date *slctd_date, unsigned day_changed)
{
struct date day;
if (slctd_date)
day = *slctd_date;
else
ui_calendar_store_current_date(&day);
/* Inits */
if (apad.length != 0)
delwin(apad.ptrwin);
/* Store the events and appointments (recursive and normal items). */
day_store_items(date2sec(day, 0, 0), 1);
}
/*
* Print an item date in the appointment panel.
*/
@@ -495,8 +473,7 @@ void day_popup_item(struct day_item *day)
struct apoint apt_tmp;
apt_tmp.start = day->start;
apt_tmp.dur = day_item_get_duration(day);
apoint_sec2str(&apt_tmp, ui_calendar_get_slctd_day_sec(),
a_st, a_end);
apoint_sec2str(&apt_tmp, get_slctd_day(), a_st, a_end);
item_in_popup(a_st, a_end, day_item_get_mesg(day),
_("Appointment:"));