[evolution-patches] Fix for the bug #318777 [calendar]



Hi,
  Have attached the fix for the same. This is regarding modifying a
single instance of a recurring appointment. Set the instance start to
all the recurring instances.


thanks, Chenthill.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.528
diff -u -p -r1.528 ChangeLog
--- ChangeLog	27 Oct 2005 09:02:31 -0000	1.528
+++ ChangeLog	27 Oct 2005 21:56:14 -0000
@@ -1,5 +1,13 @@
 2005-10-27  Chenthill Palanisamy  <pchenthill novell com>
 
+	Fixes #318777
+	* backends/file/e-cal-backend-file.c:
+	(e_cal_backend_file_modify_object): Dont set the recurrence id
+	again if its already present. Don't emit unnecessary modified
+	signals.
+
+2005-10-27  Chenthill Palanisamy  <pchenthill novell com>
+
 	Reworked the patch from Matthew Daniel <bugzilla mdaniel scdi com>
 
 	Fixes #318130
Index: backends/file/e-cal-backend-file.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/file/e-cal-backend-file.c,v
retrieving revision 1.65
diff -u -p -r1.65 e-cal-backend-file.c
--- backends/file/e-cal-backend-file.c	26 Oct 2005 11:33:22 -0000	1.65
+++ backends/file/e-cal-backend-file.c	27 Oct 2005 21:56:24 -0000
@@ -1878,26 +1878,11 @@ e_cal_backend_file_modify_object (ECalBa
 			priv->comp = g_list_remove (priv->comp, recurrence);
 			obj_data->recurrences_list = g_list_remove (obj_data->recurrences_list, recurrence);
 			g_hash_table_remove (obj_data->recurrences, rid);
-		} else {
-			char *old, *new;
-
-			old = e_cal_component_get_as_string (obj_data->full_object);
-
-			new = e_cal_component_get_as_string (comp);
-			e_cal_backend_notify_object_modified (E_CAL_BACKEND (backend), old, new);
-
-			if (old_object)
-				*old_object = old;
-			else
-				g_free (old);
-			g_free (new);
 		}
 
 		/* add the detached instance */
-		icalcomponent_set_recurrenceid (e_cal_component_get_icalcomponent (comp),
-						icaltime_from_string (rid));
 		g_hash_table_insert (obj_data->recurrences, 
-				     g_strdup (e_cal_component_get_recurid_as_string (comp)),
+				     g_strdup (rid),
 				     comp);
 		icalcomponent_add_component (priv->icalcomp,
 					     e_cal_component_get_icalcomponent (comp));
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2833
diff -u -p -r1.2833 ChangeLog
--- ChangeLog	21 Oct 2005 10:02:34 -0000	1.2833
+++ ChangeLog	27 Oct 2005 21:53:38 -0000
@@ -1,3 +1,13 @@
+2005-10-27  Chenthill Palanisamy  <pchenthill novell com>
+
+	Fixes #318777
+	* gui/e-cal-model.c: 
+	(add_instance_cb): Set the instance start as the started date for
+	the recurring instance.
+	(e_cal_view_objects_added_cb): 
+	(e_cal_view_objects_removed_cb): Check if the comp_data is removed
+	from the array before freeing the data.
+
 2005-10-21  Mubeen Jukaku  <jmubeen novell com>
 
 	Sankar Committting for Mubeen
Index: gui/e-cal-model.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-model.c,v
retrieving revision 1.65
diff -u -p -r1.65 e-cal-model.c
--- gui/e-cal-model.c	11 Oct 2005 09:07:24 -0000	1.65
+++ gui/e-cal-model.c	27 Oct 2005 21:53:46 -0000
@@ -1288,11 +1288,32 @@ add_instance_cb (ECalComponent *comp, ti
 	ECalModelComponent *comp_data;
 	ECalModelPrivate *priv;
 	RecurrenceExpansionData *rdata = user_data;
+	icaltimetype time;
+	ECalComponentDateTime datetime, to_set;
+	icaltimezone *zone = NULL;
+
+	g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), TRUE);
 
 	priv = rdata->model->priv;
 
 	e_table_model_pre_change (E_TABLE_MODEL (rdata->model));
 
+	/* set the right instance start date to component */
+	e_cal_component_get_dtstart (comp, &datetime);
+	e_cal_get_timezone (rdata->client, datetime.tzid, &zone, NULL);
+	time = icaltime_from_timet_with_zone (instance_start, FALSE, zone ? zone : priv->zone);
+	to_set.value = &time;
+	to_set.tzid = datetime.tzid; 
+	e_cal_component_set_dtstart (comp, &to_set);
+	
+	/* set the right instance end date to component*/
+	e_cal_component_get_dtend (comp, &datetime);
+	e_cal_get_timezone (rdata->client, datetime.tzid, &zone, NULL);
+	time = icaltime_from_timet_with_zone (instance_end, FALSE, zone ? zone : priv->zone);
+	to_set.value = &time;
+	to_set.tzid = datetime.tzid; 
+	e_cal_component_set_dtend (comp, &to_set);
+
 	comp_data = g_new0 (ECalModelComponent, 1);
 	comp_data->client = g_object_ref (rdata->client);
 	comp_data->icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
@@ -1356,8 +1377,8 @@ e_cal_view_objects_added_cb (ECalView *q
 			pos = get_position_in_array (priv->objects, comp_data);
 			e_table_model_row_deleted (E_TABLE_MODEL (model), pos);
 
- 			g_ptr_array_remove (priv->objects, comp_data);
- 			e_cal_model_free_component_data (comp_data);
+ 			if (g_ptr_array_remove (priv->objects, comp_data))
+	 			e_cal_model_free_component_data (comp_data);
  		}
 
 		e_cal_component_free_id (id);
@@ -1412,7 +1433,7 @@ e_cal_view_objects_removed_cb (ECalView 
 	GList *l;
 	
 	priv = model->priv;
-
+	
 	for (l = ids; l; l = l->next) {
 		ECalModelComponent *comp_data = NULL;
 		ECalComponentId *id = l->data;
@@ -1425,8 +1446,8 @@ e_cal_view_objects_removed_cb (ECalView 
 			pos = get_position_in_array (priv->objects, comp_data);
 			e_table_model_row_deleted (E_TABLE_MODEL (model), pos);
 
-			g_ptr_array_remove (priv->objects, comp_data);
-			e_cal_model_free_component_data (comp_data);
+			if (g_ptr_array_remove (priv->objects, comp_data))
+				e_cal_model_free_component_data (comp_data);
 		}
 	}
 }


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