diff options
author | Milan Crha <mcrha@redhat.com> | 2009-07-27 23:06:20 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-07-29 00:22:15 +0800 |
commit | fe2f720c14d3f39ca6694f1b56b7f4e8121e732b (patch) | |
tree | 45055b0c31070150b15cd14d693e7bb92f93d82d /calendar/gui/alarm-notify/config-data.c | |
parent | 2c4510e858fcf96e8f3d02f3f92564460752e983 (diff) | |
download | gsoc2013-evolution-fe2f720c14d3f39ca6694f1b56b7f4e8121e732b.tar gsoc2013-evolution-fe2f720c14d3f39ca6694f1b56b7f4e8121e732b.tar.gz gsoc2013-evolution-fe2f720c14d3f39ca6694f1b56b7f4e8121e732b.tar.bz2 gsoc2013-evolution-fe2f720c14d3f39ca6694f1b56b7f4e8121e732b.tar.lz gsoc2013-evolution-fe2f720c14d3f39ca6694f1b56b7f4e8121e732b.tar.xz gsoc2013-evolution-fe2f720c14d3f39ca6694f1b56b7f4e8121e732b.tar.zst gsoc2013-evolution-fe2f720c14d3f39ca6694f1b56b7f4e8121e732b.zip |
Bug #579646 - Remember alarm's last notified per calendar
Diffstat (limited to 'calendar/gui/alarm-notify/config-data.c')
-rw-r--r-- | calendar/gui/alarm-notify/config-data.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/calendar/gui/alarm-notify/config-data.c b/calendar/gui/alarm-notify/config-data.c index 8f3b0aebc1..c66819f0c4 100644 --- a/calendar/gui/alarm-notify/config-data.c +++ b/calendar/gui/alarm-notify/config-data.c @@ -256,13 +256,30 @@ config_data_get_notify_with_tray (void) * triggered while it was not running. **/ void -config_data_set_last_notification_time (time_t t) +config_data_set_last_notification_time (ECal *cal, time_t t) { GConfClient *client; time_t current_t, now = time (NULL); g_return_if_fail (t != -1); + if (cal) { + ESource *source = e_cal_get_source (cal); + if (source) { + GTimeVal tmval = {0}; + char *as_text; + + tmval.tv_sec = (glong) t; + as_text = g_time_val_to_iso8601 (&tmval); + + if (as_text) { + e_source_set_property (source, "last-notified", as_text); + g_free (as_text); + return; + } + } + } + if (!(client = config_data_get_conf_client ())) return; @@ -281,11 +298,27 @@ config_data_set_last_notification_time (time_t t) * Return value: The last saved value, or -1 if no value had been saved before. **/ time_t -config_data_get_last_notification_time (void) +config_data_get_last_notification_time (ECal *cal) { GConfValue *value; GConfClient *client; + if (cal) { + ESource *source = e_cal_get_source (cal); + if (source) { + const gchar *last_notified = e_source_get_property (source, "last-notified"); + GTimeVal tmval = {0}; + + if (last_notified && *last_notified && g_time_val_from_iso8601 (last_notified, &tmval)) { + time_t now = time (NULL), val = (time_t) tmval.tv_sec; + + if (val > now) + val = now; + return val; + } + } + } + if (!(client = config_data_get_conf_client ())) return -1; |