diff options
author | Milan Crha <mcrha@redhat.com> | 2011-09-15 02:00:25 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-09-15 17:26:58 +0800 |
commit | 8a7b992ee3135d1c2cb1d815d96ce5cd97b40e89 (patch) | |
tree | 9a58a95a24007267fa55c7b7590257ad27f8c2b2 /calendar/gui | |
parent | cb861a31800f1f509058077ef037719f221d2d0a (diff) | |
download | gsoc2013-evolution-8a7b992ee3135d1c2cb1d815d96ce5cd97b40e89.tar gsoc2013-evolution-8a7b992ee3135d1c2cb1d815d96ce5cd97b40e89.tar.gz gsoc2013-evolution-8a7b992ee3135d1c2cb1d815d96ce5cd97b40e89.tar.bz2 gsoc2013-evolution-8a7b992ee3135d1c2cb1d815d96ce5cd97b40e89.tar.lz gsoc2013-evolution-8a7b992ee3135d1c2cb1d815d96ce5cd97b40e89.tar.xz gsoc2013-evolution-8a7b992ee3135d1c2cb1d815d96ce5cd97b40e89.tar.zst gsoc2013-evolution-8a7b992ee3135d1c2cb1d815d96ce5cd97b40e89.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.c | 52 |
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); |