[evolution-patches] patch for [exchange calendar]
- From: chen <pchenthill novell com>
- To: patches <evolution-patches gnome org>
- Subject: [evolution-patches] patch for [exchange calendar]
- Date: Mon, 23 Jan 2006 14:14:07 +0530
Hi,
Notify read only status to the client. Did code clean up.
thanks, Chenthill.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-exchange/ChangeLog,v
retrieving revision 1.450
diff -u -p -u -p -r1.450 ChangeLog
--- ChangeLog 18 Jan 2006 13:39:26 -0000 1.450
+++ ChangeLog 23 Jan 2006 08:20:47 -0000
@@ -1,3 +1,10 @@
+2006-01-19 Chenthill Palanisamy <pchenthill novell com>
+
+ * calendar/e-cal-backend-exchange.c:
+ (open_calendar): Some code clean up.
+ (class_init), (is_loaded): Added the implementation.
+ (set_mode), : Notify read only status to the client.
+
2006-01-18 Sushma Rai <rsushma novell com>
* configure.in : Bumped the version to 2.5.5.1
Index: calendar/e-cal-backend-exchange.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange.c,v
retrieving revision 1.55
diff -u -p -u -p -r1.55 e-cal-backend-exchange.c
--- calendar/e-cal-backend-exchange.c 18 Jan 2006 13:07:41 -0000 1.55
+++ calendar/e-cal-backend-exchange.c 23 Jan 2006 08:20:48 -0000
@@ -63,6 +63,7 @@ struct ECalBackendExchangePrivate {
/* Timezones */
GHashTable *timezones;
icaltimezone *default_timezone;
+ gboolean is_loaded;
CalMode mode;
};
@@ -327,35 +328,44 @@ open_calendar (ECalBackendSync *backend,
return GNOME_Evolution_Calendar_RepositoryOffline;
}
+ cbex->account = exchange_component_get_account_for_uri (global_exchange_component, NULL);
+
+ if (cbex->account) {
+
+ exchange_account_set_offline (cbex->account);
+ if (!exchange_account_connect (cbex->account, NULL, &acresult)) {
+ cbex->folder = exchange_account_get_folder (cbex->account, uristr);
+ }
+ }
+
euri = e2k_uri_new (uristr);
load_status = load_cache (cbex, euri);
e2k_uri_free (euri);
+
+ if (load_status == GNOME_Evolution_Calendar_Success)
+ cbex->priv->is_loaded = TRUE;
g_mutex_unlock (cbex->priv->open_lock);
return load_status;
}
/* Make sure we have an open connection */
/* This steals the ExchangeAccount from ExchangeComponent */
- cbex->account = exchange_component_get_account_for_uri (global_exchange_component, uristr);
+ cbex->account = exchange_component_get_account_for_uri (global_exchange_component, NULL);
if (!cbex->account) {
- cbex->account = exchange_component_get_account_for_uri (global_exchange_component, NULL);
+ cbex->account = exchange_component_get_account_for_uri (global_exchange_component, uristr);
if (!exchange_account_connect (cbex->account, password, &acresult)) {
g_mutex_unlock (cbex->priv->open_lock);
return GNOME_Evolution_Calendar_AuthenticationFailed;
}
}
- if (!cbex->account) {
- g_mutex_unlock (cbex->priv->open_lock);
- return GNOME_Evolution_Calendar_PermissionDenied;
- }
-
if (!exchange_account_get_context (cbex->account)) {
- g_mutex_unlock (cbex->priv->open_lock);
- return GNOME_Evolution_Calendar_AuthenticationFailed;
+ if(!exchange_account_connect (cbex->account, password, &acresult)) {
+ g_mutex_unlock (cbex->priv->open_lock);
+ return GNOME_Evolution_Calendar_AuthenticationFailed;
+ }
}
-
cbex->folder = exchange_account_get_folder (cbex->account, uristr);
if (!cbex->folder) {
/* FIXME: theoretically we should create it if
@@ -392,6 +402,9 @@ open_calendar (ECalBackendSync *backend,
load_status = load_cache (cbex, euri);
+ if (load_status == GNOME_Evolution_Calendar_Success)
+ cbex->priv->is_loaded = TRUE;
+
g_mutex_unlock (cbex->priv->open_lock);
return load_status;
@@ -1165,6 +1178,18 @@ e_cal_backend_exchange_is_online (ECalBa
return TRUE;
}
+static gboolean
+is_loaded (ECalBackend *backend)
+{
+ ECalBackendExchange *cbex;
+ ECalBackendExchangePrivate *priv;
+
+ cbex = E_CAL_BACKEND_EXCHANGE (backend);
+ priv = cbex->priv;
+
+ return priv->is_loaded;
+}
+
static CalMode
get_mode (ECalBackend *backend)
{
@@ -1204,44 +1229,26 @@ set_mode (ECalBackend *backend, CalMode
switch (mode) {
case CAL_MODE_REMOTE:
- /* Change status to be online now */
- /* Should we check for access rights before setting this ? */
- d(printf ("set mode to online\n"));
- account = exchange_component_get_account_for_uri (global_exchange_component, NULL);
- /* check if authentication is required */
- if (!exchange_account_get_context (account))
- e_cal_backend_notify_auth_required(backend);
-
- uristr = e_cal_backend_get_uri (E_CAL_BACKEND (backend));
- account = exchange_component_get_account_for_uri (global_exchange_component, uristr);
- if (account)
- cbex->folder = exchange_account_get_folder (account, uristr);
-
e_cal_backend_notify_mode (backend,
GNOME_Evolution_Calendar_CalListener_MODE_SET,
GNOME_Evolution_Calendar_MODE_REMOTE);
/* FIXME : Test if available for read already */
priv->read_only = FALSE;
priv->mode = CAL_MODE_REMOTE;
+
+ e_cal_backend_notify_readonly (backend, priv->read_only);
+ if (is_loaded (backend))
+ e_cal_backend_notify_auth_required(backend);
break;
case CAL_MODE_LOCAL:
d(printf ("set mode to offline\n"));
- account = exchange_component_get_account_for_uri (global_exchange_component, NULL);
- if (account) {
- /* Call exchange_account_connect to populate the folder hierarchy,
- * so that load_cache succeeds */
- exchange_account_set_offline (account);
- if (!exchange_account_connect (account, NULL, &acresult)) {
- uristr = e_cal_backend_get_uri (E_CAL_BACKEND (backend));
- cbex->folder = exchange_account_get_folder (account, uristr);
- }
- }
- priv->mode = CAL_MODE_LOCAL;
+ priv->mode = CAL_MODE_LOCAL;
priv->read_only = TRUE;
e_cal_backend_notify_mode (backend,
GNOME_Evolution_Calendar_CalListener_MODE_SET,
GNOME_Evolution_Calendar_MODE_LOCAL);
+ e_cal_backend_notify_readonly (backend, priv->read_only);
break;
default :
@@ -1876,6 +1883,7 @@ class_init (ECalBackendExchangeClass *kl
backend_class->start_query = start_query;
backend_class->get_mode = get_mode;
backend_class->set_mode = set_mode;
+ backend_class->is_loaded = is_loaded;
backend_class->internal_get_default_timezone = internal_get_default_timezone;
backend_class->internal_get_timezone = internal_get_timezone;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]