Avoid multiple notifications of the same appointment when running in background.

This commit is contained in:
Frederic Culot 2009-07-29 19:11:57 +00:00
parent 35e4aa61c7
commit 5181d90b01
2 changed files with 13 additions and 5 deletions

View File

@ -5,6 +5,9 @@
* src/io.c (io_extract_data): do not read past the maximum length * src/io.c (io_extract_data): do not read past the maximum length
* src/dmon.c (dmon_start): avoid multiple notifications of the
same appointment
2009-07-27 Frederic Culot <frederic@culot.org> 2009-07-27 Frederic Culot <frederic@culot.org>
* src/utils.c (free_user_data): new function * src/utils.c (free_user_data): new function

View File

@ -1,4 +1,4 @@
/* $calcurse: dmon.c,v 1.7 2009/07/27 21:02:55 culot Exp $ */ /* $calcurse: dmon.c,v 1.8 2009/07/29 19:11:58 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -161,6 +161,7 @@ daemonize (int status)
void void
dmon_start (int parent_exit_status) dmon_start (int parent_exit_status)
{ {
struct notify_app_s next;
conf_t conf; conf_t conf;
if (!daemonize (parent_exit_status)) if (!daemonize (parent_exit_status))
@ -182,11 +183,12 @@ dmon_start (int parent_exit_status)
io_load_app (); io_load_app ();
data_loaded = 1; data_loaded = 1;
next.got_app = 0;
for (;;) for (;;)
{ {
struct notify_app_s next; if (!next.got_app)
(void)notify_get_next (&next); (void)notify_get_next (&next);
if (next.got_app) if (next.got_app)
{ {
int left; int left;
@ -195,7 +197,10 @@ dmon_start (int parent_exit_status)
left = notify_time_left (); left = notify_time_left ();
if (left < nbar.cntdwn) if (left < nbar.cntdwn)
{
notify_launch_cmd (); notify_launch_cmd ();
next.got_app = 0;
}
} }
if (next.txt) if (next.txt)