aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorSuman Manjunath <msuman@src.gnome.org>2008-09-14 16:17:20 +0800
committerSuman Manjunath <msuman@src.gnome.org>2008-09-14 16:17:20 +0800
commit0418253eff2bc00c1b9ae9f4daa7af82a71b4899 (patch)
tree9d5b0631457059d7d22a0c13c9e07f5c11490301 /calendar
parent9f755b0c6d2c880b7d2f44531d513ef0777d1e91 (diff)
downloadgsoc2013-evolution-0418253eff2bc00c1b9ae9f4daa7af82a71b4899.tar.gz
gsoc2013-evolution-0418253eff2bc00c1b9ae9f4daa7af82a71b4899.tar.zst
gsoc2013-evolution-0418253eff2bc00c1b9ae9f4daa7af82a71b4899.zip
Chenthill Palanisamy <pchenthill@novell.com> ** Fix for bug #551628 (Remove old events from the view when objects are modified).
svn path=/trunk/; revision=36322
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog9
-rw-r--r--calendar/gui/e-cal-model.c33
-rw-r--r--calendar/gui/e-day-view.c19
-rw-r--r--calendar/gui/e-week-view.c18
4 files changed, 72 insertions, 7 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 388f4ddcbb..7bca661a08 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,12 @@
+2008-09-14 Chenthill Palanisamy <pchenthill@novell.com>
+
+ ** Fix for bug #551628
+
+ * gui/e-cal-model.c: (e_cal_view_objects_modified_cb):
+ * gui/e-day-view.c: (update_row), (model_comps_deleted_cb):
+ * gui/e-week-view.c: (update_row): Remove old events from the
+ view when objects are modified.
+
2008-09-12 Paul Bolle <pebolle@tiscali.nl>
** Fix for bug #551895
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 0b476a4bd5..c97f61ca0f 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -1499,7 +1499,7 @@ e_cal_view_objects_modified_cb (ECalView *query, GList *objects, gpointer user_d
/* 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 @@ e_cal_view_objects_modified_cb (ECalView *query, GList *objects, gpointer user_d
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_cal_view_objects_modified_cb (ECalView *query, GList *objects, gpointer user_d
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);
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index f1fb84cd3c..a5df99a0b7 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -555,12 +555,30 @@ update_row (EDayView *day_view, int row)
{
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 @@ model_comps_deleted_cb (ETableModel *etm, gpointer data, gpointer user_data)
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;
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 67dc931c68..419934297f 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -337,10 +337,28 @@ update_row (EWeekView *week_view, int row)
{
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);