[evolution/gnome-3-2] Bug #659517 - Calendar reminds of old events following upgrade



commit 08c9a7506ea63e37a449be87b78fb5dd1453dca3
Author: Milan Crha <mcrha redhat com>
Date:   Thu Sep 29 14:30:11 2011 +0200

    Bug #659517 - Calendar reminds of old events following upgrade

 calendar/gui/alarm-notify/config-data.c |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/calendar/gui/alarm-notify/config-data.c b/calendar/gui/alarm-notify/config-data.c
index d056131..b682686 100644
--- a/calendar/gui/alarm-notify/config-data.c
+++ b/calendar/gui/alarm-notify/config-data.c
@@ -270,16 +270,25 @@ config_data_set_last_notification_time (ECalClient *cal,
 	if (cal) {
 		ESource *source = e_client_get_source (E_CLIENT (cal));
 		if (source) {
-			GTimeVal tmval = {0};
-			gchar *as_text;
+			const gchar *prop_str;
+			GTimeVal curr_tv = {0};
+
+			prop_str = e_source_get_property (source, "last-notified");
+			if (!prop_str || !g_time_val_from_iso8601 (prop_str, &curr_tv))
+				curr_tv.tv_sec = 0;
+
+			if (t > (time_t) curr_tv.tv_sec || (time_t) curr_tv.tv_sec > now) {
+				GTimeVal tmval = {0};
+				gchar *as_text;
 
-			tmval.tv_sec = (glong) t;
-			as_text = g_time_val_to_iso8601 (&tmval);
+				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 (as_text) {
+					e_source_set_property (source, "last-notified", as_text);
+					g_free (as_text);
+					/* pass through, thus the global last notification time is also changed */
+				}
 			}
 		}
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]