From f86754c329d9411893abd98bfe98b45d5ccfc943 Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Wed, 13 Aug 2008 09:09:33 +0000 Subject: Fixes #347287 2008-08-15 Chenthill Palanisamy Fixes #347287 * gui/e-cal-list-view-config.c: * (e_cal_list_view_config_set_view): * gui/e-cal-list-view.c: (e_cal_list_view_new): * gui/e-cal-list-view.h: * gui/e-cal-model.c: (e_cal_model_set_timezone), * (add_instance_cb), (e_cal_view_objects_added_cb), (e_cal_view_done_cb), (update_e_cal_view_for_client), (cal_opened_cb), (add_new_client), (e_cal_model_component_class_init), (e_cal_model_component_finalize), (e_cal_model_component_init), (e_cal_model_component_get_type), (e_cal_model_copy_component_data), (e_cal_model_free_component_data): * gui/e-cal-model.h: * gui/e-calendar-view.c: (e_calendar_view_init), (e_calendar_view_set_model): * gui/e-calendar-view.h: * gui/e-day-view-config.c: (e_day_view_config_set_view): * gui/e-day-view.c: (time_range_changed_cb), (model_row_changed_cb), (model_cell_changed_cb), (model_rows_inserted_cb), (model_rows_deleted_cb), (timezone_changed_cb), (e_day_view_init), (init_model), (e_day_view_new), (e_day_view_set_mins_per_row), (e_day_view_add_event), (e_day_view_check_layout): * gui/e-day-view.h: * gui/e-week-view-config.c: (e_week_view_config_set_view): * gui/e-week-view.c: (time_range_changed_cb), (model_row_changed_cb), (model_cell_changed_cb), (model_rows_inserted_cb), (model_rows_deleted_cb), (timezone_changed_cb), (e_week_view_init), (init_model), (e_week_view_new), (e_week_view_add_event), (e_week_view_check_layout): * gui/e-week-view.h: * gui/gnome-cal.c: (message_proxy), (create_thread_pool), (message_push), (update_query_async), (update_query), (set_search_query), (set_timezone), (setup_widgets), (update_view_times), (display_view), (display_view_cb), (add_mclient_async), (add_mclient), (client_cal_opened_cb), (default_client_cal_opened_cb), (gnome_calendar_remove_source_by_uid), (gnome_calendar_on_date_navigator_selection_changed): Use a single model for all the views. svn path=/trunk/; revision=35977 --- calendar/gui/e-cal-model.c | 144 +++++++++++++++++++++++++++++++-------------- 1 file changed, 100 insertions(+), 44 deletions(-) (limited to 'calendar/gui/e-cal-model.c') diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 23f6ea89f8..ce34884c34 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -75,6 +75,10 @@ struct _ECalModelPrivate { gboolean use_24_hour_format; }; +#define E_CAL_MODEL_COMPONENT_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CAL_MODEL_COMPONENT, ECalModelComponentPrivate)) + static void e_cal_model_dispose (GObject *object); static void e_cal_model_finalize (GObject *object); @@ -1120,9 +1124,6 @@ e_cal_model_set_timezone (ECalModel *model, icaltimezone *zone) e_table_model_pre_change (E_TABLE_MODEL (model)); priv->zone = zone; - for (l = priv->clients; l; l = l->next) - e_cal_set_default_timezone (((ECalModelClient *)l->data)->client, priv->zone, NULL); - /* the timezone affects the times shown for date fields, so we need to redisplay everything */ e_table_model_changed (E_TABLE_MODEL (model)); @@ -1364,13 +1365,11 @@ add_instance_cb (ECalComponent *comp, time_t instance_start, time_t instance_end e_cal_component_set_dtend (comp, &to_set); e_cal_component_free_datetime (&datetime); - comp_data = g_new0 (ECalModelComponent, 1); + comp_data = g_object_new (E_TYPE_CAL_MODEL_COMPONENT, NULL); comp_data->client = g_object_ref (rdata->client); comp_data->icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp)); comp_data->instance_start = instance_start; comp_data->instance_end = instance_end; - comp_data->dtstart = comp_data->dtend = comp_data->due = comp_data->completed = NULL; - comp_data->color = NULL; g_ptr_array_add (priv->objects, comp_data); e_table_model_row_inserted (E_TABLE_MODEL (rdata->model), priv->objects->len - 1); @@ -1456,12 +1455,10 @@ e_cal_view_objects_added_cb (ECalView *query, GList *objects, gpointer user_data } else { e_table_model_pre_change (E_TABLE_MODEL (model)); - comp_data = g_new0 (ECalModelComponent, 1); + comp_data = g_object_new (E_TYPE_CAL_MODEL_COMPONENT, NULL); comp_data->client = g_object_ref (e_cal_view_get_client (query)); comp_data->icalcomp = icalcomponent_new_clone (l->data); e_cal_model_set_instance_times (comp_data, priv->zone); - comp_data->dtstart = comp_data->dtend = comp_data->due = comp_data->completed = NULL; - comp_data->color = NULL; g_ptr_array_add (priv->objects, comp_data); e_table_model_row_inserted (E_TABLE_MODEL (model), priv->objects->len - 1); @@ -1525,6 +1522,7 @@ e_cal_view_done_cb (ECalView *query, ECalendarStatus status, gpointer user_data) { ECalModel *model = (ECalModel *) user_data; ECal *client = e_cal_view_get_client (query); + ECalModelPrivate *priv = model->priv; g_return_if_fail (E_IS_CAL_MODEL (model)); @@ -1537,6 +1535,8 @@ static void update_e_cal_view_for_client (ECalModel *model, ECalModelClient *client_data) { ECalModelPrivate *priv; + GError *error = NULL; + gint tries = 0; priv = model->priv; @@ -1559,7 +1559,16 @@ update_e_cal_view_for_client (ECalModel *model, ECalModelClient *client_data) if (!client_data->do_query) return; - if (!e_cal_get_query (client_data->client, priv->full_sexp, &client_data->query, NULL)) { +try_again: + if (!e_cal_get_query (client_data->client, priv->full_sexp, &client_data->query, &error)) { + if (error->code == E_CALENDAR_STATUS_BUSY && tries != 3) { + tries++; + /*TODO chose an optimal value */ + g_usleep (50); + g_clear_error (&error); + goto try_again; + } + g_warning (G_STRLOC ": Unable to get query"); return; @@ -1597,7 +1606,6 @@ cal_opened_cb (ECal *client, ECalendarStatus status, gpointer user_data) if (status != E_CALENDAR_STATUS_OK) { e_cal_model_remove_client (model, client); - return; } @@ -1619,6 +1627,11 @@ add_new_client (ECalModel *model, ECal *client, gboolean do_query) priv = model->priv; + /* DEBUG the load state should always be loaded here + if (e_cal_get_load_state (client) != E_CAL_LOAD_LOADED) { + g_assert_not_reached (); + } */ + /* Look to see if we already have this client */ client_data = find_client_data (model, client); if (client_data) { @@ -2087,45 +2100,32 @@ copy_ecdv (ECellDateEditValue *ecdv) return new_ecdv; } -/** - * e_cal_model_copy_component_data - */ -ECalModelComponent * -e_cal_model_copy_component_data (ECalModelComponent *comp_data) -{ - ECalModelComponent *new_data; - g_return_val_if_fail (comp_data != NULL, NULL); +struct _ECalModelComponentPrivate { +}; - new_data = g_new0 (ECalModelComponent, 1); +static void e_cal_model_component_finalize (GObject *object); - new_data->instance_start = comp_data->instance_start; - new_data->instance_end = comp_data->instance_end; - if (comp_data->icalcomp) - new_data->icalcomp = icalcomponent_new_clone (comp_data->icalcomp); - if (comp_data->client) - new_data->client = g_object_ref (comp_data->client); - if (comp_data->dtstart) - new_data->dtstart = copy_ecdv (comp_data->dtstart); - if (comp_data->dtend) - new_data->dtend = copy_ecdv (comp_data->dtend); - if (comp_data->due) - new_data->due = copy_ecdv (comp_data->due); - if (comp_data->completed) - new_data->completed = copy_ecdv (comp_data->completed); - if (comp_data->color) - new_data->color = g_strdup (comp_data->color); +static GObjectClass *parent_class; - return new_data; +/* Class initialization function for the calendar component object */ +static void +e_cal_model_component_class_init (ECalModelComponentClass *klass) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) klass; + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = e_cal_model_component_finalize; } -/** - * e_cal_model_free_component_data - */ -void -e_cal_model_free_component_data (ECalModelComponent *comp_data) + +static void +e_cal_model_component_finalize (GObject *object) { - g_return_if_fail (comp_data != NULL); + ECalModelComponent *comp_data = E_CAL_MODEL_COMPONENT(object); if (comp_data->client) { g_object_unref (comp_data->client); @@ -2155,8 +2155,64 @@ e_cal_model_free_component_data (ECalModelComponent *comp_data) g_free (comp_data->color); comp_data->color = NULL; } + + if (G_OBJECT_CLASS (parent_class)->finalize) + (* G_OBJECT_CLASS (parent_class)->finalize) (object); +} + +/* Object initialization function for the calendar component object */ +static void +e_cal_model_component_init (ECalModelComponent *comp) +{ + comp->dtstart = NULL; + comp->dtend = NULL; + comp->due = NULL; + comp->completed = NULL; + comp->color = NULL; +} + +GType +e_cal_model_component_get_type (void) +{ + static GType e_cal_model_component_type = 0; + + if (!e_cal_model_component_type) { + static GTypeInfo info = { + sizeof (ECalModelComponentClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) e_cal_model_component_class_init, + NULL, NULL, + sizeof (ECalModelComponent), + 0, + (GInstanceInitFunc) e_cal_model_component_init + }; + e_cal_model_component_type = g_type_register_static (G_TYPE_OBJECT, "ECalModelComponent", &info, 0); + } + + return e_cal_model_component_type; +} - g_free (comp_data); +/** + * e_cal_model_copy_component_data + */ +ECalModelComponent * +e_cal_model_copy_component_data (ECalModelComponent *comp_data) +{ + g_return_val_if_fail (comp_data != NULL, NULL); + + return g_object_ref (comp_data); +} + +/** + * e_cal_model_free_component_data + */ +void +e_cal_model_free_component_data (ECalModelComponent *comp_data) +{ + g_return_if_fail (comp_data != NULL); + + g_object_unref (comp_data); } /** -- cgit From 63376bd6f23bd75e29c8bdeec521cca8e24f1cd5 Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Thu, 14 Aug 2008 09:10:01 +0000 Subject: Fixed some warnings. 2008-08-17 Chenthill Palanisamy * gui/dialogs/event-page.c: (source_changed_cb): * gui/dialogs/memo-page.c: (source_changed_cb): * gui/e-cal-model.c: (e_cal_model_set_timezone), (e_cal_view_done_cb): * gui/e-day-view-config.c: Fixed some warnings. svn path=/trunk/; revision=35987 --- calendar/gui/e-cal-model.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'calendar/gui/e-cal-model.c') diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index ce34884c34..818015cade 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -1115,7 +1115,6 @@ void e_cal_model_set_timezone (ECalModel *model, icaltimezone *zone) { ECalModelPrivate *priv; - GList *l; g_return_if_fail (E_IS_CAL_MODEL (model)); @@ -1522,7 +1521,6 @@ e_cal_view_done_cb (ECalView *query, ECalendarStatus status, gpointer user_data) { ECalModel *model = (ECalModel *) user_data; ECal *client = e_cal_view_get_client (query); - ECalModelPrivate *priv = model->priv; g_return_if_fail (E_IS_CAL_MODEL (model)); @@ -2088,6 +2086,7 @@ e_cal_model_date_value_to_string (ECalModel *model, const void *value) return g_strdup (buffer); } +/* FIXME is it still needed ? static ECellDateEditValue * copy_ecdv (ECellDateEditValue *ecdv) { @@ -2098,7 +2097,7 @@ copy_ecdv (ECellDateEditValue *ecdv) new_ecdv->zone = ecdv ? ecdv->zone : NULL; return new_ecdv; -} +} */ struct _ECalModelComponentPrivate { -- cgit From 14fa5c8a8cf736e3207b9d9e414586d9ff3a623f Mon Sep 17 00:00:00 2001 From: Sankarasivasubramanian Pasupathilingam Date: Tue, 2 Sep 2008 16:25:53 +0000 Subject: Change License from GPL to LGPL. 2nd batch. More changes to come. svn path=/trunk/; revision=36247 --- calendar/gui/e-cal-model.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'calendar/gui/e-cal-model.c') diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 818015cade..42702c1416 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -1,21 +1,25 @@ -/* Evolution calendar - Data model for ETable - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Rodrigo Moya +/* + * Evolution calendar - Data model for ETable * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Rodrigo Moya + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -- cgit From d620820eab5d5f3814debb1b5f0dc7c5a7138973 Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Mon, 8 Sep 2008 09:31:56 +0000 Subject: Fixes #544187. svn path=/trunk/; revision=36276 --- calendar/gui/e-cal-model.c | 124 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 112 insertions(+), 12 deletions(-) (limited to 'calendar/gui/e-cal-model.c') diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 42702c1416..d78e4f5dbc 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -109,6 +109,7 @@ static void remove_client (ECalModel *model, ECalModelClient *client_data); enum { TIME_RANGE_CHANGED, ROW_APPENDED, + COMPS_DELETED, CAL_VIEW_PROGRESS, CAL_VIEW_DONE, LAST_SIGNAL @@ -159,6 +160,16 @@ e_cal_model_class_init (ECalModelClass *klass) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + + signals[COMPS_DELETED] = + g_signal_new ("comps_deleted", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ECalModelClass, comps_deleted), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, G_TYPE_POINTER); + signals[CAL_VIEW_PROGRESS] = g_signal_new ("cal_view_progress", G_TYPE_FROM_CLASS (klass), @@ -1431,13 +1442,21 @@ e_cal_view_objects_added_cb (ECalView *query, GList *objects, gpointer user_data while ((comp_data = search_by_id_and_client (priv, client, id))) { int 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); - - if (g_ptr_array_remove (priv->objects, comp_data)) - e_cal_model_free_component_data (comp_data); } e_cal_component_free_id (id); @@ -1473,9 +1492,45 @@ static void e_cal_view_objects_modified_cb (ECalView *query, GList *objects, gpointer user_data) { ECalModel *model = (ECalModel *) user_data; + ECalModelPrivate *priv; + GList *l, *list = NULL; + + priv = model->priv; + + /* 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)) + g_list_prepend (list, l->data); + else { + int pos; + ECalModelComponent *comp_data; + 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; + } + + 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); + + 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); + } + } - /* now re-add all objects */ - e_cal_view_objects_added_cb (query, objects, model); + e_cal_view_objects_added_cb (query, list, model); + g_list_free (list); } static void @@ -1494,13 +1549,21 @@ e_cal_view_objects_removed_cb (ECalView *query, GList *ids, gpointer user_data) /* make sure we remove all objects with this UID */ while ((comp_data = search_by_id_and_client (priv, e_cal_view_get_client (query), id))) { + GSList *l = NULL; + pos = get_position_in_array (priv->objects, comp_data); + if (!g_ptr_array_remove (priv->objects, comp_data)) + continue; + + l = g_slist_append (l, comp_data); + g_signal_emit (G_OBJECT (model), signals[COMPS_DELETED], 0, l); + + g_slist_free (l); + g_object_unref (comp_data); + e_table_model_pre_change (E_TABLE_MODEL (model)); e_table_model_row_deleted (E_TABLE_MODEL (model), pos); - - if (g_ptr_array_remove (priv->objects, comp_data)) - e_cal_model_free_component_data (comp_data); } } @@ -1692,11 +1755,18 @@ remove_client_objects (ECalModel *model, ECalModelClient *client_data) g_return_if_fail (comp_data != NULL); if (comp_data->client == client_data->client) { - e_table_model_pre_change (E_TABLE_MODEL (model)); - e_table_model_row_deleted (E_TABLE_MODEL (model), i - 1); + GSList *l = NULL; g_ptr_array_remove (model->priv->objects, comp_data); - e_cal_model_free_component_data (comp_data); + + l = g_slist_append (l, comp_data); + g_signal_emit (G_OBJECT (model), signals[COMPS_DELETED], 0, l); + + g_slist_free (l); + g_object_unref (comp_data); + + e_table_model_pre_change (E_TABLE_MODEL (model)); + e_table_model_row_deleted (E_TABLE_MODEL (model), i - 1); } } @@ -1768,11 +1838,34 @@ e_cal_model_remove_all_clients (ECalModel *model) } } +static GSList * +get_objects_as_list (ECalModel *model) +{ + gint i; + GSList *l = NULL; + ECalModelPrivate *priv = model->priv; + + for (i = 0; i < priv->objects->len; i++) { + ECalModelComponent *comp_data; + + comp_data = g_ptr_array_index (priv->objects, i); + if (comp_data == NULL) { + g_warning ("comp_data is null\n"); + continue; + } + + l = g_slist_prepend (l, comp_data); + } + + return l; +} + static void redo_queries (ECalModel *model) { ECalModelPrivate *priv; GList *l; + GSList *sl, *slist; int len; priv = model->priv; @@ -1802,8 +1895,15 @@ redo_queries (ECalModel *model) /* clean up the current contents */ e_table_model_pre_change (E_TABLE_MODEL (model)); len = priv->objects->len; + + slist = get_objects_as_list (model); + g_ptr_array_set_size (priv->objects, 0); + g_signal_emit (G_OBJECT (model), signals[COMPS_DELETED], 0, slist); + e_table_model_rows_deleted (E_TABLE_MODEL (model), 0, len); - clear_objects_array (priv); + + g_slist_foreach (slist, (GFunc)g_object_unref, NULL); + g_slist_free (slist); /* update the query for all clients */ for (l = priv->clients; l != NULL; l = l->next) { -- cgit From 0ce029d8613205e1c49b771598cae8fe4ab514f9 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 9 Sep 2008 09:06:46 +0000 Subject: ** Fix for bug #551382 2008-09-09 Milan Crha ** Fix for bug #551382 * gui/e-week-view.c: (model_comps_deleted_cb): * gui/e-cal-model.c: (redo_queries): Get rid of unused variables. * gui/e-cal-model.c: (e_cal_view_objects_modified_cb): Use result of g_list_prepend, thus report changes properly. svn path=/trunk/; revision=36282 --- calendar/gui/e-cal-model.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'calendar/gui/e-cal-model.c') diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index d78e4f5dbc..0b476a4bd5 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -1500,7 +1500,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)) - g_list_prepend (list, l->data); + list = g_list_prepend (list, l->data); else { int pos; ECalModelComponent *comp_data; @@ -1865,7 +1865,7 @@ redo_queries (ECalModel *model) { ECalModelPrivate *priv; GList *l; - GSList *sl, *slist; + GSList *slist; int len; priv = model->priv; -- cgit From 0418253eff2bc00c1b9ae9f4daa7af82a71b4899 Mon Sep 17 00:00:00 2001 From: Suman Manjunath Date: Sun, 14 Sep 2008 08:17:20 +0000 Subject: Chenthill Palanisamy ** Fix for bug #551628 (Remove old events from the view when objects are modified). svn path=/trunk/; revision=36322 --- calendar/gui/e-cal-model.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'calendar/gui/e-cal-model.c') 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); -- cgit From 98ef226a72cdc5d0494d79aa59aafb4896672b58 Mon Sep 17 00:00:00 2001 From: Jeff Cai Date: Mon, 8 Dec 2008 15:58:13 +0000 Subject: ** Fix for bug #563633 2008-12-08 Jeff Cai ** Fix for bug #563633 * gui/e-cal-model.c: Add an unused member for _ECalModelComponentPrivate svn path=/trunk/; revision=36851 --- calendar/gui/e-cal-model.c | 1 + 1 file changed, 1 insertion(+) (limited to 'calendar/gui/e-cal-model.c') diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index c97f61ca0f..76004c87e3 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -2226,6 +2226,7 @@ copy_ecdv (ECellDateEditValue *ecdv) struct _ECalModelComponentPrivate { + char nouse; }; static void e_cal_model_component_finalize (GObject *object); -- cgit From 4340e3cf7afcde55fdf063e4220bcff67e822167 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 17 Dec 2008 17:14:05 +0000 Subject: Show reason of a failure on a console too. 2008-12-17 Milan Crha * gui/e-cal-model.c: (update_e_cal_view_for_client): Show reason of a failure on a console too. svn path=/trunk/; revision=36913 --- calendar/gui/e-cal-model.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/e-cal-model.c') diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 76004c87e3..60dfd5e467 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -1655,7 +1655,7 @@ try_again: goto try_again; } - g_warning (G_STRLOC ": Unable to get query"); + g_warning (G_STRLOC ": Unable to get query, %s", error->message); return; } -- cgit From 81dd4dc7093219b04e3e13fa9b9f7e61211d02f2 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 14 Jan 2009 12:42:52 +0000 Subject: ** Fix for bug #554454 2009-01-14 Milan Crha ** Fix for bug #554454 * gui/e-cal-model.c: (e_cal_view_objects_modified_cb): Do not crash when received 'modified' event for something not in a model. And a leak fix. svn path=/trunk/; revision=37068 --- calendar/gui/e-cal-model.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'calendar/gui/e-cal-model.c') diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 60dfd5e467..7f7fe2db02 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -1518,6 +1518,15 @@ e_cal_view_objects_modified_cb (ECalView *query, GList *objects, gpointer user_d id = e_cal_component_get_id (comp); comp_data = search_by_id_and_client (priv, client, id); + + e_cal_component_free_id (id); + g_object_unref (comp); + + if (!comp_data) { + /* the modified component is not in the model yet, just skip it */ + continue; + } + if (comp_data->icalcomp) icalcomponent_free (comp_data->icalcomp); if (comp_data->dtstart) { -- cgit From fa2e93cedc1396a3e323c3a4a1bfdfee8ac3bf53 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 19 Jan 2009 16:41:40 +0000 Subject: ** Fix for bug #567850 2009-01-19 Milan Crha ** Fix for bug #567850 * gui/e-cal-model.h: (e_cal_model_set_default_time_func): * gui/e-cal-model.c: (struct _ECalModelPrivate), (ecm_append_row), (e_cal_model_set_default_time_func): New functionality to retrieve a default time for a model's new event created from a "click-to-add" row. * gui/gnome-cal.c: (gc_get_default_time), (setup_widgets): Set the new time callback for the memo table. svn path=/trunk/; revision=37100 --- calendar/gui/e-cal-model.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'calendar/gui/e-cal-model.c') diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 7f7fe2db02..f834007003 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -77,6 +77,10 @@ struct _ECalModelPrivate { /* Whether we display dates in 24-hour format. */ gboolean use_24_hour_format; + + /* callback, to retrieve start time for newly added rows by click-to-add */ + ECalModelDefaultTimeFunc get_default_time; + gpointer get_default_time_user_data; }; #define E_CAL_MODEL_COMPONENT_GET_PRIVATE(obj) \ @@ -816,9 +820,26 @@ ecm_append_row (ETableModel *etm, ETableModel *source, int row) set_categories (&comp_data, e_table_model_value_at (source, E_CAL_MODEL_FIELD_CATEGORIES, row)); set_classification (&comp_data, e_table_model_value_at (source, E_CAL_MODEL_FIELD_CLASSIFICATION, row)); set_description (&comp_data, e_table_model_value_at (source, E_CAL_MODEL_FIELD_DESCRIPTION, row)); - set_dtstart (model, &comp_data, e_table_model_value_at (source, E_CAL_MODEL_FIELD_DTSTART, row)); set_summary (&comp_data, e_table_model_value_at (source, E_CAL_MODEL_FIELD_SUMMARY, row)); + if (e_table_model_value_at (source, E_CAL_MODEL_FIELD_DTSTART, row)) { + set_dtstart (model, &comp_data, e_table_model_value_at (source, E_CAL_MODEL_FIELD_DTSTART, row)); + } else if (model->priv->get_default_time) { + time_t tt = model->priv->get_default_time (model, model->priv->get_default_time_user_data); + + if (tt > 0) { + struct icaltimetype itt = icaltime_from_timet_with_zone (tt, FALSE, e_cal_model_get_timezone (model)); + icalproperty *prop = icalcomponent_get_first_property (comp_data.icalcomp, ICAL_DTSTART_PROPERTY); + + if (prop) { + icalproperty_set_dtstart (prop, itt); + } else { + prop = icalproperty_new_dtstart (itt); + icalcomponent_add_property (comp_data.icalcomp, prop); + } + } + } + /* call the class' method for filling the component */ model_class = (ECalModelClass *) G_OBJECT_GET_CLASS (model); if (model_class->fill_component_from_model != NULL) { @@ -2460,3 +2481,17 @@ e_cal_model_set_instance_times (ECalModelComponent *comp_data, const icaltimezon } comp_data->instance_end = icaltime_as_timet_with_zone (end_time, zone); } + +/** + * e_cal_model_set_default_time_func: + * This function will be used when creating new item from the "click-to-add", + * when user didn't fill a start date there. + **/ +void +e_cal_model_set_default_time_func (ECalModel *model, ECalModelDefaultTimeFunc func, gpointer user_data) +{ + g_return_if_fail (E_IS_CAL_MODEL (model)); + + model->priv->get_default_time = func; + model->priv->get_default_time_user_data = user_data; +} -- cgit From 708696127f3702bdf1bdb424dce490d679420842 Mon Sep 17 00:00:00 2001 From: Suman Manjunath Date: Wed, 21 Jan 2009 06:42:45 +0000 Subject: ** Fix for bug #541209 2009-01-21 Suman Manjunath ** Fix for bug #541209 ** Adapt to the new APIs from upstream libical. Changes made include using the "_r" counterpart for the following APIs: + icalproperty_as_ical_string () + icalvalue_as_ical_string () + icalcomponent_as_ical_string () + icalparameter_as_ical_string () + icaldurationtype_as_ical_string () + icalenum_reqstat_code () + icallangbind_property_eval_string () + icallangbind_quote_as_ical () + icalmime_text_end_part () + icalperiodtype_as_ical_string () + icalproperty_enum_to_string () + icalproperty_get_parameter_as_string () + icalproperty_get_value_as_string () + icalproperty_get_property_name () + icalrecurrencetype_as_string () + icaltime_as_ical_string () + icalreqstattype_as_string () + icalvalue_binary_as_ical_string () + icalvalue_int_as_ical_string () + icalvalue_utcoffset_as_ical_string () + icalvalue_string_as_ical_string () + icalvalue_recur_as_ical_string () + icalvalue_text_as_ical_string () + icalvalue_attach_as_ical_string () + icalvalue_duration_as_ical_string () + icalvalue_date_as_ical_string () + icalvalue_datetime_as_ical_string () + icalvalue_float_as_ical_string () + icalvalue_geo_as_ical_string () + icalvalue_datetimeperiod_as_ical_string () + icalvalue_period_as_ical_string () + icalvalue_trigger_as_ical_string () + icalvalue_as_ical_string () svn path=/trunk/; revision=37113 --- calendar/gui/e-cal-model.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/e-cal-model.c') diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index f834007003..63e840ccb1 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -1338,7 +1338,7 @@ search_by_id_and_client (ECalModelPrivate *priv, ECal *client, const ECalCompone gboolean has_rid = (id->rid && *id->rid); uid = icalcomponent_get_uid (comp_data->icalcomp); - rid = icaltime_as_ical_string (icalcomponent_get_recurrenceid (comp_data->icalcomp)); + rid = icaltime_as_ical_string_r (icalcomponent_get_recurrenceid (comp_data->icalcomp)); if (uid && *uid) { if ((!client || comp_data->client == client) && !strcmp (id->uid, uid)) { -- cgit From bf4820e7210c70abc7fd4249dc838115bdec6727 Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Fri, 30 Jan 2009 09:28:55 +0000 Subject: Fixes #347287. svn path=/trunk/; revision=37187 --- calendar/gui/e-cal-model.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'calendar/gui/e-cal-model.c') diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 63e840ccb1..3c64e04296 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -1677,10 +1677,10 @@ update_e_cal_view_for_client (ECalModel *model, ECalModelClient *client_data) try_again: if (!e_cal_get_query (client_data->client, priv->full_sexp, &client_data->query, &error)) { - if (error->code == E_CALENDAR_STATUS_BUSY && tries != 3) { + if (error->code == E_CALENDAR_STATUS_BUSY && tries != 10) { tries++; /*TODO chose an optimal value */ - g_usleep (50); + g_usleep (500); g_clear_error (&error); goto try_again; } -- cgit From bd8d2c529fe15e979dd2d33be2fa36c2358f0a96 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 4 Mar 2009 15:41:36 +0000 Subject: ** Fix for bug #573122 2009-03-04 Milan Crha ** Fix for bug #573122 * gui/dialogs/cal-prefs-dialog.c: (timezone_changed), (show_config): * gui/calendar-config.c: (calendar_config_get_icaltimezone): * gui/e-cal-model.c: (ecm_value_at): Do not pass NULL to icalcomponent_get_first_component. svn path=/trunk/; revision=37366 --- calendar/gui/e-cal-model.c | 1 + 1 file changed, 1 insertion(+) (limited to 'calendar/gui/e-cal-model.c') diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 3c64e04296..4007e1236f 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -469,6 +469,7 @@ ecm_value_at (ETableModel *etm, int col, int row) comp_data = g_ptr_array_index (priv->objects, row); g_return_val_if_fail (comp_data != NULL, NULL); + g_return_val_if_fail (comp_data->icalcomp != NULL, NULL); switch (col) { case E_CAL_MODEL_FIELD_CATEGORIES : -- cgit From e42f27652709397453431b75c32601a4f4effd48 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 23 Apr 2009 10:02:07 -0400 Subject: Bug 577929 – Consolidate marshallers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Consolidate all marshalling specifications to e-util/e-marshal.list. This reduces code duplication and makes it slightly easier to locate unused marshallers. --- calendar/gui/e-cal-model.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'calendar/gui/e-cal-model.c') diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 4007e1236f..4fcfbd7609 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -35,7 +35,7 @@ #include "e-cal-model.h" #include "itip-utils.h" #include "misc.h" -#include "e-calendar-marshal.h" +#include "e-util/e-util.h" #include "calendar-config.h" typedef struct { @@ -153,7 +153,7 @@ e_cal_model_class_init (ECalModelClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ECalModelClass, time_range_changed), NULL, NULL, - e_calendar_marshal_VOID__LONG_LONG, + e_marshal_VOID__LONG_LONG, G_TYPE_NONE, 2, G_TYPE_LONG, G_TYPE_LONG); signals[ROW_APPENDED] = @@ -180,7 +180,7 @@ e_cal_model_class_init (ECalModelClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ECalModelClass, cal_view_progress), NULL, NULL, - e_calendar_marshal_VOID__STRING_INT_INT, + e_marshal_VOID__STRING_INT_INT, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT); signals[CAL_VIEW_DONE] = g_signal_new ("cal_view_done", @@ -188,7 +188,7 @@ e_cal_model_class_init (ECalModelClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ECalModelClass, cal_view_done), NULL, NULL, - e_calendar_marshal_VOID__INT_INT, + e_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); } -- cgit