evolution r36322 - in trunk/calendar: . gui



Author: msuman
Date: Sun Sep 14 08:17:20 2008
New Revision: 36322
URL: http://svn.gnome.org/viewvc/evolution?rev=36322&view=rev

Log:
Chenthill Palanisamy  <pchenthill novell com> ** Fix for bug #551628 (Remove old events from the view when objects are modified).

Modified:
   trunk/calendar/ChangeLog
   trunk/calendar/gui/e-cal-model.c
   trunk/calendar/gui/e-day-view.c
   trunk/calendar/gui/e-week-view.c

Modified: trunk/calendar/gui/e-cal-model.c
==============================================================================
--- trunk/calendar/gui/e-cal-model.c	(original)
+++ trunk/calendar/gui/e-cal-model.c	Sun Sep 14 08:17:20 2008
@@ -1499,7 +1499,7 @@
 
 	/*  re-add only the recurrence objects */
 	for (l = objects; l != NULL; l = g_list_next (l)) {
-		if (e_cal_util_component_has_recurrences (l->data) && (priv->flags & E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES)) 
+		if (!e_cal_util_component_is_instance (l->data) && e_cal_util_component_has_recurrences (l->data) && (priv->flags & E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES)) 
 			list = g_list_prepend (list, l->data);
 		else {
 			int pos;
@@ -1507,7 +1507,7 @@
 			ECalComponentId *id;
 			ECalComponent *comp = e_cal_component_new ();
 			ECal *client = e_cal_view_get_client (query);
-		
+
 			if (!e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (l->data))) {
 				g_object_unref (comp);
 				continue;
@@ -1516,13 +1516,34 @@
 			e_table_model_pre_change (E_TABLE_MODEL (model));
 
 			id = e_cal_component_get_id (comp);
-				
+
 			comp_data = search_by_id_and_client (priv, client, id);
-			icalcomponent_free (comp_data->icalcomp);
-			
+			if (comp_data->icalcomp)
+				icalcomponent_free (comp_data->icalcomp);
+			if (comp_data->dtstart) {
+				g_free (comp_data->dtstart);
+				comp_data->dtstart = NULL;
+			}
+			if (comp_data->dtend) {
+				g_free (comp_data->dtend);
+				comp_data->dtend = NULL;
+			}
+			if (comp_data->due) {
+				g_free (comp_data->due);
+				comp_data->due = NULL;
+			}
+			if (comp_data->completed) {
+				g_free (comp_data->completed);
+				comp_data->completed = NULL;
+			}
+			if (comp_data->color) {
+				g_free (comp_data->color);
+				comp_data->color = NULL;
+			}
+
 			comp_data->icalcomp = icalcomponent_new_clone (l->data);
 			e_cal_model_set_instance_times (comp_data, priv->zone);
-			
+
 			pos = get_position_in_array (priv->objects, comp_data);
 			
 			e_table_model_row_changed (E_TABLE_MODEL (model), pos);

Modified: trunk/calendar/gui/e-day-view.c
==============================================================================
--- trunk/calendar/gui/e-day-view.c	(original)
+++ trunk/calendar/gui/e-day-view.c	Sun Sep 14 08:17:20 2008
@@ -555,12 +555,30 @@
 {
 	ECalModelComponent *comp_data;
 	ECalModel *model;
+	gint day, event_num;
+	const char *uid = NULL;
+	char *rid = NULL;
 
 	e_day_view_stop_editing_event (day_view);
 
 	model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
 	comp_data = e_cal_model_get_component_at (model, row);
 	g_return_if_fail (comp_data != NULL);
+
+	uid = icalcomponent_get_uid (comp_data->icalcomp);
+	if (e_cal_util_component_is_instance (comp_data->icalcomp)) {
+		icalproperty *prop;
+
+		prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_RECURRENCEID_PROPERTY);
+		if (prop)
+			rid = icaltime_as_ical_string (icalcomponent_get_recurrenceid (comp_data->icalcomp));
+	}
+
+	if (e_day_view_find_event_from_uid (day_view, comp_data->client, uid, rid, &day, &event_num))
+		e_day_view_remove_event_cb (day_view, day, event_num, NULL);
+
+	g_free (rid);
+
 	process_component (day_view, comp_data);
 
 	gtk_widget_queue_draw (day_view->top_canvas);
@@ -641,7 +659,6 @@
 		const char *uid = NULL;
 		char *rid = NULL;
 
-
 		uid = icalcomponent_get_uid (comp_data->icalcomp);
 		if (e_cal_util_component_is_instance (comp_data->icalcomp)) {
 			icalproperty *prop;

Modified: trunk/calendar/gui/e-week-view.c
==============================================================================
--- trunk/calendar/gui/e-week-view.c	(original)
+++ trunk/calendar/gui/e-week-view.c	Sun Sep 14 08:17:20 2008
@@ -337,10 +337,28 @@
 {
 	ECalModelComponent *comp_data;
 	ECalModel *model;
+	gint event_num;
+	const char *uid;
+	char *rid = NULL;
 
 	model = e_calendar_view_get_model (E_CALENDAR_VIEW (week_view));
 	comp_data = e_cal_model_get_component_at (model, row);
 	g_return_if_fail (comp_data != NULL);
+
+	uid = icalcomponent_get_uid (comp_data->icalcomp);
+	if (e_cal_util_component_is_instance (comp_data->icalcomp)) {
+		icalproperty *prop;
+
+		prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_RECURRENCEID_PROPERTY);
+		if (prop)
+			rid = icaltime_as_ical_string (icalcomponent_get_recurrenceid (comp_data->icalcomp));
+	}
+
+	if (e_week_view_find_event_from_uid (week_view, comp_data->client, uid, rid, &event_num))
+		e_week_view_remove_event_cb (week_view, event_num, NULL);
+
+	g_free (rid);
+
 	process_component (week_view, comp_data);
 
 	gtk_widget_queue_draw (week_view->main_canvas);



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