aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/alarm-notify/config-data.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-07-27 23:06:20 +0800
committerMilan Crha <mcrha@redhat.com>2009-07-27 23:06:20 +0800
commit704ee96aa27011109be2b282517abc153657edaf (patch)
tree4025e5c25143db9b766192ec73f299d0e5b7a7ee /calendar/gui/alarm-notify/config-data.c
parent5ea01cdeff88387ecfba874307fc938fbbfd1382 (diff)
downloadgsoc2013-evolution-704ee96aa27011109be2b282517abc153657edaf.tar
gsoc2013-evolution-704ee96aa27011109be2b282517abc153657edaf.tar.gz
gsoc2013-evolution-704ee96aa27011109be2b282517abc153657edaf.tar.bz2
gsoc2013-evolution-704ee96aa27011109be2b282517abc153657edaf.tar.lz
gsoc2013-evolution-704ee96aa27011109be2b282517abc153657edaf.tar.xz
gsoc2013-evolution-704ee96aa27011109be2b282517abc153657edaf.tar.zst
gsoc2013-evolution-704ee96aa27011109be2b282517abc153657edaf.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.c37
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;