From 87ca42db1dcf2b0f4d095a7b0c769bfc08246e77 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Wed, 14 Jan 2004 16:37:49 +0000 Subject: check return value from e_cal_new(). 2004-01-14 Rodrigo Moya * common/authentication.c (auth_new_cal_from_source): check return value from e_cal_new(). * gui/gnome-cal.c (gnome_calendar_construct): if there is no default tasks folder, don't create the ECal from it. svn path=/trunk/; revision=24219 --- calendar/ChangeLog | 8 ++++++++ calendar/common/authentication.c | 3 ++- calendar/gui/gnome-cal.c | 37 ++++++++++++++++++------------------- 3 files changed, 28 insertions(+), 20 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 548852368b..aca86d31e3 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,11 @@ +2004-01-14 Rodrigo Moya + + * common/authentication.c (auth_new_cal_from_source): check + return value from e_cal_new(). + + * gui/gnome-cal.c (gnome_calendar_construct): if there is no + default tasks folder, don't create the ECal from it. + 2004-01-14 JP Rosevear * gui/tasks-component.c (impl_requestCreateItem): don't try to set diff --git a/calendar/common/authentication.c b/calendar/common/authentication.c index 849a2e76c3..ba0eae2893 100644 --- a/calendar/common/authentication.c +++ b/calendar/common/authentication.c @@ -42,7 +42,8 @@ auth_new_cal_from_source (ESource *source, ECalSourceType type) ECal *cal; cal = e_cal_new (source, type); - e_cal_set_auth_func (cal, (ECalAuthFunc) auth_func_cb, NULL); + if (cal) + e_cal_set_auth_func (cal, (ECalAuthFunc) auth_func_cb, NULL); return cal; } diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 1ae884d38d..05194a30b3 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -1948,34 +1948,33 @@ gnome_calendar_construct (GnomeCalendar *gcal) uid = calendar_config_get_primary_tasks (); if (uid) { ESourceList *source_list; + ESource *tasks_source; GConfClient *conf_client; conf_client = gconf_client_get_default (); source_list = e_source_list_new_for_gconf (conf_client, "/apps/evolution/tasks/sources"); - priv->task_pad_client = auth_new_cal_from_source ( - e_source_list_peek_source_by_uid (source_list, uid), E_CAL_SOURCE_TYPE_TODO); + tasks_source = e_source_list_peek_source_by_uid (source_list, uid); + if (tasks_source) { + priv->task_pad_client = auth_new_cal_from_source (tasks_source, E_CAL_SOURCE_TYPE_TODO); - g_object_unref (conf_client); - g_object_unref (source_list); - - if (!priv->task_pad_client) - return NULL; + g_signal_connect (priv->task_pad_client, "backend_error", + G_CALLBACK (backend_error_cb), gcal); + g_signal_connect (priv->task_pad_client, "categories_changed", + G_CALLBACK (client_categories_changed_cb), gcal); + g_signal_connect (priv->task_pad_client, "backend_died", + G_CALLBACK (backend_died_cb), gcal); - g_signal_connect (priv->task_pad_client, "backend_error", - G_CALLBACK (backend_error_cb), gcal); - g_signal_connect (priv->task_pad_client, "categories_changed", - G_CALLBACK (client_categories_changed_cb), gcal); - g_signal_connect (priv->task_pad_client, "backend_died", - G_CALLBACK (backend_died_cb), gcal); + if (open_ecal (gcal, priv->task_pad_client, TRUE)) { + e_cal_model_add_client (e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo)), + priv->task_pad_client); + } + } else + priv->task_pad_client = NULL; + g_object_unref (conf_client); + g_object_unref (source_list); g_free (uid); - - if (!open_ecal (gcal, priv->task_pad_client, TRUE)) - return NULL; - - e_cal_model_add_client (e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo)), - priv->task_pad_client); } /* Get the default view to show. */ -- cgit v1.2.3