From 3fee618acffe3885cafae17a30127468f6b7a58c Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Fri, 25 Oct 2002 22:05:14 +0000 Subject: Removed debugging message. * e-cell-tri.c (set_value): Removed debugging message. * e-summary-factory.c (control_activate): Removed the call to e_summary_thaw(). (control_deactivate): Removed the call to e_summary_freeze(). * e-summary-mail.c (folder_gen_html): Removed debugging message. (insert_path_recur): Likewise. (add_storage_to_table): Likewise. (folder_info_pb_changed): Likewise. (lazy_register_storages): Likewise. * e-summary-weather.c: #include "e-summary-preferences.h". (e_summary_weather_update): Removed debugging message. * e-summary-offline-handler.c: #include . * main.c: #include and . * e-summary-preferences.c (free_rdf_info): Removed unused function. (find_name_for_url): Likewise. (mail_etable_item_changed_cb): Likewise. (maybe_add_to_shown): Likewise. (get_folders_from_view): Removed debugging messages. * e-summary-rdf.c (tree_walk): Removed debugging message. (e_summary_rdf_update): Likewise. * e-summary-shown.c (find_entry_from_location): Removed unused function. (maybe_move_to_shown): Removed debugging message. * e-summary-tasks.c: New members cal_open_reload_timeout_id and reload_count in ESummaryTasks. (generate_html): Return if the load_state of the cal_client is not CAL_CLIENT_LOAD_LOADED. (cal_open_reload_timeout): New; timeout function for attempting to reload the calendar if the first attempt failed. (cal_opened_cb): If the load failed, register cal_open_reload_timeout to try again after one second. (setup_task_folder): If there is a pending timeout callback [cal_open_reload_timeout_id nonzero], remove it. (e_summary_tasks_init): Call setup_task_folder(). (e_summary_tasks_free): If there is a pending timeout callback [cal_open_reload_timeout_id nonzero], remove it. * e-summary-calendar.c: New members cal_open_reload_timeout_id and reload_count in ESummaryCalendar. (e_cal_comp_util_compare_event_timezones): Renamed to compare_event_timezones() and made static. (generate_html): Return if the load_state of the cal_client is not CAL_CLIENT_LOAD_LOADED. Call e_summary_draw() before returning. (cal_open_reload_timeout): New; timeout function for attempting to reload the calendar if the first attempt failed. (cal_opened_cb): Return if the load_state of the cal_client is not CAL_CLIENT_LOAD_LOADED. (e_summary_calendar_reconfigure): Call setup_calendar() so that, if the default folder has changed, it gets reloaded. (setup_calendar): If there is a pending timeout callback [cal_open_reload_timeout_id nonzero], remove it. (e_summary_calendar_free): Likewise. * e-summary.c: New member queue_draw_idle_id in ESummaryPrivate. Removed member redraw_pending. (destroy): If queue_draw_idle_id is nonzero, remove the corresponding glib mainloop source. (draw_idle_cb): New function to regenerate the HTML in the idle loop; moved all the code from e_summary_draw() in here. (e_summary_draw): Set up draw_idle_cb as an idle callback. (e_summary_init): Initialize queued_draw_idle_id. (e_summary_reload_timeout): Call e_summary_calendar_reconfigure() and e_summary_tasks_reconfigure(). Removed debugging message. (e_summary_set_online): Removed debugging message. (e_summary_freeze): Removed. (e_summary_thaw): Removed. svn path=/trunk/; revision=18443 --- my-evolution/e-summary-tasks.c | 48 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) (limited to 'my-evolution/e-summary-tasks.c') diff --git a/my-evolution/e-summary-tasks.c b/my-evolution/e-summary-tasks.c index dd7bc15349..84cbb9256f 100644 --- a/my-evolution/e-summary-tasks.c +++ b/my-evolution/e-summary-tasks.c @@ -44,6 +44,8 @@ #include #include +#define MAX_RELOAD_TRIES 10 + struct _ESummaryTasks { CalClient *client; @@ -54,6 +56,9 @@ struct _ESummaryTasks { char *default_uri; EConfigListener *config_listener; + + int cal_open_reload_timeout_id; + int reload_count; }; const char * @@ -295,6 +300,9 @@ generate_html (gpointer data) char *tmp; time_t t; + if (cal_client_get_load_state (tasks->client) != CAL_CLIENT_LOAD_LOADED) + return FALSE; + /* Set the default timezone on the server. */ if (summary->tz) { cal_client_set_default_timezone (tasks->client, @@ -325,7 +333,6 @@ generate_html (gpointer data) g_free (s1); g_free (s2); -/* e_summary_draw (summary); */ return FALSE; } else { char *s; @@ -390,7 +397,23 @@ generate_html (gpointer data) tasks->html = string->str; g_string_free (string, FALSE); -/* e_summary_draw (summary); */ + e_summary_draw (summary); + return FALSE; +} + +static gboolean +cal_open_reload_timeout (void *data) +{ + ESummary *summary = (ESummary *) data; + + summary->tasks->cal_open_reload_timeout_id = 0; + + if (++ summary->tasks->reload_count >= MAX_RELOAD_TRIES) { + summary->tasks->reload_count = 0; + return FALSE; + } + + cal_client_open_default_tasks (summary->tasks->client, FALSE); return FALSE; } @@ -399,12 +422,14 @@ cal_opened_cb (CalClient *client, CalClientOpenStatus status, ESummary *summary) { - if (status == CAL_CLIENT_OPEN_SUCCESS) { + if (status == CAL_CLIENT_OPEN_SUCCESS) g_idle_add (generate_html, summary); - } else { - /* Need to work out what to do if there's an error */ - } + else + summary->tasks->cal_open_reload_timeout_id = g_timeout_add (1000, + cal_open_reload_timeout, + summary); } + static void obj_changed_cb (CalClient *client, const char *uid, @@ -457,6 +482,12 @@ setup_task_folder (ESummary *summary) g_assert (tasks != NULL); g_assert (tasks->config_listener != NULL); + if (tasks->cal_open_reload_timeout_id != 0) { + g_source_remove (tasks->cal_open_reload_timeout_id); + tasks->cal_open_reload_timeout_id = 0; + tasks->reload_count = 0; + } + g_free (tasks->due_today_colour); g_free (tasks->overdue_colour); g_free (tasks->default_uri); @@ -536,6 +567,7 @@ e_summary_tasks_init (ESummary *summary) void e_summary_tasks_reconfigure (ESummary *summary) { + setup_task_folder (summary); generate_html (summary); } @@ -548,6 +580,10 @@ e_summary_tasks_free (ESummary *summary) g_return_if_fail (IS_E_SUMMARY (summary)); tasks = summary->tasks; + + if (tasks->cal_open_reload_timeout_id != 0) + g_source_remove (tasks->cal_open_reload_timeout_id); + gtk_object_unref (GTK_OBJECT (tasks->client)); g_free (tasks->html); g_free (tasks->due_today_colour); -- cgit v1.2.3