[evolution-ews/gnome-3-6] Bug #692705 - Disable reminders for subscribed calendars of other users



commit ae54270bedc12a6eba2a653f3438f1e067a38838
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jan 30 19:01:17 2013 +0100

    Bug #692705 - Disable reminders for subscribed calendars of other users

 src/collection/e-ews-backend.c |   22 ++++++++++++++++++++++
 src/server/e-ews-folder.c      |    6 +++++-
 2 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/src/collection/e-ews-backend.c b/src/collection/e-ews-backend.c
index 3cba759..b4aacf1 100644
--- a/src/collection/e-ews-backend.c
+++ b/src/collection/e-ews-backend.c
@@ -206,6 +206,28 @@ ews_backend_new_child (EEwsBackend *backend,
 	e_source_backend_set_backend_name (
 		E_SOURCE_BACKEND (extension), "ews");
 
+	if (e_ews_folder_get_folder_type (folder) != E_EWS_FOLDER_TYPE_CONTACTS &&
+	    !e_source_has_extension (source, E_SOURCE_EXTENSION_EWS_FOLDER) &&
+	    !e_source_has_extension (source, E_SOURCE_EXTENSION_ALARMS)) {
+		/* a completely new ESource, do not notify with too old reminders */
+		ESourceAlarms *alarms;
+		gchar *today;
+		GTimeVal today_tv;
+		GDate dt;
+
+		g_date_clear (&dt, 1);
+		g_get_current_time (&today_tv);
+		g_date_set_time_val (&dt, &today_tv);
+
+		/* midnight UTC */
+		today = g_strdup_printf ("%04d-%02d-%02dT00:00:00Z", g_date_get_year (&dt), g_date_get_month (&dt), g_date_get_day (&dt));
+
+		alarms = e_source_get_extension (source, E_SOURCE_EXTENSION_ALARMS);
+		e_source_alarms_set_last_notified (alarms, today);
+
+		g_free (today);
+	}
+
 	extension_name = E_SOURCE_EXTENSION_EWS_FOLDER;
 	extension = e_source_get_extension (source, extension_name);
 	e_source_ews_folder_set_id (
diff --git a/src/server/e-ews-folder.c b/src/server/e-ews-folder.c
index 80d2e0c..e5cfcba 100644
--- a/src/server/e-ews-folder.c
+++ b/src/server/e-ews-folder.c
@@ -511,7 +511,7 @@ e_ews_folder_utils_populate_esource (ESource *source,
 			ESourceEwsFolder *folder_ext;
 			ESourceOffline *offline_ext;
 
-			e_source_backend_set_backend_name (backend_ext , "ews");
+			e_source_backend_set_backend_name (backend_ext, "ews");
 
 			folder_ext = e_source_get_extension (source, E_SOURCE_EXTENSION_EWS_FOLDER);
 			e_source_ews_folder_set_id (folder_ext, folder_id->id);
@@ -523,6 +523,7 @@ e_ews_folder_utils_populate_esource (ESource *source,
 
 			/* set also color for calendar-like sources */
 			if (folder_type != E_EWS_FOLDER_TYPE_CONTACTS) {
+				ESourceAlarms *alarms;
 				gchar *color_str;
 
 				color_str = e_ews_folder_utils_pick_color_spec (
@@ -530,6 +531,9 @@ e_ews_folder_utils_populate_esource (ESource *source,
 					folder_type != E_EWS_FOLDER_TYPE_CALENDAR);
 				e_source_selectable_set_color (E_SOURCE_SELECTABLE (backend_ext), color_str);
 				g_free (color_str);
+
+				alarms = e_source_get_extension (source, E_SOURCE_EXTENSION_ALARMS);
+				e_source_alarms_set_include_me (alarms, FALSE);
 			}
 
 			res = TRUE;



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