diff options
-rw-r--r-- | calendar/ChangeLog | 12 | ||||
-rw-r--r-- | calendar/cal-client/cal-client.c | 55 | ||||
-rw-r--r-- | calendar/gui/dialogs/recurrence-page.c | 6 |
3 files changed, 72 insertions, 1 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index bcd403d4ae..c5547f57a9 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,15 @@ +2001-07-26 Damon Chaplin <damon@ximian.com> + + * gui/dialogs/recurrence-page.c (exception_select_row_cb): check that + the row passed in is valid. Sometimes we get the "row-selected" + signal for row 0 when there are no rows in the list. Fixes bug #4266. + + * cal-client/cal-client.c (cal_client_get_object): prefetch all the + timezone data needed by the object, to try to avoid making Corba + calls all over the place. They can cause problems because they call + the GTK+ main loop recursively. This currently leads to an assertion + failure in the GnomeCanvas occasionally. + 2001-07-25 JP Rosevear <jpr@ximian.com> * gui/e-itip-control.c (e_itip_control_set_data): gracefully diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index 601686b3bc..ff93470405 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -86,6 +86,8 @@ static char *client_get_password_cb (WombatClient *w_client, static void client_forget_password_cb (WombatClient *w_client, const gchar *key, gpointer user_data); +static void cal_client_get_object_timezones_cb (icalparameter *param, + void *data); static guint cal_client_signals[LAST_SIGNAL]; @@ -752,6 +754,19 @@ cal_client_get_n_objects (CalClient *client, CalObjType type) return n; } + +/* This is used in the callback which fetches all the timezones needed for an + object. */ +typedef struct _CalClientGetTimezonesData CalClientGetTimezonesData; +struct _CalClientGetTimezonesData { + CalClient *client; + + /* This starts out at CAL_CLIENT_GET_SUCCESS. If an error occurs this + contains the last error. */ + CalClientGetStatus status; +}; + + /** * cal_client_get_object: * @client: A calendar client. @@ -771,6 +786,7 @@ cal_client_get_object (CalClient *client, const char *uid, CalComponent **comp) GNOME_Evolution_Calendar_CalObj comp_str; CalClientGetStatus retval; icalcomponent *icalcomp; + CalClientGetTimezonesData cb_data; g_return_val_if_fail (client != NULL, CAL_CLIENT_GET_NOT_FOUND); g_return_val_if_fail (IS_CAL_CLIENT (client), CAL_CLIENT_GET_NOT_FOUND); @@ -813,7 +829,20 @@ cal_client_get_object (CalClient *client, const char *uid, CalComponent **comp) goto out; } - retval = CAL_CLIENT_GET_SUCCESS; + /* Now make sure we have all timezones needed for this object. + We do this to try to avoid any problems caused by getting a timezone + in the middle of other code. Any calls to ORBit result in a + recursive call of the GTK+ main loop, which can cause problems for + code that doesn't expect it. Currently GnomeCanvas has problems if + we try to get a timezone in the middle of a redraw, and there is a + resize pending, which leads to an assert failure and an abort. */ + cb_data.client = client; + cb_data.status = CAL_CLIENT_GET_SUCCESS; + icalcomponent_foreach_tzid (icalcomp, + cal_client_get_object_timezones_cb, + &cb_data); + + retval = cb_data.status; out: @@ -821,6 +850,30 @@ cal_client_get_object (CalClient *client, const char *uid, CalComponent **comp) return retval; } + +static void +cal_client_get_object_timezones_cb (icalparameter *param, + void *data) +{ + CalClientGetTimezonesData *cb_data = data; + const char *tzid; + icaltimezone *zone; + CalClientGetStatus status; + + tzid = icalparameter_get_tzid (param); + if (!tzid) { + cb_data->status = CAL_CLIENT_GET_SYNTAX_ERROR; + return; + } + + g_print ("Pre-fetching timezone: %s\n", tzid); + + status = cal_client_get_timezone (cb_data->client, tzid, &zone); + if (status != CAL_CLIENT_GET_SUCCESS) + cb_data->status = status; +} + + CalClientGetStatus cal_client_get_timezone (CalClient *client, const char *tzid, diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index df3dd7e9cf..b60a9f6b48 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -2087,6 +2087,12 @@ exception_select_row_cb (GtkCList *clist, gint row, gint col, rpage = RECURRENCE_PAGE (data); priv = rpage->priv; + /* Sometimes GtkCList emits a 'row-selected' signal for row 0 when + there are 0 rows in the list (after you delete the last row). + So we check that the row is valid here. */ + if (row >= clist->rows) + return; + dt = gtk_clist_get_row_data (clist, row); g_assert (dt != NULL); |