Re: [evolution-patches] Fix for #56320 and related timezone issues



Changes added..

thanks,
harish

Index: servers/groupwise/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/ChangeLog,v
retrieving revision 1.44
diff -u -p -r1.44 ChangeLog
--- servers/groupwise/ChangeLog	18 May 2004 05:37:16 -0000	1.44
+++ servers/groupwise/ChangeLog	18 May 2004 14:47:04 -0000
@@ -1,3 +1,24 @@
+2004-05-18  Harish Krishnaswamy  <kharish novell com>
+	
+	Fixes #56320 and related timezone issues.
+	All datetime related fields are stored as strings and
+	not as time_t structures.
+       
+	* e-gw-connection.c: (e_gw_connection_format_date_string):
+	Convert the Groupwise datetime string into the format preferred
+	by the ical library.
+	* e-gw-connection.h:
+	* e-gw-item.c: (e_gw_item_init),
+	(e_gw_item_new_from_soap_parameter), (e_gw_item_get_creation_date),
+	(e_gw_item_set_creation_date), (e_gw_item_get_start_date),
+	(e_gw_item_set_start_date), (e_gw_item_get_end_date),
+	(e_gw_item_set_end_date), (e_gw_item_get_due_date),
+	(e_gw_item_set_due_date), (e_gw_item_append_to_soap_message),
+	(append_event_changes_to_soap_message):
+	Replace all time_t related conversions with string<->icaltimetype.
+	* e-gw-item.h: Update arguments and return values on the get/set
+	functions.
+
 2004-05-18  Sivaiah Nallagatla <snallagatla novell com>
 
 	* e-gw-item.c (set_contact_fields_from_soap_parameter) : read
organization_id
Index: servers/groupwise/e-gw-connection.c
===================================================================
RCS file:
/cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.c,v
retrieving revision 1.73
diff -u -p -r1.73 e-gw-connection.c
--- servers/groupwise/e-gw-connection.c	14 May 2004 14:22:56 -0000	1.73
+++ servers/groupwise/e-gw-connection.c	18 May 2004 14:47:05 -0000
@@ -995,6 +995,24 @@ timet_from_string (const char *str)
 	return mktime (&date);
 }
 
+char *
+e_gw_connection_format_date_string (const char *dtstring)
+{
+        char *str2;
+        int i, j, len = strlen (dtstring);
+	
+        str2 = g_malloc0 (len);
+        for (i = 0,j = 0; i < len; i++) {
+                if ((dtstring[i] != '-') && (dtstring[i] != ':')) {
+			str2[j] = dtstring[i];
+			j++;
+                }
+        }
+
+	str2[j] = '\0';
+        return str2;
+}
+
 time_t
 e_gw_connection_get_date_from_string (const char *dtstring)
 {
Index: servers/groupwise/e-gw-connection.h
===================================================================
RCS file:
/cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.h,v
retrieving revision 1.29
diff -u -p -r1.29 e-gw-connection.h
--- servers/groupwise/e-gw-connection.h	29 Apr 2004 14:19:48 -0000	1.29
+++ servers/groupwise/e-gw-connection.h	18 May 2004 14:47:05 -0000
@@ -87,6 +87,8 @@ const char         *e_gw_connection_get_
 
 
 time_t              e_gw_connection_get_date_from_string (const char
*dtstring);
+char               *e_gw_connection_format_date_string (const char
*dtstring);
+
 
 EGwConnectionStatus e_gw_connection_create_item (EGwConnection *cnc,
EGwItem *item, char** id);
 EGwConnectionStatus e_gw_connection_get_item (EGwConnection *cnc, const
char *container, const char *id, EGwItem **item);
Index: servers/groupwise/e-gw-item.c
===================================================================
RCS file:
/cvs/gnome/evolution-data-server/servers/groupwise/e-gw-item.c,v
retrieving revision 1.31
diff -u -p -r1.31 e-gw-item.c
--- servers/groupwise/e-gw-item.c	18 May 2004 05:37:16 -0000	1.31
+++ servers/groupwise/e-gw-item.c	18 May 2004 14:47:05 -0000
@@ -38,10 +38,10 @@ struct _EGwItemPrivate {
 
 	/* properties */
 	char *id;
-	time_t creation_date;
-	time_t start_date;
-	time_t end_date;
-	time_t due_date;
+	char *creation_date;
+	char *start_date;
+	char *end_date;
+	char *due_date;
 	gboolean completed;
 	char *subject;
 	char *message;
@@ -301,10 +301,10 @@ e_gw_item_init (EGwItem *item, EGwItemCl
 	/* allocate internal structure */
 	priv = g_new0 (EGwItemPrivate, 1);
 	priv->item_type = E_GW_ITEM_TYPE_UNKNOWN;
-	priv->creation_date = -1;
-	priv->start_date = -1;
-	priv->end_date = -1;
-	priv->due_date = -1;
+	priv->creation_date = NULL;
+	priv->start_date = NULL;
+	priv->end_date = NULL; 
+	priv->due_date = NULL; 
 	priv->trigger = 0;
 	priv->recipient_list = NULL;
 	priv->completed = FALSE;
@@ -1247,9 +1247,12 @@ e_gw_item_new_from_soap_parameter (const
 			g_free (value);
 
 		} else if (!g_ascii_strcasecmp (name, "created")) {
+			char *formatted_date;
 			value = soup_soap_parameter_get_string_value (child);
-			item->priv->creation_date = e_gw_connection_get_date_from_string
(value);
+			formatted_date = e_gw_connection_format_date_string (value);
+			e_gw_item_set_creation_date (item, formatted_date);
 			g_free (value);
+			g_free (formatted_date);
 
 		} else if (!g_ascii_strcasecmp (name, "distribution")) {
 			SoupSoapParameter *tp;
@@ -1262,14 +1265,20 @@ e_gw_item_new_from_soap_parameter (const
 			}
 
 		} else if (!g_ascii_strcasecmp (name, "dueDate")) {
+			char *formatted_date; 
 			value = soup_soap_parameter_get_string_value (child);
-			item->priv->due_date = e_gw_connection_get_date_from_string (value);
+			formatted_date = e_gw_connection_format_date_string (value);
+			e_gw_item_set_due_date (item, formatted_date);
 			g_free (value);
-
+			g_free (formatted_date);
+			
 		} else if (!g_ascii_strcasecmp (name, "endDate")) {
+			char *formatted_date; 
 			value = soup_soap_parameter_get_string_value (child);
-			item->priv->end_date = e_gw_connection_get_date_from_string (value);
+			formatted_date = e_gw_connection_format_date_string (value);
+			e_gw_item_set_end_date (item, formatted_date);
 			g_free (value);
+			g_free (formatted_date); 
 
 		} else if (!g_ascii_strcasecmp (name, "iCalId"))
 			item->priv->icalid = soup_soap_parameter_get_string_value (child);
@@ -1294,8 +1303,10 @@ e_gw_item_new_from_soap_parameter (const
 			item->priv->priority = soup_soap_parameter_get_string_value (child);
 
 		else if (!g_ascii_strcasecmp (name, "startDate")) {
+			char *formatted_date;
 			value = soup_soap_parameter_get_string_value (child);
-			item->priv->start_date = e_gw_connection_get_date_from_string
(value);
+			formatted_date = e_gw_connection_format_date_string (value);
+			e_gw_item_set_start_date (item, formatted_date);
 			g_free (value);
 
 		} else if (!g_ascii_strcasecmp (name, "subject"))
@@ -1387,68 +1398,76 @@ e_gw_item_set_id (EGwItem *item, const c
 	item->priv->id = g_strdup (new_id);
 }
 
-time_t
+char *
 e_gw_item_get_creation_date (EGwItem *item)
 {
-	g_return_val_if_fail (E_IS_GW_ITEM (item), -1);
+	g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
 
 	return item->priv->creation_date;
 }
 
 void
-e_gw_item_set_creation_date (EGwItem *item, time_t new_date)
+e_gw_item_set_creation_date (EGwItem *item, const char *new_date)
 {
 	g_return_if_fail (E_IS_GW_ITEM (item));
 
-	item->priv->creation_date = new_date;
+	if (item->priv->creation_date)
+		g_free (item->priv->creation_date);
+	item->priv->creation_date = g_strdup (new_date);
 }
 
-time_t
+char *
 e_gw_item_get_start_date (EGwItem *item)
 {
-	g_return_val_if_fail (E_IS_GW_ITEM (item), -1);
+	g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
 
 	return item->priv->start_date;
 }
 
 void
-e_gw_item_set_start_date (EGwItem *item, time_t new_date)
+e_gw_item_set_start_date (EGwItem *item, const char *new_date)
 {
 	g_return_if_fail (E_IS_GW_ITEM (item));
 
-	item->priv->start_date = new_date;
+	if (item->priv->start_date)
+		g_free (item->priv->start_date);
+	item->priv->start_date = g_strdup (new_date);
 }
 
-time_t
+char *
 e_gw_item_get_end_date (EGwItem *item)
 {
-	g_return_val_if_fail (E_IS_GW_ITEM (item), -1);
+	g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
 
 	return item->priv->end_date;
 }
 
 void
-e_gw_item_set_end_date (EGwItem *item, time_t new_date)
+e_gw_item_set_end_date (EGwItem *item, const char *new_date)
 {
 	g_return_if_fail (E_IS_GW_ITEM (item));
 
-	item->priv->end_date = new_date;
+	if (item->priv->end_date)
+		g_free (item->priv->end_date);
+	item->priv->end_date = g_strdup (new_date);
 }
 
-time_t
+char *
 e_gw_item_get_due_date (EGwItem *item)
 {
-	g_return_val_if_fail (E_IS_GW_ITEM (item), -1);
+	g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
 
 	return item->priv->due_date;
 }
 
 void
-e_gw_item_set_due_date (EGwItem *item, time_t new_date)
+e_gw_item_set_due_date (EGwItem *item, const char *new_date)
 {
 	g_return_if_fail (E_IS_GW_ITEM (item));
 
-	item->priv->due_date = new_date;
+	if (item->priv->due_date)
+		g_free (item->priv->due_date);
+	item->priv->due_date = g_strdup (new_date);
 }
 
 const char *
@@ -1606,17 +1625,6 @@ e_gw_item_set_trigger (EGwItem *item, in
 	item->priv->trigger = trigger;
 }
 
-static char *
-timet_to_string (time_t t)
-{
-	gchar *ret;
-
-	ret = g_malloc (17); /* 4+2+2+1+2+2+2+1 + 1 */
-	strftime (ret, 17, "%Y%m%dT%H%M%SZ", gmtime (&t));
-
-	return ret;
-}
-
 static void
 add_distribution_to_soap_message (GSList *recipient_list,
SoupSoapMessage *msg)
 {
@@ -1676,16 +1684,18 @@ e_gw_item_append_to_soap_message (EGwIte
 		}
 		if (priv->recipient_list != NULL)
 			add_distribution_to_soap_message (priv->recipient_list, msg);
+		if (priv->end_date) {
+			e_gw_message_write_string_parameter (msg, "endDate", NULL,
priv->end_date);
+		} else
+			e_gw_message_write_string_parameter (msg, "endDate", NULL, "");
 		
 		break;
 
 	case E_GW_ITEM_TYPE_TASK :
 		soup_soap_message_add_attribute (msg, "type", "Task", "xsi", NULL);
 
-		if (priv->due_date != -1) {
-			dtstring = timet_to_string (priv->due_date);
-			e_gw_message_write_string_parameter (msg, "dueDate", NULL,
dtstring);
-			g_free (dtstring);
+		if (priv->due_date) {
+			e_gw_message_write_string_parameter (msg, "dueDate", NULL,
priv->due_date);
 		} else
 			e_gw_message_write_string_parameter (msg, "dueDate", NULL, "");
 
@@ -1746,21 +1756,13 @@ e_gw_item_append_to_soap_message (EGwIte
 
 	soup_soap_message_end_element (msg);
 
-	if (priv->start_date != -1) {
-		dtstring = timet_to_string (priv->start_date);
-		e_gw_message_write_string_parameter (msg, "startDate", NULL,
dtstring);
-		g_free (dtstring);
+	if (priv->start_date) {
+		e_gw_message_write_string_parameter (msg, "startDate", NULL, 
+				priv->start_date);
 	}
-	if (priv->end_date != -1) {
-		dtstring = timet_to_string (priv->end_date);
-		e_gw_message_write_string_parameter (msg, "endDate", NULL, dtstring);
-		g_free (dtstring);
-	} else
-		e_gw_message_write_string_parameter (msg, "endDate", NULL, "");
-	if (priv->creation_date != -1) {
-		dtstring = timet_to_string (priv->creation_date);
-		e_gw_message_write_string_parameter (msg, "created", NULL, dtstring);
-		g_free (dtstring);
+	
+	if (priv->creation_date) {
+		e_gw_message_write_string_parameter (msg, "created", NULL,
priv->creation_date);
 	}
 
 	if (priv->classification)
@@ -1839,7 +1841,6 @@ append_event_changes_to_soap_message (EG
 {
 	GHashTable *changes;
 	EGwItemPrivate *priv;
-	char *dtstring;
 
 	priv = item->priv;
 	changes = NULL;
@@ -1863,28 +1864,24 @@ append_event_changes_to_soap_message (EG
 	if (g_hash_table_lookup (changes, "subject"))
 		e_gw_message_write_string_parameter (msg, "subject", NULL,
priv->subject ? priv->subject : "");
 	if (g_hash_table_lookup (changes, "startDate")) {
-		if (priv->start_date != -1) {
-			dtstring = timet_to_string (priv->start_date);
-			e_gw_message_write_string_parameter (msg, "startDate", NULL,
dtstring);
-			g_free (dtstring);
+		if (priv->start_date) {
+			e_gw_message_write_string_parameter (msg, "startDate", NULL,
priv->start_date); 
 		}
 	}
 	if (g_hash_table_lookup (changes, "endDate")) {
-		if (priv->end_date != -1) {
-			dtstring = timet_to_string (priv->end_date);
-			e_gw_message_write_string_parameter (msg, "endDate", NULL,
dtstring);
-			g_free (dtstring);
+		if (priv->end_date) {
+			e_gw_message_write_string_parameter (msg, "endDate", NULL,
priv->end_date);
 		}
 	}
 	if (g_hash_table_lookup (changes, "message")) {
 		soup_soap_message_start_element (msg, "message", NULL, NULL);
 		if (priv->message) {
-			char *str;
+			char *str, *message;
 
 			str = soup_base64_encode (priv->message, strlen (priv->message));
-			dtstring = g_strdup_printf ("%d", strlen (str));
-			soup_soap_message_add_attribute (msg, "length", dtstring, NULL,
NULL);
-			g_free (dtstring);
+			message = g_strdup_printf ("%d", strlen (str));
+			soup_soap_message_add_attribute (msg, "length", message, NULL,
NULL);
+			g_free (message);
 			soup_soap_message_write_string (msg, str);
 			g_free (str);
 		} else {
Index: servers/groupwise/e-gw-item.h
===================================================================
RCS file:
/cvs/gnome/evolution-data-server/servers/groupwise/e-gw-item.h,v
retrieving revision 1.12
diff -u -p -r1.12 e-gw-item.h
--- servers/groupwise/e-gw-item.h	4 May 2004 05:47:41 -0000	1.12
+++ servers/groupwise/e-gw-item.h	18 May 2004 14:47:05 -0000
@@ -109,14 +109,14 @@ const char *e_gw_item_get_icalid (EGwIte
 void        e_gw_item_set_icalid (EGwItem *item, const char
*new_icalid);
 const char *e_gw_item_get_id (EGwItem *item);
 void        e_gw_item_set_id (EGwItem *item, const char *new_id);
-time_t      e_gw_item_get_creation_date (EGwItem *item);
-void        e_gw_item_set_creation_date (EGwItem *item, time_t
new_date);
-time_t      e_gw_item_get_start_date (EGwItem *item);
-void        e_gw_item_set_start_date (EGwItem *item, time_t new_date);
-time_t      e_gw_item_get_end_date (EGwItem *item);
-void        e_gw_item_set_end_date (EGwItem *item, time_t new_date);
-time_t      e_gw_item_get_due_date (EGwItem *item);
-void        e_gw_item_set_due_date (EGwItem *item, time_t new_date);
+char       *e_gw_item_get_creation_date (EGwItem *item);
+void        e_gw_item_set_creation_date (EGwItem *item, const char
*new_date);
+char       *e_gw_item_get_start_date (EGwItem *item);
+void        e_gw_item_set_start_date (EGwItem *item, const char
*new_date);
+char       *e_gw_item_get_end_date (EGwItem *item);
+void        e_gw_item_set_end_date (EGwItem *item, const char
*new_date);
+char       *e_gw_item_get_due_date (EGwItem *item);
+void        e_gw_item_set_due_date (EGwItem *item, const char
*new_date);
 const char *e_gw_item_get_subject (EGwItem *item);
 void        e_gw_item_set_subject (EGwItem *item, const char
*new_subject);
 const char *e_gw_item_get_message (EGwItem *item);
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.266
diff -u -p -r1.266 ChangeLog
--- calendar/ChangeLog	18 May 2004 03:29:25 -0000	1.266
+++ calendar/ChangeLog	18 May 2004 14:47:06 -0000
@@ -1,3 +1,34 @@
+2004-05-18  Harish Krishnaswamy  <kharish novell com>
+
+	Fixes #56320 and related timezone issues.
+	Convert datetime from the Groupwise string format between icaltime
+	directly w/o using time_t structures.
+	* backends/groupwise/e-cal-backend-groupwise-utils.c:
+	(set_properties_from_cal_component),
+	(e_gw_item_new_from_cal_component), (e_gw_item_to_cal_component),
+	(e_gw_connection_send_appointment), (e_gw_item_set_changes):
+	use the default_timezone info while performing the conversions.
+	* backends/groupwise/e-cal-backend-groupwise-utils.h:
+	* backends/groupwise/e-cal-backend-groupwise.c: (populate_cache),
+	(get_deltas), (connect_to_server),
+	(e_cal_backend_groupwise_finalize), (e_cal_backend_groupwise_open),
+	(e_cal_backend_groupwise_add_timezone):
+	add timezone to the cache and return success to enable evolution to
set the default timezone.
+	(e_cal_backend_groupwise_set_default_timezone),
+	(e_cal_backend_groupwise_create_object),
+	(e_cal_backend_groupwise_modify_object), (receive_object),
+	(send_object), (e_cal_backend_groupwise_init):
+	* libedata-cal/e-cal-backend-cache.c:
+	(e_cal_backend_cache_put_default_timezone),
+	(e_cal_backend_cache_get_default_timezone):
+	Store default timezone information in the cache so that eds remembers
the
+	client timezone information while populating the cache in the next
session.
+	Since the cache population happens while the calendar is still
loading, evolution
+	would not have had a chance to set the timezone yet.
+	
+	* libedata-cal/e-cal-backend-cache.h: Added get/put functions for
+	default timezone.
+
 2004-05-17  Rodney Dawes  <dobey ximian com>
 
 	* libecal/Makefile.am (libecal_la_LIBADD):
Index: calendar/backends/groupwise/e-cal-backend-groupwise.c
===================================================================
RCS file:
/cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise.c,v
retrieving revision 1.67
diff -u -p -r1.67 e-cal-backend-groupwise.c
--- calendar/backends/groupwise/e-cal-backend-groupwise.c	12 May 2004
14:37:07 -0000	1.67
+++ calendar/backends/groupwise/e-cal-backend-groupwise.c	18 May 2004
14:47:06 -0000
@@ -51,6 +51,7 @@ struct _ECalBackendGroupwisePrivate {
 	char *container_id;
 	CalMode mode;
 	icaltimezone *default_zone;
+	icalcomponent *icalcomp;
 
 	/* fields for storing info while offline */
 	char *user_email;
@@ -90,7 +91,7 @@ populate_cache (ECalBackendGroupwise *cb
 		EGwItem *item;
 
 		item = E_GW_ITEM (l->data);
-		comp = e_gw_item_to_cal_component (item);
+		comp = e_gw_item_to_cal_component (item, priv->default_zone);
 		g_object_unref (item);
 		if (E_IS_CAL_COMPONENT (comp)) {
 			e_cal_component_commit_sequence (comp);
@@ -155,7 +156,7 @@ get_deltas (gpointer handle)
 	if (adds) {
 		for (l = adds; l != NULL; l = g_slist_next (l)) {
 			EGwItem *item = (EGwItem *) l->data;
-			ECalComponent *comp = e_gw_item_to_cal_component (item);
+			ECalComponent *comp = e_gw_item_to_cal_component (item,
cbgw->priv->default_zone);
 			if (!comp)
 				g_message ("Invalid component returned");
 			else if (!e_cal_backend_cache_put_component (cache, comp)) 
@@ -172,7 +173,7 @@ get_deltas (gpointer handle)
 			/* FIXME  currently, just overwrite the fields with the
 			 * update.*/
 			e_cal_backend_cache_remove_component (cache, e_gw_item_get_id
(item), NULL);
-			e_cal_backend_cache_put_component (cache, e_gw_item_to_cal_component
(item));
+			e_cal_backend_cache_put_component (cache, e_gw_item_to_cal_component
(item, cbgw->priv->default_zone));
 		}
 	}
 
@@ -220,14 +221,15 @@ connect_to_server (ECalBackendGroupwise 
 
 			kind = e_cal_backend_get_kind (E_CAL_BACKEND (cbgw));
 			if (kind == ICAL_VEVENT_COMPONENT) {
-				priv->container_id = e_gw_connection_get_container_id (priv->cnc,
"Calendar");
+				priv->container_id = g_strdup (e_gw_connection_get_container_id
(priv->cnc, "Calendar"));
 				e_source_set_name (e_cal_backend_get_source (E_CAL_BACKEND (cbgw)),
_("Calendar"));
 			} else if (kind == ICAL_VTODO_COMPONENT) {
-				priv->container_id = e_gw_connection_get_container_id (priv->cnc,
"Calendar");
+				priv->container_id = g_strdup (e_gw_connection_get_container_id
(priv->cnc, "Calendar"));
 				e_source_set_name (e_cal_backend_get_source (E_CAL_BACKEND (cbgw)),
_("Calendar"));
 			} else
 				priv->container_id = NULL;
 
+
 			/* Populate the cache for the first time.*/
 			/* start a timed polling thread set to 10 minutes*/
 			cnc_status = populate_cache (cbgw);
@@ -315,6 +317,11 @@ e_cal_backend_groupwise_finalize (GObjec
 		priv->user_email = NULL;
 	}
 
+	if (priv->icalcomp) {
+		icalcomponent_free (priv->icalcomp);
+		priv->icalcomp = NULL;
+	}
+	
 	g_free (priv);
 	cbgw->priv = NULL;
 
@@ -416,6 +423,7 @@ e_cal_backend_groupwise_open (ECalBacken
 		g_object_ref (priv->cache);
 		g_timeout_add (CACHE_REFRESH_INTERVAL, (GSourceFunc) get_deltas,
(gpointer) cbgw);
 		priv->mode = CAL_MODE_REMOTE;
+
                 return GNOME_Evolution_Calendar_Success;
 	}
 
@@ -430,8 +438,10 @@ e_cal_backend_groupwise_open (ECalBacken
 	priv->mode = CAL_MODE_LOCAL;
 	priv->username = g_strdup (username);
 	priv->password = g_strdup (password);
-        priv->default_zone = icaltimezone_get_utc_timezone ();
+	
 
+	/* read the default timezone*/
+	priv->default_zone = e_cal_backend_cache_get_default_timezone
(priv->cache);
         /* FIXME: no need to set it online here when we implement the
online/offline stuff correctly */
 	status = connect_to_server (cbgw);
 
@@ -626,11 +636,39 @@ e_cal_backend_groupwise_get_timezone (EC
         return GNOME_Evolution_Calendar_Success;
 }
 
-/* Add_timezone handler for the file backend */
+/* Add_timezone handler for the groupwise backend */
 static ECalBackendSyncStatus
 e_cal_backend_groupwise_add_timezone (ECalBackendSync *backend,
EDataCal *cal, const char *tzobj)
 {
-	return GNOME_Evolution_Calendar_OtherError;
+	icalcomponent *tz_comp;
+	ECalBackendGroupwise *cbgw;
+	ECalBackendGroupwisePrivate *priv;
+
+	cbgw = (ECalBackendGroupwise *) backend;
+
+	g_return_val_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw),
GNOME_Evolution_Calendar_OtherError);
+	g_return_val_if_fail (tzobj != NULL,
GNOME_Evolution_Calendar_OtherError);
+
+	priv = cbgw->priv;
+
+	tz_comp = icalparser_parse_string (tzobj);
+	if (!tz_comp)
+		return GNOME_Evolution_Calendar_InvalidObject;
+
+	if (icalcomponent_isa (tz_comp) == ICAL_VTIMEZONE_COMPONENT) {
+		icaltimezone *zone;
+
+		zone = icaltimezone_new ();
+		icaltimezone_set_component (zone, tz_comp);
+		if (!icalcomponent_get_timezone (priv->icalcomp,
+						 icaltimezone_get_tzid (zone))) {
+			icalcomponent_add_component (priv->icalcomp, tz_comp);
+		}
+
+		icaltimezone_free (zone, 1);
+	}
+
+	return GNOME_Evolution_Calendar_Success;
 }
 
 static ECalBackendSyncStatus
@@ -645,6 +683,9 @@ e_cal_backend_groupwise_set_default_time
 	/* Set the default timezone to it. */
 	priv->default_zone = icaltimezone_get_builtin_timezone_from_tzid
(tzid);
 
+	/* FIXME  write it into the cache*/
+	e_cal_backend_cache_put_default_timezone (priv->cache,
priv->default_zone);
+
 	return GNOME_Evolution_Calendar_Success;
 }
 
@@ -911,7 +952,7 @@ e_cal_backend_groupwise_create_object (E
 	case CAL_MODE_ANY :
 	case CAL_MODE_REMOTE :
 		/* when online, send the item to the server */
-		status = e_gw_connection_send_appointment (priv->cnc,
priv->container_id, comp, &server_uid);
+		status = e_gw_connection_send_appointment (priv->cnc,
priv->container_id, priv->default_zone, comp, &server_uid);
 		if (status != E_GW_CONNECTION_STATUS_OK) {
 			g_object_unref (comp);
 			return GNOME_Evolution_Calendar_OtherError;
@@ -967,7 +1008,6 @@ e_cal_backend_groupwise_modify_object (E
 	ECalComponent *comp, *cache_comp;
 	EGwConnectionStatus status;
 	EGwItem *item, *cache_item;
-	char *id;
 
 	cbgw = E_CAL_BACKEND_GROUPWISE (backend);
 	priv = cbgw->priv;
@@ -982,7 +1022,7 @@ e_cal_backend_groupwise_modify_object (E
 
 	comp = e_cal_component_new ();
 	e_cal_component_set_icalcomponent (comp, icalcomp);
-	item = e_gw_item_new_from_cal_component (priv->container_id, comp);
+	item = e_gw_item_new_from_cal_component (priv->container_id,
priv->default_zone, comp);
 
 	/* check if the object exists */
 	switch (priv->mode) {
@@ -995,8 +1035,9 @@ e_cal_backend_groupwise_modify_object (E
 			return GNOME_Evolution_Calendar_InvalidObject;
 		}
 
-		cache_item =  e_gw_item_new_from_cal_component (priv->container_id,
cache_comp);
+		cache_item =  e_gw_item_new_from_cal_component (priv->container_id,
priv->default_zone, cache_comp);
 		e_gw_item_set_changes (item, cache_item); 
+		g_object_unref (cache_comp);
 
 		// the second argument is redundant.	
 		status = e_gw_connection_modify_item (priv->cnc, e_gw_item_get_id
(item), item);
@@ -1015,7 +1056,6 @@ e_cal_backend_groupwise_modify_object (E
 	}
 
 	g_object_unref (comp);
-	g_object_unref (cache_comp);
 
 	return GNOME_Evolution_Calendar_Success;
 }
@@ -1115,7 +1155,7 @@ receive_object (ECalBackendGroupwise *cb
 		status = e_cal_backend_groupwise_modify_object (E_CAL_BACKEND_SYNC
(cbgw), cal, comp_str,
 								CALOBJ_MOD_THIS, NULL);
 	} else
-		status = e_cal_backend_groupwise_create_object (E_CAL_BACKEND_SYNC
(cbgw), cal, comp_str, NULL);
+		status = e_cal_backend_groupwise_create_object (E_CAL_BACKEND_SYNC
(cbgw), cal, &comp_str, NULL);
 
 	g_free (comp_str);
 	g_object_unref (comp);
@@ -1177,7 +1217,7 @@ send_object (ECalBackendGroupwise *cbgw,
 	case CAL_MODE_ANY :
 	case CAL_MODE_REMOTE :
 		/* when online, send the item to the server */
-		status = e_gw_connection_send_appointment (priv->cnc,
priv->container_id, comp, NULL);
+		status = e_gw_connection_send_appointment (priv->cnc,
priv->container_id, priv->default_zone, comp, NULL);
 		break;
 	case CAL_MODE_LOCAL :
 		/* in offline mode, we just update the cache */
@@ -1243,6 +1283,7 @@ e_cal_backend_groupwise_init (ECalBacken
 	/* create the mutex for thread safety */
 	priv->mutex = g_mutex_new ();
 
+	priv->icalcomp = icalcomponent_new (ICAL_VTIMEZONE_COMPONENT);
 	cbgw->priv = priv;
 }
 
Index: calendar/backends/groupwise/e-cal-backend-groupwise-utils.h
===================================================================
RCS file:
/cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise-utils.h,v
retrieving revision 1.4
diff -u -p -r1.4 e-cal-backend-groupwise-utils.h
--- calendar/backends/groupwise/e-cal-backend-groupwise-utils.h	12 May
2004 14:37:07 -0000	1.4
+++ calendar/backends/groupwise/e-cal-backend-groupwise-utils.h	18 May
2004 14:47:06 -0000
@@ -32,14 +32,14 @@ G_BEGIN_DECLS
 /*
  * Items management
  */
-EGwItem       *e_gw_item_new_from_cal_component (const char *container,
ECalComponent *comp);
-ECalComponent *e_gw_item_to_cal_component (EGwItem *item);
+EGwItem       *e_gw_item_new_from_cal_component (const char *container,
const icaltimezone *default_zone, ECalComponent *comp);
+ECalComponent *e_gw_item_to_cal_component (EGwItem *item, icaltimezone
*default_zone);
 void          e_gw_item_set_changes (EGwItem *item, EGwItem
*cached_item);
 
 /*
  * Connection-related utility functions
  */
-EGwConnectionStatus e_gw_connection_send_appointment (EGwConnection
*cnc, const char *container, ECalComponent *comp, char **id);
+EGwConnectionStatus e_gw_connection_send_appointment (EGwConnection
*cnc, const char *container, icaltimezone *default_zone, ECalComponent
*comp, char **id);
 EGwConnectionStatus e_gw_connection_get_freebusy_info (EGwConnection
*cnc, GList *users,
 						       time_t start, time_t end, GList **freebusy);
 
Index: calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
===================================================================
RCS file:
/cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c,v
retrieving revision 1.17
diff -u -p -r1.17 e-cal-backend-groupwise-utils.c
--- calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	12 May
2004 14:37:07 -0000	1.17
+++ calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	18 May
2004 14:47:06 -0000
@@ -27,7 +27,7 @@
 #include "e-cal-backend-groupwise-utils.h"
 
 static EGwItem *
-set_properties_from_cal_component (EGwItem *item, ECalComponent *comp)
+set_properties_from_cal_component (EGwItem *item, ECalComponent *comp,
const icaltimezone *default_zone)
 {
 	const char *uid, *location;
 	ECalComponentDateTime dt;
@@ -37,6 +37,7 @@ set_properties_from_cal_component (EGwIt
 	int *priority;
 	GSList *slist, *sl;
 	icalproperty *prop;
+	struct icaltimetype itt_utc;
 
 	/* first set specific properties */
 	switch (e_cal_component_get_vtype (comp)) {
@@ -94,9 +95,12 @@ set_properties_from_cal_component (EGwIt
 
 		/* end date */
 		e_cal_component_get_dtend (comp, &dt);
-		if (dt.value)
-			e_gw_item_set_end_date (item, icaltime_as_timet_with_zone
(*dt.value, 
-						icaltimezone_get_builtin_timezone_from_tzid (dt.tzid)));
+		if (dt.value) {
+			if (!icaltime_get_timezone (*dt.value))
+				icaltime_set_timezone (dt.value, default_zone);
+			itt_utc = icaltime_convert_to_zone (*dt.value,
icaltimezone_get_utc_timezone ());
+			e_gw_item_set_end_date (item, icaltime_as_ical_string (itt_utc));
+		}
 
 		break;
 
@@ -106,8 +110,10 @@ set_properties_from_cal_component (EGwIt
 		/* due date */
 		e_cal_component_get_due (comp, &dt);
 		if (dt.value) {
-			e_gw_item_set_due_date (item, icaltime_as_timet (*dt.value));
-			e_cal_component_free_datetime (&dt);
+			if (!icaltime_get_timezone (*dt.value))
+				icaltime_set_timezone (dt.value, default_zone);
+			itt_utc = icaltime_convert_to_zone (*dt.value,
icaltimezone_get_utc_timezone ());
+			e_gw_item_set_due_date (item, icaltime_as_ical_string (itt_utc));
 		}
 
 		/* priority */
@@ -130,7 +136,6 @@ set_properties_from_cal_component (EGwIt
 		e_cal_component_get_completed (comp, &dt.value);
 		if (dt.value) {
 			e_gw_item_set_completed (item, TRUE);
-			e_cal_component_free_datetime (&dt);
 		} else
 			e_gw_item_set_completed (item, FALSE);
 
@@ -188,26 +193,28 @@ set_properties_from_cal_component (EGwIt
 	/* start date */
 	e_cal_component_get_dtstart (comp, &dt);
 	if (dt.value) {
-		e_gw_item_set_start_date (item, 
-			icaltime_as_timet_with_zone (*dt.value,
icaltimezone_get_builtin_timezone_from_tzid (dt.tzid)));
+		if (!icaltime_get_timezone (*dt.value))
+			icaltime_set_timezone (dt.value, default_zone);
+		itt_utc = icaltime_convert_to_zone (*dt.value,
icaltimezone_get_utc_timezone ());
+		e_gw_item_set_start_date (item, icaltime_as_ical_string (itt_utc));
 	} else if (e_gw_item_get_item_type (item) ==
E_GW_ITEM_TYPE_APPOINTMENT) {
 		/* appointments need the start date property */
 		g_object_unref (item);
 		return NULL;
 	}
 
-
 	/* creation date */
 	e_cal_component_get_created (comp, &dt.value);
 	if (dt.value) {
-		e_gw_item_set_creation_date (item, 
-			icaltime_as_timet_with_zone (*dt.value,
icaltimezone_get_builtin_timezone_from_tzid (dt.tzid)));
-		e_cal_component_free_datetime (&dt);
+		if (!icaltime_get_timezone (*dt.value))
+			icaltime_set_timezone (dt.value, default_zone);
+		itt_utc = icaltime_convert_to_zone (*dt.value,
icaltimezone_get_utc_timezone ());
+		e_gw_item_set_creation_date (item, icaltime_as_ical_string
(itt_utc));
 	} else {
 		struct icaltimetype itt;
 
 		e_cal_component_get_dtstamp (comp, &itt);
-		e_gw_item_set_creation_date (item, icaltime_as_timet (itt));
+		e_gw_item_set_creation_date (item, icaltime_as_ical_string (itt));
 	}
 
 	/* classification */
@@ -230,7 +237,7 @@ set_properties_from_cal_component (EGwIt
 }
 
 EGwItem *
-e_gw_item_new_from_cal_component (const char *container, ECalComponent
*comp)
+e_gw_item_new_from_cal_component (const char *container, const
icaltimezone *default_zone, ECalComponent *comp)
 {
 	EGwItem *item;
 
@@ -239,18 +246,18 @@ e_gw_item_new_from_cal_component (const 
 	item = e_gw_item_new_empty ();
 	e_gw_item_set_container_id (item, container);
 	
-	return set_properties_from_cal_component (item, comp);
+	return set_properties_from_cal_component (item, comp, default_zone);
 }
 
 ECalComponent *
-e_gw_item_to_cal_component (EGwItem *item)
+e_gw_item_to_cal_component (EGwItem *item, icaltimezone *default_zone)
 {
 	ECalComponent *comp;
 	ECalComponentText text;
 	ECalComponentDateTime dt;
 	const char *description;
-	time_t t;
-	struct icaltimetype itt;
+	char *t;
+	struct icaltimetype itt, itt_utc;
 	int priority;
 	int alarm_duration;
 	GSList *recipient_list, *rl, *attendee_list = NULL;
@@ -305,26 +312,42 @@ e_gw_item_to_cal_component (EGwItem *ite
 
 	/* creation date */
 	t = e_gw_item_get_creation_date (item);
-	itt = icaltime_from_timet (t, 0);
+	itt_utc = icaltime_from_string (t);
+	if (!icaltime_get_timezone (itt_utc))
+		icaltime_set_timezone (&itt_utc, icaltimezone_get_utc_timezone());
+	if (default_zone) {
+		itt = icaltime_convert_to_zone (itt_utc, default_zone); 
+		icaltime_set_timezone (&itt, default_zone);
+		e_cal_component_set_created (comp, &itt);
+		e_cal_component_set_dtstamp (comp, &itt);
+		
+	} else {
+		e_cal_component_set_created (comp, &itt_utc);
+		e_cal_component_set_dtstamp (comp, &itt_utc);
+	}
+	g_free (t);
+	
 	
-	e_cal_component_set_created (comp, &itt);
-	e_cal_component_set_dtstamp (comp, &itt);
 
 	/* start date */
+	/* should i duplicate here ? */
 	t = e_gw_item_get_start_date (item);
-	itt = icaltime_from_timet (t, 0);
-	dt.value = &itt;
-	dt.tzid = g_strdup ("UTC");
+	itt_utc = icaltime_from_string (t);
+	if (!icaltime_get_timezone (itt_utc))
+		icaltime_set_timezone (&itt_utc, icaltimezone_get_utc_timezone());
+	if (default_zone) {
+		itt = icaltime_convert_to_zone (itt_utc, default_zone); 
+		icaltime_set_timezone (&itt, default_zone);
+		dt.value = &itt;
+		dt.tzid = icaltimezone_get_tzid (default_zone);
+	} else {
+		dt.value = &itt_utc;
+		dt.tzid = g_strdup ("UTC");
+	}
 	e_cal_component_set_dtstart (comp, &dt);
-	g_free (dt.tzid);
+	g_free (t);
 
-	/* end date */
-	t = e_gw_item_get_end_date (item);
-	itt = icaltime_from_timet (t, 0);
-	dt.value = &itt;
-	dt.tzid = g_strdup ("UTC");
-	e_cal_component_set_dtend (comp, &dt);
-	g_free (dt.tzid);
+	
 
 	/* classification */
 	description = e_gw_item_get_classification (item);
@@ -355,6 +378,23 @@ e_gw_item_to_cal_component (EGwItem *ite
 		/* location */
 		e_cal_component_set_location (comp, e_gw_item_get_place (item));
 
+		/* end date */
+		t = e_gw_item_get_end_date (item);
+		itt_utc = icaltime_from_string (t);
+		if (!icaltime_get_timezone (itt_utc))
+			icaltime_set_timezone (&itt_utc, icaltimezone_get_utc_timezone());
+		if (default_zone) {
+			itt = icaltime_convert_to_zone (itt_utc, default_zone); 
+			icaltime_set_timezone (&itt, default_zone);
+			dt.value = &itt;
+			dt.tzid = icaltimezone_get_tzid (default_zone);
+		} else {
+			dt.value = &itt_utc;
+			dt.tzid = g_strdup ("UTC");
+		}
+		
+		e_cal_component_set_dtend (comp, &dt);
+
 		/* alarms*/
 		/* we negate the value as GW supports only "before" the start of
event alarms */
 		alarm_duration = 0 - e_gw_item_get_trigger (item);
@@ -398,9 +438,18 @@ e_gw_item_to_cal_component (EGwItem *ite
 	case E_GW_ITEM_TYPE_TASK :
 		/* due date */
 		t = e_gw_item_get_due_date (item);
-		itt = icaltime_from_timet (t, 0);
-		dt.value = &itt;
-		dt.tzid = g_strdup ("UTC");
+		itt_utc = icaltime_from_string (t);
+		if (!icaltime_get_timezone (itt_utc))
+			icaltime_set_timezone (&itt_utc, icaltimezone_get_utc_timezone());
+		if (default_zone) {
+			itt = icaltime_convert_to_zone (itt_utc, default_zone); 
+			icaltime_set_timezone (&itt, default_zone);
+			dt.value = &itt;
+			dt.tzid = icaltimezone_get_tzid (default_zone);
+		} else {
+			dt.value = &itt_utc;
+			dt.tzid = g_strdup ("UTC");
+		}
 		e_cal_component_set_due (comp, &dt);
 		break;
 
@@ -428,7 +477,7 @@ e_gw_item_to_cal_component (EGwItem *ite
 }
 
 EGwConnectionStatus
-e_gw_connection_send_appointment (EGwConnection *cnc, const char
*container, ECalComponent *comp, char **id)
+e_gw_connection_send_appointment (EGwConnection *cnc, const char
*container, icaltimezone *default_zone, ECalComponent *comp, char **id)
 {
 	EGwItem *item;
 	EGwConnectionStatus status;
@@ -436,7 +485,7 @@ e_gw_connection_send_appointment (EGwCon
 	g_return_val_if_fail (E_IS_GW_CONNECTION (cnc),
E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
 	g_return_val_if_fail (E_IS_CAL_COMPONENT (comp),
E_GW_CONNECTION_STATUS_INVALID_OBJECT);
 
-	item = e_gw_item_new_from_cal_component (container, comp);
+	item = e_gw_item_new_from_cal_component (container, default_zone,
comp);
 	e_gw_item_set_container_id (item, container);
 	status = e_gw_connection_send_item (cnc, item, id);
 	g_object_unref (item);
@@ -725,23 +774,24 @@ e_gw_item_set_changes (EGwItem *item, EG
 {
 	char *subject, *cache_subject;
 	char *message, *cache_message;
-	char *classification, *cache_classification;
+	const char *classification, *cache_classification;
 	char *accept_level, *cache_accept_level;
 	char *place, *cache_place;
 	char *priority, *cache_priority;
-		
+	int trigger, cache_trigger;
+
 	/* TODO assert the types of the items are the same */
 
 	SET_DELTA(subject);
 	SET_DELTA(message);
 	SET_DELTA(classification);
 
-	if (difftime (e_gw_item_get_start_date (item),
e_gw_item_get_start_date (cache_item)))
+	if (strcmp (e_gw_item_get_start_date (item), e_gw_item_get_start_date
(cache_item)))
 		e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_UPDATE,
"startDate", e_gw_item_get_start_date (item));
 	
 	if ( e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_APPOINTMENT) {
 
-		if (difftime (e_gw_item_get_end_date (item), e_gw_item_get_end_date
(cache_item)))
+		if (strcmp (e_gw_item_get_end_date (item), e_gw_item_get_end_date
(cache_item)))
 			e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_UPDATE, "endDate",
e_gw_item_get_end_date (item));
 		accept_level = e_gw_item_get_accept_level
(item);                                                       
 		cache_accept_level = e_gw_item_get_accept_level
(cache_item);                                           
@@ -755,24 +805,26 @@ e_gw_item_set_changes (EGwItem *item, EG
 			e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_ADD,
"acceptLevel", accept_level ); 
 		
 		SET_DELTA(place);
-		if ( e_gw_item_get_trigger (cache_item) )
{                                                                            
-			if (!e_gw_item_get_trigger (item)
)                                                                               
-				e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_DELETE, "alarm",
e_gw_item_get_trigger (cache_item));
-			else if (e_gw_item_get_trigger (item) != e_gw_item_get_trigger
(cache_item))                                               
-				e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_UPDATE, "alarm",
e_gw_item_get_trigger (item));
+		trigger = e_gw_item_get_trigger (item);
+		cache_trigger = e_gw_item_get_trigger (cache_item);
+		if (cache_trigger)
{                                                                            
+			if
(!trigger)                                                                               
+				e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_DELETE, "alarm",
&cache_trigger);
+			else if (trigger != cache_trigger)
+				e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_UPDATE, "alarm",
&trigger);

		}                                                                                                 
-		else if ( e_gw_item_get_trigger (item)
)                                                                               
-			e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_ADD, "alarm",
e_gw_item_get_trigger (item)); 
+		else if
(trigger)                                                                               
+			e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_ADD, "alarm",
&trigger);
 	}
 	else if ( e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_TASK) {
 		gboolean completed, cache_completed;
 		
-		if (difftime (e_gw_item_get_due_date (item), e_gw_item_get_due_date
(cache_item)))
+		if (strcmp (e_gw_item_get_due_date (item), e_gw_item_get_due_date
(cache_item)))
 			e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_UPDATE, "dueDate",
e_gw_item_get_due_date (item));
 		completed = e_gw_item_get_completed (item);
 		cache_completed = e_gw_item_get_completed (cache_item);
 		if ((completed && !cache_completed) || (!completed &&
cache_completed))
-			e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_UPDATE,
"completed", completed);
+			e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_UPDATE,
"completed", &completed);
 		SET_DELTA (priority);
 	}
 }
Index: calendar/libedata-cal/e-cal-backend-cache.c
===================================================================
RCS file:
/cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend-cache.c,v
retrieving revision 1.15
diff -u -p -r1.15 e-cal-backend-cache.c
--- calendar/libedata-cal/e-cal-backend-cache.c	14 May 2004 12:18:30
-0000	1.15
+++ calendar/libedata-cal/e-cal-backend-cache.c	18 May 2004 14:47:07
-0000
@@ -501,6 +501,69 @@ e_cal_backend_cache_put_timezone (ECalBa
 }
 
 gboolean
+e_cal_backend_cache_put_default_timezone (ECalBackendCache *cache,
icaltimezone *default_zone)
+{
+	ECalBackendCachePrivate *priv;
+	icalcomponent *icalcomp;
+	gboolean retval;
+
+	g_return_val_if_fail (E_IS_CAL_BACKEND_CACHE (cache), FALSE);
+
+	priv = cache->priv;
+
+	/* add the timezone to the cache file */
+	icalcomp = icaltimezone_get_component (default_zone);
+	if (!icalcomp)
+		return FALSE;
+
+	if (e_file_cache_get_object (E_FILE_CACHE (cache), "default_zone")) {
+		retval = e_file_cache_replace_object (E_FILE_CACHE (cache),
"default_zone",
+						      icalcomponent_as_ical_string (icalcomp));
+	} else {
+		retval = e_file_cache_add_object (E_FILE_CACHE (cache),
+						 "default_zone",
+						  icalcomponent_as_ical_string (icalcomp));
+	}
+
+	if (!retval)
+		return FALSE;
+
+	return TRUE;
+
+}
+
+icaltimezone *
+e_cal_backend_cache_get_default_timezone (ECalBackendCache *cache)
+{
+	icaltimezone *zone;
+	const char *comp_str;
+	ECalBackendCachePrivate *priv;
+
+	g_return_val_if_fail (E_IS_CAL_BACKEND_CACHE (cache), NULL);
+
+	priv = cache->priv;
+
+	/*  look for the timezone in the cache */
+	comp_str = e_file_cache_get_object (E_FILE_CACHE (cache),
"default_zone");
+	if (comp_str) {
+		icalcomponent *icalcomp;
+
+		icalcomp = icalparser_parse_string (comp_str);
+		if (icalcomp) {
+			zone = icaltimezone_new ();
+			if (icaltimezone_set_component (zone, icalcomp) == 1) {
+				return zone;
+			} else {
+				icalcomponent_free (icalcomp);
+				icaltimezone_free (zone, 1);
+			}
+		}
+	}
+
+	return NULL;
+}
+
+gboolean
 e_cal_backend_cache_remove_timezone (ECalBackendCache *cache, const
char *tzid)
 {
 	gpointer orig_key, orig_value;
Index: calendar/libedata-cal/e-cal-backend-cache.h
===================================================================
RCS file:
/cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend-cache.h,v
retrieving revision 1.9
diff -u -p -r1.9 e-cal-backend-cache.h
--- calendar/libedata-cal/e-cal-backend-cache.h	19 Mar 2004 13:05:39
-0000	1.9
+++ calendar/libedata-cal/e-cal-backend-cache.h	18 May 2004 14:47:07
-0000
@@ -60,6 +60,10 @@ const icaltimezone *e_cal_backend_cache_
 gboolean            e_cal_backend_cache_put_timezone (ECalBackendCache
*cache, const icaltimezone *zone);
 gboolean            e_cal_backend_cache_remove_timezone
(ECalBackendCache *cache, const char *tzid);
 
+gboolean            e_cal_backend_cache_put_default_timezone
(ECalBackendCache *cache, icaltimezone *default_zone);
+icaltimezone       *e_cal_backend_cache_get_default_timezone
(ECalBackendCache *cache);
+
+
 G_END_DECLS
 
 #endif




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