diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2011-07-29 18:01:38 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2011-07-29 20:28:30 +0200 |
commit | 5a5c6d2604664478306b29b64bf876d7403b74bb (patch) | |
tree | 7fe273e883542e17ebd2e557b792c8ef1ed3cf92 | |
parent | 8681af3c6d43ab7aa48dc49cd12058e9ba3d488e (diff) | |
download | calcurse-5a5c6d2604664478306b29b64bf876d7403b74bb.zip |
Add "force" parameter to notify_check_next_app()
This allows to force notify_check_next_app() to update the notification
appointment, even if start times are equal (e.g. if the item description
was changed).
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r-- | src/apoint.c | 4 | ||||
-rw-r--r-- | src/calcurse.h | 2 | ||||
-rw-r--r-- | src/notify.c | 14 | ||||
-rw-r--r-- | src/recur.c | 4 |
4 files changed, 13 insertions, 11 deletions
diff --git a/src/apoint.c b/src/apoint.c index ab3fab5..8771426 100644 --- a/src/apoint.c +++ b/src/apoint.c @@ -516,7 +516,7 @@ apoint_delete_bynum (long start, unsigned num, enum eraseflg flag) erase_note (&apt->note, flag); mem_free (apt); if (need_check_notify) - notify_check_next_app (); + notify_check_next_app (0); break; } @@ -663,7 +663,7 @@ apoint_switch_notify (void) if (notify_bar ()) notify_check_added (apt->mesg, apt->start, apt->state); if (need_chk_notify) - notify_check_next_app (); + notify_check_next_app (0); LLIST_TS_UNLOCK (&alist_p); } diff --git a/src/calcurse.h b/src/calcurse.h index e3822ef..383f53e 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -751,7 +751,7 @@ void notify_update_bar (void); unsigned notify_get_next (struct notify_app *); unsigned notify_get_next_bkgd (void); char *notify_app_txt (void); -void notify_check_next_app (void); +void notify_check_next_app (int); void notify_check_added (char *, long, char); void notify_check_repeated (struct recur_apoint *); int notify_same_item (long); diff --git a/src/notify.c b/src/notify.c index 14a5f0c..6fedb71 100644 --- a/src/notify.c +++ b/src/notify.c @@ -306,7 +306,7 @@ notify_update_bar (void) notify_app.got_app = 0; pthread_mutex_unlock (¬ify_app.mutex); pthread_mutex_unlock (¬ify.mutex); - notify_check_next_app (); + notify_check_next_app (0); return; } } @@ -353,7 +353,7 @@ notify_main_thread (void *arg) got_app = notify_app.got_app; pthread_mutex_unlock (¬ify_app.mutex); if (!got_app) - notify_check_next_app (); + notify_check_next_app (0); } } pthread_exit ((void *) 0); @@ -427,6 +427,7 @@ static void * notify_thread_app (void *arg) { struct notify_app tmp_app; + int force = (arg ? 1 : 0); if (!notify_get_next (&tmp_app)) pthread_exit ((void *)0); @@ -439,7 +440,7 @@ notify_thread_app (void *arg) } else { - if (!notify_same_item (tmp_app.time)) + if (force || !notify_same_item (tmp_app.time)) { pthread_mutex_lock (¬ify_app.mutex); notify_update_app (tmp_app.time, tmp_app.state, tmp_app.txt); @@ -456,12 +457,13 @@ notify_thread_app (void *arg) /* Launch the thread notify_thread_app to look for next appointment. */ void -notify_check_next_app (void) +notify_check_next_app (int force) { pthread_t notify_t_app; + void *arg = (force ? (void *)1 : (void *)0); pthread_create (¬ify_t_app, &detached_thread_attr, notify_thread_app, - (void *)0); + arg); return; } @@ -566,7 +568,7 @@ void notify_start_main_thread (void) { pthread_create (¬ify_t_main, NULL, notify_main_thread, NULL); - notify_check_next_app (); + notify_check_next_app (0); } /* diff --git a/src/recur.c b/src/recur.c index 430e543..b2980fc 100644 --- a/src/recur.c +++ b/src/recur.c @@ -811,7 +811,7 @@ recur_apoint_erase (long start, unsigned num, unsigned delete_whole, erase_note (&rapt->note, flag); mem_free (rapt); if (need_check_notify) - notify_check_next_app (); + notify_check_next_app (0); break; } } @@ -819,7 +819,7 @@ recur_apoint_erase (long start, unsigned num, unsigned delete_whole, { recur_add_exc (&rapt->exc, start); if (need_check_notify) - notify_check_next_app (); + notify_check_next_app (0); } LLIST_TS_UNLOCK (&recur_alist_p); } |