aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-09-15 02:00:25 +0800
committerMilan Crha <mcrha@redhat.com>2011-09-15 02:02:30 +0800
commitf2dee9eb354db191021f0fa33228ac138f9e78b4 (patch)
tree2e26ed2775124e8d7ca67746551f0d1d9619bc4d /calendar/gui
parentbf30c5e4530ad31df1774c9df076185855c9cc37 (diff)
downloadgsoc2013-evolution-f2dee9eb354db191021f0fa33228ac138f9e78b4.tar.gz
gsoc2013-evolution-f2dee9eb354db191021f0fa33228ac138f9e78b4.tar.zst
gsoc2013-evolution-f2dee9eb354db191021f0fa33228ac138f9e78b4.zip
Bug #655253 - Do not show detached instances twice in a calendar
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/e-cal-model.c52
1 files changed, 33 insertions, 19 deletions
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 9bb8235d6e..0c8c59bb9d 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -2115,6 +2115,33 @@ search_by_id_and_client (ECalModelPrivate *priv,
return NULL;
}
+static void
+remove_all_for_id_and_client (ECalModel *model,
+ ECalClient *client,
+ const ECalComponentId *id)
+{
+ ECalModelComponent *comp_data;
+
+ while ((comp_data = search_by_id_and_client (model->priv, client, id))) {
+ gint pos;
+ GSList *list = NULL;
+
+ pos = get_position_in_array (model->priv->objects, comp_data);
+
+ if (!g_ptr_array_remove (model->priv->objects, comp_data))
+ continue;
+
+ list = g_slist_append (list, comp_data);
+ g_signal_emit (G_OBJECT (model), signals[COMPS_DELETED], 0, list);
+
+ g_slist_free (list);
+ g_object_unref (comp_data);
+
+ e_table_model_pre_change (E_TABLE_MODEL (model));
+ e_table_model_row_deleted (E_TABLE_MODEL (model), pos);
+ }
+}
+
typedef struct {
ECalClient *client;
ECalClientView *view;
@@ -2134,11 +2161,16 @@ add_instance_cb (ECalComponent *comp,
icaltimetype time;
ECalComponentDateTime datetime, to_set;
icaltimezone *zone = NULL;
+ ECalComponentId *id;
g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), TRUE);
priv = rdata->model->priv;
+ id = e_cal_component_get_id (comp);
+ remove_all_for_id_and_client (rdata->model, rdata->client, id);
+ e_cal_component_free_id (id);
+
e_table_model_pre_change (E_TABLE_MODEL (rdata->model));
/* set the right instance start date to component */
@@ -2265,25 +2297,7 @@ process_added (ECalClientView *view,
id = e_cal_component_get_id (comp);
/* remove the components if they are already present and re-add them */
- while ((comp_data = search_by_id_and_client (priv, client,
- id))) {
- gint pos;
- GSList *list = NULL;
-
- pos = get_position_in_array (priv->objects, comp_data);
-
- if (!g_ptr_array_remove (priv->objects, comp_data))
- continue;
-
- list = g_slist_append (list, comp_data);
- g_signal_emit (G_OBJECT (model), signals[COMPS_DELETED], 0, list);
-
- g_slist_free (list);
- g_object_unref (comp_data);
-
- e_table_model_pre_change (E_TABLE_MODEL (model));
- e_table_model_row_deleted (E_TABLE_MODEL (model), pos);
- }
+ remove_all_for_id_and_client (model, client, id);
e_cal_component_free_id (id);
g_object_unref (comp);