aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/apoint.c23
-rw-r--r--src/calcurse.c2
-rw-r--r--src/calcurse.h3
-rw-r--r--src/day.c15
4 files changed, 19 insertions, 24 deletions
diff --git a/src/apoint.c b/src/apoint.c
index 16efd25..d6def9d 100644
--- a/src/apoint.c
+++ b/src/apoint.c
@@ -547,34 +547,13 @@ struct notify_app *apoint_check_next(struct notify_app *app, long start)
/*
* Switch notification state.
*/
-void apoint_switch_notify(void)
+void apoint_switch_notify(struct apoint *apt)
{
- struct day_item *p;
- long date;
- int apoint_nb = 0, need_chk_notify;
-
- p = day_get_item(hilt);
- if (p->type != APPT && p->type != RECUR_APPT)
- return;
-
- date = calendar_get_slctd_day_sec();
-
- if (p->type == RECUR_APPT) {
- recur_apoint_switch_notify(p->item.rapt);
- return;
- } else if (p->type == APPT)
- apoint_nb = day_item_nb(date, hilt, APPT);
-
- need_chk_notify = 0;
LLIST_TS_LOCK(&alist_p);
- struct apoint *apt = apoint_get(date, apoint_nb);
-
apt->state ^= APOINT_NOTIFY;
if (notify_bar())
notify_check_added(apt->mesg, apt->start, apt->state);
- if (need_chk_notify)
- notify_check_next_app(0);
LLIST_TS_UNLOCK(&alist_p);
}
diff --git a/src/calcurse.c b/src/calcurse.c
index 09baab5..8a796ff 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -311,7 +311,7 @@ int main(int argc, char **argv)
case KEY_FLAG_ITEM:
if (wins_slctd() == APP && apoint_hilt() != 0) {
- apoint_switch_notify();
+ day_item_switch_notify();
inday = do_storage(0);
wins_update(FLAG_APP);
} else if (wins_slctd() == TOD && todo_hilt() != 0) {
diff --git a/src/calcurse.h b/src/calcurse.h
index be2229b..c3233bb 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -612,7 +612,7 @@ void apoint_delete_bynum(long, unsigned, enum eraseflg);
void apoint_scroll_pad_down(int, int);
void apoint_scroll_pad_up(int);
struct notify_app *apoint_check_next(struct notify_app *, long);
-void apoint_switch_notify(void);
+void apoint_switch_notify(struct apoint *);
void apoint_update_panel(int);
void apoint_paste_item(void);
@@ -682,6 +682,7 @@ int day_item_nb(long, int, int);
void day_edit_note(const char *);
void day_view_note(const char *);
void day_pipe_item(void);
+void day_item_switch_notify(void);
/* dmon.c */
void dmon_start(int);
diff --git a/src/day.c b/src/day.c
index 23aa757..bc40d77 100644
--- a/src/day.c
+++ b/src/day.c
@@ -1154,3 +1154,18 @@ void day_pipe_item(void)
}
wins_unprepare_external();
}
+
+/* Switch notification state for an item. */
+void day_item_switch_notify(void)
+{
+ struct day_item *p = day_get_item(apoint_hilt());
+
+ switch (p->type) {
+ case RECUR_APPT:
+ recur_apoint_switch_notify(p->item.rapt);
+ break;
+ case APPT:
+ apoint_switch_notify(p->item.apt);
+ break;
+ }
+}