aboutsummaryrefslogtreecommitdiffstats
path: root/src/day.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-06-26 13:54:52 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-06-30 14:34:35 +0200
commit318e685ffe73587a01049d92aa0f60a46c1cfb16 (patch)
tree3e523f07c69b3ffb20fa94f888dd98e4d2ea3eaa /src/day.c
parent02c90ba53a658686bad5cb5f88c555d9eef06399 (diff)
downloadcalcurse-318e685ffe73587a01049d92aa0f60a46c1cfb16.tar.gz
calcurse-318e685ffe73587a01049d92aa0f60a46c1cfb16.zip
Add an item parameter to various day_*() functions
These functions operate on arbitrary items. Pull out the code that gets the currently selected item, get the current selection when one of the functions is called and pass it as a parameter. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/day.c')
-rw-r--r--src/day.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/day.c b/src/day.c
index e4a0265..5d67d46 100644
--- a/src/day.c
+++ b/src/day.c
@@ -480,10 +480,8 @@ void day_write_stdout(long date, const char *fmt_apt, const char *fmt_rapt,
}
/* Display an item inside a popup window. */
-void day_popup_item(void)
+void day_popup_item(struct day_item *day)
{
- struct day_item *day = day_get_item(apoint_hilt());
-
if (day->type == EVNT || day->type == RECUR_EVNT) {
item_in_popup(NULL, NULL, day_item_get_mesg(day), _("Event :"));
} else if (day->type == APPT || day->type == RECUR_APPT) {
@@ -681,12 +679,10 @@ int day_item_nb(long date, int day_num, int type)
}
/* Attach a note to an appointment or event. */
-void day_edit_note(const char *editor)
+void day_edit_note(struct day_item *p, const char *editor)
{
- struct day_item *p;
char *note;
- p = day_get_item(apoint_hilt());
note = day_item_get_note(p);
edit_note(&note, editor);
@@ -707,17 +703,14 @@ void day_edit_note(const char *editor)
}
/* View a note previously attached to an appointment or event */
-void day_view_note(const char *pager)
+void day_view_note(struct day_item *p, const char *pager)
{
- struct day_item *p = day_get_item(apoint_hilt());
view_note(day_item_get_note(p), pager);
}
/* Switch notification state for an item. */
-void day_item_switch_notify(void)
+void day_item_switch_notify(struct day_item *p)
{
- struct day_item *p = day_get_item(apoint_hilt());
-
switch (p->type) {
case RECUR_APPT:
recur_apoint_switch_notify(p->item.rapt);