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-calendar.c | 59 +++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 11 deletions(-) (limited to 'my-evolution/e-summary-calendar.c') diff --git a/my-evolution/e-summary-calendar.c b/my-evolution/e-summary-calendar.c index 8d874cc015..7903c3642d 100644 --- a/my-evolution/e-summary-calendar.c +++ b/my-evolution/e-summary-calendar.c @@ -44,6 +44,8 @@ #include +#define MAX_RELOAD_TRIES 10 + struct _ESummaryCalendar { CalClient *client; @@ -53,6 +55,9 @@ struct _ESummaryCalendar { char *default_uri; EConfigListener *config_listener; + + int cal_open_reload_timeout_id; + int reload_count; }; const char * @@ -89,10 +94,10 @@ cal_component_compare_tzid (const char *tzid1, const char *tzid2) return retval; } -gboolean -e_cal_comp_util_compare_event_timezones (CalComponent *comp, - CalClient *client, - icaltimezone *zone) +static gboolean +compare_event_timezones (CalComponent *comp, + CalClient *client, + icaltimezone *zone) { CalClientGetStatus status; CalComponentDateTime start_datetime, end_datetime; @@ -335,6 +340,9 @@ generate_html (gpointer data) char *tmp; time_t t, begin, end, f; + if (cal_client_get_load_state (calendar->client) != CAL_CLIENT_LOAD_LOADED) + return FALSE; + /* Set the default timezone on the server. */ if (summary->tz) { cal_client_set_default_timezone (calendar->client, @@ -379,7 +387,7 @@ generate_html (gpointer data) g_free (s1); g_free (s2); -/* e_summary_draw (summary); */ + e_summary_draw (summary); return FALSE; } else { GPtrArray *uidarray; @@ -414,9 +422,9 @@ generate_html (gpointer data) if (cal_component_has_alarms (event->comp)) { img = "es-appointments.png"; - } else if (e_cal_comp_util_compare_event_timezones (event->comp, - calendar->client, - summary->tz) == FALSE) { + } else if (compare_event_timezones (event->comp, + calendar->client, + summary->tz) == FALSE) { img = "timezone-16.xpm"; } else { img = "new_appointment.xpm"; @@ -444,7 +452,23 @@ generate_html (gpointer data) calendar->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->calendar->cal_open_reload_timeout_id = 0; + + if (++ summary->calendar->reload_count >= MAX_RELOAD_TRIES) { + summary->calendar->reload_count = 0; + return FALSE; + } + + cal_client_open_default_calendar (summary->calendar->client, FALSE); return FALSE; } @@ -456,9 +480,12 @@ cal_opened_cb (CalClient *client, 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 */ + summary->calendar->cal_open_reload_timeout_id = g_timeout_add (1000, + cal_open_reload_timeout, + summary); } } + static void obj_changed_cb (CalClient *client, const char *uid, @@ -520,6 +547,12 @@ setup_calendar (ESummary *summary) calendar = summary->calendar; g_assert (calendar != NULL); + if (calendar->cal_open_reload_timeout_id != 0) { + g_source_remove (calendar->cal_open_reload_timeout_id); + calendar->cal_open_reload_timeout_id = 0; + calendar->reload_count = 0; + } + if (calendar->client != NULL) gtk_object_unref (GTK_OBJECT (calendar->client)); @@ -549,7 +582,6 @@ config_listener_key_changed_cb (EConfigListener *listener, void *user_data) { setup_calendar (E_SUMMARY (user_data)); - generate_html (user_data); } @@ -589,6 +621,7 @@ e_summary_calendar_init (ESummary *summary) void e_summary_calendar_reconfigure (ESummary *summary) { + setup_calendar (summary); generate_html (summary); } @@ -601,6 +634,10 @@ e_summary_calendar_free (ESummary *summary) g_return_if_fail (IS_E_SUMMARY (summary)); calendar = summary->calendar; + + if (calendar->cal_open_reload_timeout_id != 0) + g_source_remove (calendar->cal_open_reload_timeout_id); + gtk_object_unref (GTK_OBJECT (calendar->client)); g_free (calendar->html); g_free (calendar->default_uri); -- cgit v1.2.3