diff options
| author | Rodrigo Moya <rodrigo@novell.com> | 2005-04-07 18:08:23 +0000 |
|---|---|---|
| committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2005-04-07 18:08:23 +0000 |
| commit | de3cd68fc6b97e9139fc633c86a2e932b14139fc (patch) | |
| tree | 00c41b01a034e9195aef89db3553f1cc9e0700d4 /calendar | |
| parent | 0377964989b16452b7b09c1a7f03e7933124ca7a (diff) | |
| download | evolution-data-server-de3cd68fc6b97e9139fc633c86a2e932b14139fc.tar.gz | |
check load state and if in progress or already loaded, notify caller and
2004-04-06 Rodrigo Moya <rodrigo@novell.com>
* libecal/e-cal.c (e_cal_open_async): check load state and if in
progress or already loaded, notify caller and return.
2005-04-06 Chenthill Palanisamy <pchenthill@novell.com>
* libecal/e-cal.c
(open_calendar): Added a boolean variable in open_calendar
to ensure authentication when the mode is switched.If the calendar is
loaded return TRUE. Set the load_state to not loaded if the loading
fails.
(open_async), (e_cal_open), (reopen_with_auth): Added additional
argument for the open_calendar call.
Diffstat (limited to 'calendar')
| -rw-r--r-- | calendar/ChangeLog | 16 | ||||
| -rw-r--r-- | calendar/libecal/e-cal.c | 37 |
2 files changed, 46 insertions, 7 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 36652d131..8e5cb472e 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,4 +1,20 @@ +2004-04-06 Rodrigo Moya <rodrigo@novell.com> + + * libecal/e-cal.c (e_cal_open_async): check load state and if in + progress or already loaded, notify caller and return. + +2005-04-06 Chenthill Palanisamy <pchenthill@novell.com> + + * libecal/e-cal.c + (open_calendar): Added a boolean variable in open_calendar + to ensure authentication when the mode is switched.If the calendar is + loaded return TRUE. Set the load_state to not loaded if the loading + fails. + (open_async), (e_cal_open), (reopen_with_auth): Added additional + argument for the open_calendar call. + 2005-04-06 Christian Kellner <gicmo@gnome.org> + * libecal/e-cal.c (set_local_attachment_store): Add support for scalix provider. Also plug a small mem leak. diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c index 6c85a82f7..eba1c33bd 100644 --- a/calendar/libecal/e-cal.c +++ b/calendar/libecal/e-cal.c @@ -887,8 +887,10 @@ cal_query_cb (ECalListener *listener, ECalendarStatus status, GNOME_Evolution_Ca static gboolean reopen_with_auth (gpointer data) -{ - e_cal_open (E_CAL(data), TRUE, NULL); +{ + ECalendarStatus status; + + open_calendar (E_CAL (data), TRUE, NULL, &status, TRUE); return FALSE; } @@ -1489,7 +1491,7 @@ e_cal_set_auth_func (ECal *ecal, ECalAuthFunc func, gpointer data) } static gboolean -open_calendar (ECal *ecal, gboolean only_if_exists, GError **error, ECalendarStatus *status) +open_calendar (ECal *ecal, gboolean only_if_exists, GError **error, ECalendarStatus *status, gboolean needs_auth) { ECalPrivate *priv; CORBA_Environment ev; @@ -1502,8 +1504,14 @@ open_calendar (ECal *ecal, gboolean only_if_exists, GError **error, ECalendarSta priv = ecal->priv; + g_mutex_lock (ecal->priv->mutex); + if (!needs_auth && priv->load_state == E_CAL_LOAD_LOADED) { + g_mutex_unlock (ecal->priv->mutex); + return TRUE; + } + if (ecal->priv->current_op != NULL) { g_mutex_unlock (ecal->priv->mutex); *status = E_CALENDAR_STATUS_BUSY; @@ -1525,6 +1533,7 @@ open_calendar (ECal *ecal, gboolean only_if_exists, GError **error, ECalendarSta e_calendar_remove_op (ecal, our_op); g_mutex_unlock (our_op->mutex); e_calendar_free_op (our_op); + priv->load_state = E_CAL_LOAD_NOT_LOADED; *status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED; E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error); } @@ -1534,6 +1543,7 @@ open_calendar (ECal *ecal, gboolean only_if_exists, GError **error, ECalendarSta e_calendar_remove_op (ecal, our_op); g_mutex_unlock (our_op->mutex); e_calendar_free_op (our_op); + priv->load_state = E_CAL_LOAD_NOT_LOADED; *status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED; E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error); } @@ -1546,6 +1556,7 @@ open_calendar (ECal *ecal, gboolean only_if_exists, GError **error, ECalendarSta e_calendar_remove_op (ecal, our_op); g_mutex_unlock (our_op->mutex); e_calendar_free_op (our_op); + priv->load_state = E_CAL_LOAD_NOT_LOADED; *status = E_CALENDAR_STATUS_URI_NOT_LOADED; E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error); } @@ -1556,6 +1567,7 @@ open_calendar (ECal *ecal, gboolean only_if_exists, GError **error, ECalendarSta e_calendar_remove_op (ecal, our_op); g_mutex_unlock (our_op->mutex); e_calendar_free_op (our_op); + priv->load_state = E_CAL_LOAD_NOT_LOADED; *status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED; E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error); } @@ -1587,6 +1599,7 @@ open_calendar (ECal *ecal, gboolean only_if_exists, GError **error, ECalendarSta g_warning (G_STRLOC ": Unable to contact backend"); *status = E_CALENDAR_STATUS_CORBA_EXCEPTION; + priv->load_state = E_CAL_LOAD_NOT_LOADED; E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error); } @@ -1602,7 +1615,7 @@ open_calendar (ECal *ecal, gboolean only_if_exists, GError **error, ECalendarSta g_mutex_unlock (our_op->mutex); e_calendar_free_op (our_op); - if (*status == E_CALENDAR_STATUS_OK) + if (*status == E_CALENDAR_STATUS_OK) priv->load_state = E_CAL_LOAD_LOADED; else priv->load_state = E_CAL_LOAD_NOT_LOADED; @@ -1631,7 +1644,7 @@ e_cal_open (ECal *ecal, gboolean only_if_exists, GError **error) ECalendarStatus status; gboolean result; - result = open_calendar (ecal, only_if_exists, error, &status); + result = open_calendar (ecal, only_if_exists, error, &status, FALSE); g_signal_emit (G_OBJECT (ecal), e_cal_signals[CAL_OPENED], 0, status); return result; @@ -1666,9 +1679,9 @@ open_async (gpointer data) { ECalAsyncData *ccad = data; - ccad->result = open_calendar (ccad->ecal, ccad->exists, NULL, &ccad->status); + ccad->result = open_calendar (ccad->ecal, ccad->exists, NULL, &ccad->status, FALSE); g_idle_add ((GSourceFunc) async_signal_idle_cb, ccad); - + return GINT_TO_POINTER (ccad->result); } @@ -1695,6 +1708,16 @@ e_cal_open_async (ECal *ecal, gboolean only_if_exists) g_return_if_fail (ecal != NULL); g_return_if_fail (E_IS_CAL (ecal)); + switch (ecal->priv->load_state) { + case E_CAL_LOAD_AUTHENTICATING : + case E_CAL_LOAD_LOADING : + g_signal_emit (G_OBJECT (ecal), e_cal_signals[CAL_OPENED], 0, E_CALENDAR_STATUS_BUSY); + return; + case E_CAL_LOAD_LOADED : + g_signal_emit (G_OBJECT (ecal), e_cal_signals[CAL_OPENED], 0, E_CALENDAR_STATUS_OK); + return; + } + ccad = g_new0 (ECalAsyncData, 1); ccad->ecal = g_object_ref (ecal); ccad->exists = only_if_exists; |
