Hi,
Attached is the patch fixes problems with account level offline
settings.
Please review.
Thanks,
Sushma.
------------------------------------------------------------------------
Index: storage/exchange-account.h
===================================================================
RCS file: /cvs/gnome/evolution-exchange/storage/exchange-account.h,v
retrieving revision 1.9
diff -u -p -r1.9 exchange-account.h
--- storage/exchange-account.h 4 Feb 2005 11:29:45 -0000 1.9
+++ storage/exchange-account.h 18 Feb 2005 11:35:34 -0000
@@ -86,6 +86,7 @@ gboolean exchange_account_set_online (
gboolean exchange_account_is_offline (ExchangeAccount *account);
+gboolean exchange_account_is_offline_sync_set
(ExchangeAccount *account);
typedef enum {
Index: storage/exchange-account.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/storage/exchange-account.c,v
retrieving revision 1.31
diff -u -p -r1.31 exchange-account.c
--- storage/exchange-account.c 9 Feb 2005 11:05:23 -0000 1.31
+++ storage/exchange-account.c 18 Feb 2005 11:36:01 -0000
@@ -1495,6 +1495,21 @@ exchange_account_connect (ExchangeAccoun
}
/**
+ * exchange_account_is_offline_sync_set:
+ * @account: an #ExchangeAccount
+ *
+ * Return value: TRUE if offline_sync is set for @account and FALSE
if not.
+ */
+gboolean
+exchange_account_is_offline_sync_set (ExchangeAccount *account)
+{
+ if (!strcmp(account->priv->offline_sync, "1"))
+ return TRUE;
+ else
+ return FALSE;
+}
+
+/**
* exchange_account_get_context:
* @account: an #ExchangeAccount
*
@@ -1785,10 +1800,10 @@ exchange_account_new (EAccountList *acco
account->priv->passwd_exp_warn_period = atoi
(passwd_exp_warn_period);
offline_sync = e2k_uri_get_param (uri, "offline_sync");
- if (!offline_sync || !*offline_sync)
+ if (!offline_sync) account->priv->offline_sync =
g_strdup ("0");
- else
- account->priv->offline_sync = g_strdup (offline_sync);
+ else + account->priv->offline_sync = g_strdup ("1");
owa_path = e2k_uri_get_param (uri, "owa_path");
if (!owa_path || !*owa_path)
@@ -1800,6 +1815,8 @@ exchange_account_new (EAccountList *acco
if (!pf_server || !*pf_server)
pf_server = uri->host;
+ /* Now we can set protocol reading owa_url, instead of having
+ use_ssl parameter */
proto = e2k_uri_get_param (uri, "use_ssl") ? "https" : "http";
owa_url = e2k_uri_get_param (uri, "owa_url");
Index: storage/exchange-config-listener.c
===================================================================
RCS file:
/cvs/gnome/evolution-exchange/storage/exchange-config-listener.c,v
retrieving revision 1.13
diff -u -p -r1.13 exchange-config-listener.c
--- storage/exchange-config-listener.c 11 Feb 2005 10:15:46
-0000 1.13
+++ storage/exchange-config-listener.c 18 Feb 2005 11:36:45 -0000
@@ -232,6 +232,7 @@ add_esource (ExchangeAccount *account, GSList
*ids, *temp_ids;
GConfClient *client;
gboolean is_contacts_folder = TRUE;
+ const char *offline = NULL;
client = gconf_client_get_default ();
@@ -256,6 +257,14 @@ add_esource (ExchangeAccount *account,
physical_uri);
else
source = e_source_new (folder_name, relative_uri);
+
+ if (exchange_account_is_offline_sync_set (account)) {
+ /* If account is marked for offline sync during account
+ * creation, mark all the folders for offline sync
+ */
+ e_source_set_property (source, "offline_sync", "1");
+ }
+
e_source_group_add_source (source_group, source, -1);
g_object_unref (source);
@@ -272,9 +281,19 @@ add_esource (ExchangeAccount *account,
else
source = e_source_new (folder_name, relative_uri);
+ if (exchange_account_is_offline_sync_set (account))
+ e_source_set_property (source, "offline_sync", "1");
+
e_source_group_add_source (source_group, source, -1);
- g_object_unref (source);
+ } else {
+ offline = e_source_get_property (source, "offline_sync");
+ if (!offline) {
+ /* Folder doesn't have any offline property set */
+ if (exchange_account_is_offline_sync_set (account))
+ e_source_set_property (source, "offline_sync",
"1");
+ }
}
+ g_object_unref (source);
}
if (!is_contacts_folder) {
@@ -439,10 +458,14 @@ remove_esource (ExchangeAccount *account
}
else {
/* Folder Deleted - Remove only the source */
+ /*
e_source_group_remove_source_by_uid (
group,
source_uid);
-
+ */
+ e_source_group_remove_source (
+ group,
+ source);
}
if (!is_contacts_folder) {
if (is_account || folder_type ==
EXCHANGE_CALENDAR_FOLDER) {
@@ -695,7 +718,6 @@ account_changed (EAccountList *account_l
}
else if (strcmp (config_listener->priv->configured_name,
account->name))
remove_sources (priv->exchange_account);
-
/* Nope. Let the user know we're ignoring him. */
e_notice (NULL, GTK_MESSAGE_WARNING,
Index: storage/exchange-offline-listener.c
===================================================================
RCS file:
/cvs/gnome/evolution-exchange/storage/exchange-offline-listener.c,v
retrieving revision 1.5
diff -u -p -r1.5 exchange-offline-listener.c
--- storage/exchange-offline-listener.c 20 Jan 2005 09:23:58
-0000 1.5
+++ storage/exchange-offline-listener.c 18 Feb 2005 11:37:20 -0000
@@ -76,7 +76,7 @@ online_status_changed (GConfClient *clie
value = gconf_entry_get_value (entry);
if (value)
offline = gconf_value_get_bool (value);
- if (priv->offline != offline)
+ if (priv && priv->offline != offline)
set_online_status (ex_offline_listener ,offline);
}