summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2013-02-14 10:52:44 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2013-02-14 11:08:03 +0100
commit806673dd9b256e879d1483255886a8881d1d8115 (patch)
tree53dfc46a1575233ad95dfdc2767a695504d26eac /src
parent971df8d215a0e10c87f67f3505345e15efcffb8e (diff)
downloadcalcurse-806673dd9b256e879d1483255886a8881d1d8115.zip
calendar.c: Rename to "ui-calendar.c"
This unit belongs to the presentation layer -- rename the file accordingly. Also, rename calendar_*() to ui_calendar_*(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/calcurse.c40
-rw-r--r--src/calcurse.h44
-rw-r--r--src/config.c12
-rw-r--r--src/custom.c4
-rw-r--r--src/day.c4
-rw-r--r--src/pcal.c10
-rw-r--r--src/ui-calendar.c (renamed from src/calendar.c)100
-rw-r--r--src/ui-day.c28
-rw-r--r--src/utils.c2
-rw-r--r--src/vars.c4
-rw-r--r--src/wins.c2
12 files changed, 126 insertions, 126 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 438106d..44d1ae8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -13,7 +13,6 @@ calcurse_SOURCES = \
sha1.h \
apoint.c \
args.c \
- calendar.c \
config.c \
custom.c \
day.c \
@@ -31,6 +30,7 @@ calcurse_SOURCES = \
sha1.c \
sigs.c \
todo.c \
+ ui-calendar.c \
ui-day.c \
ui-todo.c \
utf8.c \
diff --git a/src/calcurse.c b/src/calcurse.c
index 227c83f..6fd2ecb 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -49,7 +49,7 @@ int count, reg;
*/
static struct day_items_nb do_storage(int day_changed)
{
- struct day_items_nb inday = day_process_storage(calendar_get_slctd_day(),
+ struct day_items_nb inday = day_process_storage(ui_calendar_get_slctd_day(),
day_changed);
if (day_changed) {
@@ -92,8 +92,8 @@ static inline void key_generic_other_cmd(void)
static inline void key_generic_goto(void)
{
wins_erase_status_bar();
- calendar_set_current_date();
- calendar_change_day(conf.input_datefmt);
+ ui_calendar_set_current_date();
+ ui_calendar_change_day(conf.input_datefmt);
inday = do_storage(1);
wins_update(FLAG_CAL | FLAG_APP | FLAG_STA);
}
@@ -101,8 +101,8 @@ static inline void key_generic_goto(void)
static inline void key_generic_goto_today(void)
{
wins_erase_status_bar();
- calendar_set_current_date();
- calendar_goto_today();
+ ui_calendar_set_current_date();
+ ui_calendar_goto_today();
inday = do_storage(1);
wins_update(FLAG_CAL | FLAG_APP | FLAG_STA);
}
@@ -287,7 +287,7 @@ static inline void key_generic_import(void)
{
wins_erase_status_bar();
io_import_data(IO_IMPORT_ICAL, NULL);
- calendar_monthly_view_cache_set_invalid();
+ ui_calendar_monthly_view_cache_set_invalid();
inday = do_storage(0);
wins_update(FLAG_ALL);
}
@@ -317,7 +317,7 @@ static inline void key_generic_export()
static inline void key_generic_prev_day(void)
{
- calendar_move(DAY_PREV, count);
+ ui_calendar_move(DAY_PREV, count);
inday = do_storage(1);
wins_update(FLAG_CAL | FLAG_APP);
}
@@ -330,7 +330,7 @@ static inline void key_move_left(void)
static inline void key_generic_next_day(void)
{
- calendar_move(DAY_NEXT, count);
+ ui_calendar_move(DAY_NEXT, count);
inday = do_storage(1);
wins_update(FLAG_CAL | FLAG_APP);
}
@@ -343,7 +343,7 @@ static inline void key_move_right(void)
static inline void key_generic_prev_week(void)
{
- calendar_move(WEEK_PREV, count);
+ ui_calendar_move(WEEK_PREV, count);
inday = do_storage(1);
wins_update(FLAG_CAL | FLAG_APP);
}
@@ -370,7 +370,7 @@ static inline void key_move_up(void)
static inline void key_generic_next_week(void)
{
- calendar_move(WEEK_NEXT, count);
+ ui_calendar_move(WEEK_NEXT, count);
inday = do_storage(1);
wins_update(FLAG_CAL | FLAG_APP);
}
@@ -397,28 +397,28 @@ static inline void key_move_down(void)
static inline void key_generic_prev_month(void)
{
- calendar_move(MONTH_PREV, count);
+ ui_calendar_move(MONTH_PREV, count);
inday = do_storage(1);
wins_update(FLAG_CAL | FLAG_APP);
}
static inline void key_generic_next_month(void)
{
- calendar_move(MONTH_NEXT, count);
+ ui_calendar_move(MONTH_NEXT, count);
inday = do_storage(1);
wins_update(FLAG_CAL | FLAG_APP);
}
static inline void key_generic_prev_year(void)
{
- calendar_move(YEAR_PREV, count);
+ ui_calendar_move(YEAR_PREV, count);
inday = do_storage(1);
wins_update(FLAG_CAL | FLAG_APP);
}
static inline void key_generic_next_year(void)
{
- calendar_move(YEAR_NEXT, count);
+ ui_calendar_move(YEAR_NEXT, count);
inday = do_storage(1);
wins_update(FLAG_CAL | FLAG_APP);
}
@@ -426,7 +426,7 @@ static inline void key_generic_next_year(void)
static inline void key_start_of_week(void)
{
if (wins_slctd() == CAL) {
- calendar_move(WEEK_START, count);
+ ui_calendar_move(WEEK_START, count);
inday = do_storage(1);
wins_update(FLAG_CAL | FLAG_APP);
}
@@ -435,7 +435,7 @@ static inline void key_start_of_week(void)
static inline void key_end_of_week(void)
{
if (wins_slctd() == CAL) {
- calendar_move(WEEK_END, count);
+ ui_calendar_move(WEEK_END, count);
inday = do_storage(1);
wins_update(FLAG_CAL | FLAG_APP);
}
@@ -444,7 +444,7 @@ static inline void key_end_of_week(void)
static inline void key_generic_scroll_up(void)
{
if (wins_slctd() == CAL) {
- calendar_view_prev();
+ ui_calendar_view_prev();
wins_update(FLAG_CAL | FLAG_APP);
}
}
@@ -452,7 +452,7 @@ static inline void key_generic_scroll_up(void)
static inline void key_generic_scroll_down(void)
{
if (wins_slctd() == CAL) {
- calendar_view_next();
+ ui_calendar_view_next();
wins_update(FLAG_CAL | FLAG_APP);
}
}
@@ -519,7 +519,7 @@ int main(int argc, char **argv)
cbreak(); /* control chars generate a signal */
noecho(); /* controls echoing of typed chars */
curs_set(0); /* make cursor invisible */
- calendar_set_current_date();
+ ui_calendar_set_current_date();
notify_init_vars();
wins_get_config();
@@ -586,7 +586,7 @@ int main(int argc, char **argv)
/* Start miscellaneous threads. */
if (notify_bar())
notify_start_main_thread();
- calendar_start_date_thread();
+ ui_calendar_start_date_thread();
if (conf.periodic_save > 0)
io_start_psave_thread();
diff --git a/src/calcurse.h b/src/calcurse.h
index 22c4fe8..8d76bba 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -631,28 +631,28 @@ void apoint_paste_item(struct apoint *, long);
int parse_args(int, char **);
/* calendar.c */
-void calendar_view_next(void);
-void calendar_view_prev(void);
-void calendar_set_view(int);
-int calendar_get_view(void);
-void calendar_start_date_thread(void);
-void calendar_stop_date_thread(void);
-void calendar_set_current_date(void);
-void calendar_set_first_day_of_week(enum wday);
-void calendar_change_first_day_of_week(void);
-unsigned calendar_week_begins_on_monday(void);
-void calendar_store_current_date(struct date *);
-void calendar_init_slctd_day(void);
-struct date *calendar_get_slctd_day(void);
-long calendar_get_slctd_day_sec(void);
-void calendar_monthly_view_cache_set_invalid(void);
-void calendar_update_panel(struct window *);
-void calendar_goto_today(void);
-void calendar_change_day(int);
-void calendar_move(enum move, int);
-long calendar_start_of_year(void);
-long calendar_end_of_year(void);
-const char *calendar_get_pom(time_t);
+void ui_calendar_view_next(void);
+void ui_calendar_view_prev(void);
+void ui_calendar_set_view(int);
+int ui_calendar_get_view(void);
+void ui_calendar_start_date_thread(void);
+void ui_calendar_stop_date_thread(void);
+void ui_calendar_set_current_date(void);
+void ui_calendar_set_first_day_of_week(enum wday);
+void ui_calendar_change_first_day_of_week(void);
+unsigned ui_calendar_week_begins_on_monday(void);
+void ui_calendar_store_current_date(struct date *);
+void ui_calendar_init_slctd_day(void);
+struct date *ui_calendar_get_slctd_day(void);
+long ui_calendar_get_slctd_day_sec(void);
+void ui_calendar_monthly_view_cache_set_invalid(void);
+void ui_calendar_update_panel(struct window *);
+void ui_calendar_goto_today(void);
+void ui_calendar_change_day(int);
+void ui_calendar_move(enum move, int);
+long ui_calendar_start_of_year(void);
+long ui_calendar_end_of_year(void);
+const char *ui_calendar_get_pom(time_t);
/* config.c */
diff --git a/src/config.c b/src/config.c
index 83d1a93..72ce7fa 100644
--- a/src/config.c
+++ b/src/config.c
@@ -202,9 +202,9 @@ static int config_parse_color_pair(int *dest1, int *dest2, const char *val)
static int config_parse_calendar_view(void *dummy, const char *val)
{
if (!strcmp(val, "monthly"))
- calendar_set_view(CAL_MONTH_VIEW);
+ ui_calendar_set_view(CAL_MONTH_VIEW);
else if (!strcmp(val, "weekly"))
- calendar_set_view(CAL_WEEK_VIEW);
+ ui_calendar_set_view(CAL_WEEK_VIEW);
else
return 0;
@@ -228,9 +228,9 @@ static int config_parse_default_panel(void *dummy, const char *val)
static int config_parse_first_day_of_week(void *dummy, const char *val)
{
if (!strcmp(val, "monday"))
- calendar_set_first_day_of_week(MONDAY);
+ ui_calendar_set_first_day_of_week(MONDAY);
else if (!strcmp(val, "sunday"))
- calendar_set_first_day_of_week(SUNDAY);
+ ui_calendar_set_first_day_of_week(SUNDAY);
else
return 0;
@@ -379,7 +379,7 @@ static void config_color_theme_name(char *theme_name)
static int config_serialize_calendar_view(char *buf, void *dummy)
{
- if (calendar_get_view() == CAL_WEEK_VIEW)
+ if (ui_calendar_get_view() == CAL_WEEK_VIEW)
strcpy(buf, "weekly");
else
strcpy(buf, "monthly");
@@ -401,7 +401,7 @@ static int config_serialize_default_panel(char *buf, void *dummy)
static int config_serialize_first_day_of_week(char *buf, void *dummy)
{
- if (calendar_week_begins_on_monday())
+ if (ui_calendar_week_begins_on_monday())
strcpy(buf, "monday");
else
strcpy(buf, "sunday");
diff --git a/src/custom.c b/src/custom.c
index df344c2..45cd07a 100644
--- a/src/custom.c
+++ b/src/custom.c
@@ -668,7 +668,7 @@ static int print_general_options(WINDOW * win)
mvwprintw(win, y, XPOS, "[8] %s ", opt[FIRST_DAY_OF_WEEK]);
custom_apply_attr(win, ATTR_HIGHEST);
mvwaddstr(win, y, XPOS + 4 + strlen(opt[FIRST_DAY_OF_WEEK]),
- calendar_week_begins_on_monday()? _("Monday") : _("Sunday"));
+ ui_calendar_week_begins_on_monday()? _("Monday") : _("Sunday"));
custom_remove_attr(win, ATTR_HIGHEST);
mvwaddstr(win, y + 1, XPOS,
_("(specifies the first day of week in the calendar view)"));
@@ -773,7 +773,7 @@ void custom_general_config(void)
conf.progress_bar = !conf.progress_bar;
break;
case '8':
- calendar_change_first_day_of_week();
+ ui_calendar_change_first_day_of_week();
break;
case '9':
status_mesg(output_datefmt_str, "");
diff --git a/src/day.c b/src/day.c
index 4c2f5bf..2e3b4bf 100644
--- a/src/day.c
+++ b/src/day.c
@@ -370,7 +370,7 @@ struct day_items_nb day_process_storage(struct date *slctd_date,
if (slctd_date)
day = *slctd_date;
else
- calendar_store_current_date(&day);
+ ui_calendar_store_current_date(&day);
date = date2sec(day, 0, 0);
@@ -545,7 +545,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, calendar_get_slctd_day_sec(), a_st, a_end);
+ apoint_sec2str(&apt_tmp, ui_calendar_get_slctd_day_sec(), a_st, a_end);
item_in_popup(a_st, a_end, day_item_get_mesg(day), _("Appointment :"));
} else {
diff --git a/src/pcal.c b/src/pcal.c
index 8bcc0b5..e2721e6 100644
--- a/src/pcal.c
+++ b/src/pcal.c
@@ -101,7 +101,7 @@ static void pcal_export_header(FILE * stream)
fputs("# calcurse pcal export\n", stream);
fputs("\n# =======\n# options\n# =======\n", stream);
fprintf(stream, "opt -A -K -l -m -F %s\n",
- calendar_week_begins_on_monday()? "Monday" : "Sunday");
+ ui_calendar_week_begins_on_monday()? "Monday" : "Sunday");
fputs("# Display week number (i.e. 1-52) on every Monday\n", stream);
fprintf(stream, "all monday in all week %%w\n");
fputc('\n', stream);
@@ -172,8 +172,8 @@ static void pcal_export_recur_events(FILE * stream)
EXIT(_("incoherent repetition type"));
}
} else {
- const long YEAR_START = calendar_start_of_year();
- const long YEAR_END = calendar_end_of_year();
+ const long YEAR_START = ui_calendar_start_of_year();
+ const long YEAR_END = ui_calendar_end_of_year();
if (rev->day < YEAR_END && rev->day > YEAR_START)
foreach_date_dump(YEAR_END, rev->rpt, &rev->exc, rev->day, 0,
@@ -237,8 +237,8 @@ static void pcal_export_recur_apoints(FILE * stream)
EXIT(_("incoherent repetition type"));
}
} else {
- const long YEAR_START = calendar_start_of_year();
- const long YEAR_END = calendar_end_of_year();
+ const long YEAR_START = ui_calendar_start_of_year();
+ const long YEAR_END = ui_calendar_end_of_year();
if (rapt->start < YEAR_END && rapt->start > YEAR_START)
foreach_date_dump(YEAR_END, rapt->rpt, &rapt->exc, rapt->start,
diff --git a/src/calendar.c b/src/ui-calendar.c
index cad9ad9..f9749c8 100644
--- a/src/calendar.c
+++ b/src/ui-calendar.c
@@ -67,9 +67,9 @@ enum pom {
};
static struct date today, slctd_day;
-static unsigned calendar_view, week_begins_on_monday;
+static unsigned ui_calendar_view, week_begins_on_monday;
static pthread_mutex_t date_thread_mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_t calendar_t_date;
+static pthread_t ui_calendar_t_date;
static void draw_monthly_view(struct window *, struct date *, unsigned);
static void draw_weekly_view(struct window *, struct date *, unsigned);
@@ -82,33 +82,33 @@ static int monthly_view_cache_valid = 0;
static int monthly_view_cache_month = 0;
/* Switch between calendar views (monthly view is selected by default). */
-void calendar_view_next(void)
+void ui_calendar_view_next(void)
{
- calendar_view++;
- if (calendar_view == CAL_VIEWS)
- calendar_view = 0;
+ ui_calendar_view++;
+ if (ui_calendar_view == CAL_VIEWS)
+ ui_calendar_view = 0;
}
-void calendar_view_prev(void)
+void ui_calendar_view_prev(void)
{
- if (calendar_view == 0)
- calendar_view = CAL_VIEWS;
- calendar_view--;
+ if (ui_calendar_view == 0)
+ ui_calendar_view = CAL_VIEWS;
+ ui_calendar_view--;
}
-void calendar_set_view(int view)
+void ui_calendar_set_view(int view)
{
- calendar_view = (view < 0 || view >= CAL_VIEWS) ? CAL_MONTH_VIEW : view;
+ ui_calendar_view = (view < 0 || view >= CAL_VIEWS) ? CAL_MONTH_VIEW : view;
}
-int calendar_get_view(void)
+int ui_calendar_get_view(void)
{
- return (int)calendar_view;
+ return (int)ui_calendar_view;
}
/* Thread needed to update current date in calendar. */
/* ARGSUSED0 */
-static void *calendar_date_thread(void *arg)
+static void *ui_calendar_date_thread(void *arg)
{
time_t actual, tomorrow;
@@ -118,30 +118,30 @@ static void *calendar_date_thread(void *arg)
while ((actual = time(NULL)) < tomorrow)
sleep(tomorrow - actual);
- calendar_set_current_date();
- calendar_update_panel(&win[CAL]);
+ ui_calendar_set_current_date();
+ ui_calendar_update_panel(&win[CAL]);
}
return NULL;
}
/* Launch the calendar date thread. */
-void calendar_start_date_thread(void)
+void ui_calendar_start_date_thread(void)
{
- pthread_create(&calendar_t_date, NULL, calendar_date_thread, NULL);
+ pthread_create(&ui_calendar_t_date, NULL, ui_calendar_date_thread, NULL);
}
/* Stop the calendar date thread. */
-void calendar_stop_date_thread(void)
+void ui_calendar_stop_date_thread(void)
{
- if (calendar_t_date) {
- pthread_cancel(calendar_t_date);
- pthread_join(calendar_t_date, NULL);
+ if (ui_calendar_t_date) {
+ pthread_cancel(ui_calendar_t_date);
+ pthread_join(ui_calendar_t_date, NULL);
}
}
/* Set static variable today to current date */
-void calendar_set_current_date(void)
+void ui_calendar_set_current_date(void)
{
time_t timer;
struct tm tm;
@@ -157,7 +157,7 @@ void calendar_set_current_date(void)
}
/* Needed to display sunday or monday as the first day of week in calendar. */
-void calendar_set_first_day_of_week(enum wday first_day)
+void ui_calendar_set_first_day_of_week(enum wday first_day)
{
switch (first_day) {
case SUNDAY:
@@ -174,19 +174,19 @@ void calendar_set_first_day_of_week(enum wday first_day)
}
/* Swap first day of week in calendar. */
-void calendar_change_first_day_of_week(void)
+void ui_calendar_change_first_day_of_week(void)
{
week_begins_on_monday = !week_begins_on_monday;
}
/* Return 1 if week begins on monday, 0 otherwise. */
-unsigned calendar_week_begins_on_monday(void)
+unsigned ui_calendar_week_begins_on_monday(void)
{
return week_begins_on_monday;
}
/* Fill in the given variable with the current date. */
-void calendar_store_current_date(struct date *date)
+void ui_calendar_store_current_date(struct date *date)
{
pthread_mutex_lock(&date_thread_mutex);
*date = today;
@@ -194,24 +194,24 @@ void calendar_store_current_date(struct date *date)
}
/* This is to start at the current date in calendar. */
-void calendar_init_slctd_day(void)
+void ui_calendar_init_slctd_day(void)
{
- calendar_store_current_date(&slctd_day);
+ ui_calendar_store_current_date(&slctd_day);
}
/* Return the selected day in calendar */
-struct date *calendar_get_slctd_day(void)
+struct date *ui_calendar_get_slctd_day(void)
{
return &slctd_day;
}
/* Returned value represents the selected day in calendar (in seconds) */
-long calendar_get_slctd_day_sec(void)
+long ui_calendar_get_slctd_day_sec(void)
{
return date2sec(slctd_day, 0, 0);
}
-static int calendar_get_wday(struct date *date)
+static int ui_calendar_get_wday(struct date *date)
{
struct tm t;
@@ -268,7 +268,7 @@ static int date_change(struct tm *date, int delta_month, int delta_day)
}
}
-void calendar_monthly_view_cache_set_invalid(void)
+void ui_calendar_monthly_view_cache_set_invalid(void)
{
monthly_view_cache_valid = 0;
}
@@ -467,7 +467,7 @@ draw_weekly_view(struct window *cwin, struct date *current_day,
OFFX = (wins_sbar_width() - WCALWIDTH) / 2 + 1;
/* Fill in a tm structure with the first day of the selected week. */
- c_wday = calendar_get_wday(&slctd_day);
+ c_wday = ui_calendar_get_wday(&slctd_day);
if (sunday_first)
days_to_remove = c_wday;
else
@@ -571,12 +571,12 @@ draw_weekly_view(struct window *cwin, struct date *current_day,
}
/* Function used to display the calendar panel. */
-void calendar_update_panel(struct window *cwin)
+void ui_calendar_update_panel(struct window *cwin)
{
struct date current_day;
unsigned sunday_first;
- calendar_store_current_date(&current_day);
+ ui_calendar_store_current_date(&current_day);
WINS_CALENDAR_LOCK;
erase_window_part(cwin->p, 1, conf.compact_panels ? 1 : 3, cwin->w - 2,
@@ -585,19 +585,19 @@ void calendar_update_panel(struct window *cwin)
mvwhline(cwin->p, 2, 1, ACS_HLINE, cwin->w - 2);
WINS_CALENDAR_UNLOCK;
- sunday_first = calendar_week_begins_on_monday()? 0 : 1;
+ sunday_first = ui_calendar_week_begins_on_monday()? 0 : 1;
- draw_calendar[calendar_view] (cwin, &current_day, sunday_first);
+ draw_calendar[ui_calendar_view] (cwin, &current_day, sunday_first);
wnoutrefresh(cwin->p);
}
/* Set the selected day in calendar to current day. */
-void calendar_goto_today(void)
+void ui_calendar_goto_today(void)
{
struct date today;
- calendar_store_current_date(&today);
+ ui_calendar_store_current_date(&today);
slctd_day.dd = today.dd;
slctd_day.mm = today.mm;
slctd_day.yyyy = today.yyyy;
@@ -609,7 +609,7 @@ void calendar_goto_today(void)
* If the entered date is empty, automatically jump to the current date.
* slctd_day is updated with the newly selected date.
*/
-void calendar_change_day(int datefmt)
+void ui_calendar_change_day(int datefmt)
{
#define LDAY 11
char selected_day[LDAY] = "";
@@ -630,9 +630,9 @@ void calendar_change_day(int datefmt)
else {
if (strlen(selected_day) == 0) {
wrong_day = 0;
- calendar_goto_today();
+ ui_calendar_goto_today();
} else if (parse_date(selected_day, datefmt, &dyear, &dmonth, &dday,
- calendar_get_slctd_day())) {
+ ui_calendar_get_slctd_day())) {
wrong_day = 0;
/* go to chosen day */
slctd_day.dd = dday;
@@ -649,7 +649,7 @@ void calendar_change_day(int datefmt)
return;
}
-void calendar_move(enum move move, int count)
+void ui_calendar_move(enum move move, int count)
{
int ret, days_to_remove, days_to_add;
struct tm t;
@@ -687,7 +687,7 @@ void calendar_move(enum move move, int count)
case WEEK_START:
/* Normalize struct tm to get week day number. */
mktime(&t);
- if (calendar_week_begins_on_monday())
+ if (ui_calendar_week_begins_on_monday())
days_to_remove = ((t.tm_wday == 0) ? WEEKINDAYS - 1 : t.tm_wday - 1);
else
days_to_remove = ((t.tm_wday == 0) ? 0 : t.tm_wday);
@@ -696,7 +696,7 @@ void calendar_move(enum move move, int count)
break;
case WEEK_END:
mktime(&t);
- if (calendar_week_begins_on_monday())
+ if (ui_calendar_week_begins_on_monday())
days_to_add = ((t.tm_wday == 0) ? 0 : WEEKINDAYS - t.tm_wday);
else
days_to_add = ((t.tm_wday == 0) ?
@@ -727,7 +727,7 @@ void calendar_move(enum move move, int count)
}
/* Returns the beginning of current year as a long. */
-long calendar_start_of_year(void)
+long ui_calendar_start_of_year(void)
{
time_t timer;
struct tm tm;
@@ -744,7 +744,7 @@ long calendar_start_of_year(void)
return (long)timer;
}
-long calendar_end_of_year(void)
+long ui_calendar_end_of_year(void)
{
time_t timer;
struct tm tm;
@@ -892,7 +892,7 @@ static double pom(time_t tmpt)
* Careful: date is the selected day in calendar at 00:00, so it represents
* the phase of the moon for previous day.
*/
-const char *calendar_get_pom(time_t date)
+const char *ui_calendar_get_pom(time_t date)
{
const char *pom_pict[MOON_PHASES] = { " ", "|) ", "(|)", "(| ", " | " };
enum pom phase = NO_POM;
diff --git a/src/ui-day.c b/src/ui-day.c
index c300699..75adb3b 100644
--- a/src/ui-day.c
+++ b/src/ui-day.c
@@ -242,7 +242,7 @@ static void update_rept(struct rpt **rpt, const long start)
int newmonth, newday, newyear;
if (parse_date(timstr, conf.input_datefmt, &newyear, &newmonth,
- &newday, calendar_get_slctd_day())) {
+ &newday, ui_calendar_get_slctd_day())) {
t = start;
localtime_r(&t, &lt);
new_date.dd = newday;
@@ -360,7 +360,7 @@ void ui_day_item_edit(void)
break;
}
- calendar_monthly_view_cache_set_invalid();
+ ui_calendar_monthly_view_cache_set_invalid();
if (need_check_notify)
notify_check_next_app(1);
@@ -490,18 +490,18 @@ void ui_day_item_add(void)
status_mesg(mesg_3, "");
if (getstring(win[STA].p, item_mesg, BUFSIZ, 0, 1) == GETSTRING_VALID) {
if (is_appointment) {
- apoint_start = date2sec(*calendar_get_slctd_day(), heures, minutes);
+ apoint_start = date2sec(*ui_calendar_get_slctd_day(), heures, minutes);
apoint_new(item_mesg, 0L, apoint_start, min2sec(apoint_duration), 0L);
if (notify_bar())
notify_check_added(item_mesg, apoint_start, 0L);
} else
- event_new(item_mesg, 0L, date2sec(*calendar_get_slctd_day(), 0, 0), Id);
+ event_new(item_mesg, 0L, date2sec(*ui_calendar_get_slctd_day(), 0, 0), Id);
if (ui_day_hilt() == 0)
ui_day_hilt_increase(1);
}
- calendar_monthly_view_cache_set_invalid();
+ ui_calendar_monthly_view_cache_set_invalid();
wins_erase_status_bar();
}
@@ -524,7 +524,7 @@ void ui_day_item_delete(unsigned *nb_events, unsigned *nb_apoints,
const char *note_choices = _("[in]");
const int nb_note_choices = 2;
- long date = calendar_get_slctd_day_sec();
+ long date = ui_calendar_get_slctd_day_sec();
int nb_items = *nb_apoints + *nb_events;
int to_be_removed = 0;
@@ -585,7 +585,7 @@ void ui_day_item_delete(unsigned *nb_events, unsigned *nb_apoints,
/* NOTREACHED */
}
- calendar_monthly_view_cache_set_invalid();
+ ui_calendar_monthly_view_cache_set_invalid();
if (ui_day_hilt() > 1)
ui_day_hilt_decrease(1);
@@ -687,7 +687,7 @@ void ui_day_item_repeat(void)
date_entered = 1;
} else {
if (parse_date(user_input, conf.input_datefmt,
- &year, &month, &day, calendar_get_slctd_day())) {
+ &year, &month, &day, ui_calendar_get_slctd_day())) {
t = p->start;
localtime_r(&t, &lt);
until_date.dd = day;
@@ -713,7 +713,7 @@ void ui_day_item_repeat(void)
return;
}
- date = calendar_get_slctd_day_sec();
+ date = ui_calendar_get_slctd_day_sec();
if (p->type == EVNT) {
struct event *ev = p->item.ev;
recur_event_new(ev->mesg, ev->note, ev->day, ev->id, type, freq, until,
@@ -734,7 +734,7 @@ void ui_day_item_repeat(void)
day_cut[REG_BLACK_HOLE].type = p->type;
day_cut[REG_BLACK_HOLE].item = p->item;
- calendar_monthly_view_cache_set_invalid();
+ ui_calendar_monthly_view_cache_set_invalid();
}
/* Free the current cut item, if any. */
@@ -783,9 +783,9 @@ void ui_day_item_paste(unsigned *nb_events, unsigned *nb_apoints,
return;
day_item_fork(&day_cut[reg], &day);
- item_type = day_paste_item(&day, calendar_get_slctd_day_sec());
+ item_type = day_paste_item(&day, ui_calendar_get_slctd_day_sec());
- calendar_monthly_view_cache_set_invalid();
+ ui_calendar_monthly_view_cache_set_invalid();
if (item_type == EVNT || item_type == RECUR_EVNT)
(*nb_events)++;
@@ -884,7 +884,7 @@ void ui_day_update_panel(int which_pan)
struct date slctd_date;
/* variable inits */
- slctd_date = *calendar_get_slctd_day();
+ slctd_date = *ui_calendar_get_slctd_day();
title_xpos = win[APP].w - (strlen(_(monthnames[slctd_date.mm - 1])) + 16);
if (slctd_date.dd < 10)
title_xpos++;
@@ -895,7 +895,7 @@ void ui_day_update_panel(int which_pan)
erase_window_part(win[APP].p, 1, title_lines, win[APP].w - 2, win[APP].h - 2);
custom_apply_attr(win[APP].p, ATTR_HIGHEST);
mvwprintw(win[APP].p, title_lines, title_xpos, "%s %s %d, %d",
- calendar_get_pom(date), _(monthnames[slctd_date.mm - 1]),
+ ui_calendar_get_pom(date), _(monthnames[slctd_date.mm - 1]),
slctd_date.dd, slctd_date.yyyy);
custom_remove_attr(win[APP].p, ATTR_HIGHEST);
diff --git a/src/utils.c b/src/utils.c
index 1192ed8..7baa961 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -80,7 +80,7 @@ void exit_calcurse(int status)
} else
was_interactive = 0;
- calendar_stop_date_thread();
+ ui_calendar_stop_date_thread();
io_stop_psave_thread();
free_user_data();
keys_free();
diff --git a/src/vars.c b/src/vars.c
index a54b702..0235089 100644
--- a/src/vars.c
+++ b/src/vars.c
@@ -161,7 +161,7 @@ void vars_init(void)
wins_set_layout(1);
- calendar_set_first_day_of_week(MONDAY);
+ ui_calendar_set_first_day_of_week(MONDAY);
/* Pad structure to scroll text inside the appointment panel */
apad.length = 1;
@@ -171,5 +171,5 @@ void vars_init(void)
custom_init_attr();
/* Start at the current date */
- calendar_init_slctd_day();
+ ui_calendar_init_slctd_day();
}
diff --git a/src/wins.c b/src/wins.c
index 6274a19..d8f1f45 100644
--- a/src/wins.c
+++ b/src/wins.c
@@ -499,7 +499,7 @@ void wins_update_panels(int flags)
if (flags & FLAG_TOD)
ui_todo_update_panel(slctd_win);
if (flags & FLAG_CAL)
- calendar_update_panel(&win[CAL]);
+ ui_calendar_update_panel(&win[CAL]);
}
/*