[evolution-exchange] Bug #600397 - Delete option enabled for undeletable ESource
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-exchange] Bug #600397 - Delete option enabled for undeletable ESource
- Date: Tue, 15 Dec 2009 15:14:18 +0000 (UTC)
commit 0e25ed3966c26b249c946a91871f779d2bf8c6b4
Author: Milan Crha <mcrha redhat com>
Date: Tue Dec 15 16:13:43 2009 +0100
Bug #600397 - Delete option enabled for undeletable ESource
server/storage/exchange-esource.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/server/storage/exchange-esource.c b/server/storage/exchange-esource.c
index 167b293..ccf6fc9 100644
--- a/server/storage/exchange-esource.c
+++ b/server/storage/exchange-esource.c
@@ -84,6 +84,7 @@ add_folder_esource (ExchangeAccount *account,
gint mode;
ESourceList *source_list = NULL;
gboolean offline_flag, update_selection = TRUE, foriegn_folder;
+ gboolean can_delete = TRUE;
client = gconf_client_get_default ();
@@ -99,19 +100,25 @@ add_folder_esource (ExchangeAccount *account,
/* Modify the URI handling of Contacts to the same way as calendar and tasks */
if (!g_str_has_prefix (physical_uri, "gal://")) {
relative_uri = g_strdup (physical_uri + strlen (EXCHANGE_URI_PREFIX));
+ can_delete = !relative_uri || !strstr (relative_uri, ";personal/Contacts");
+ } else {
+ can_delete = FALSE;
}
+
}
else if (folder_type == EXCHANGE_CALENDAR_FOLDER) {
source_list = e_source_list_new_for_gconf ( client,
CONF_KEY_CAL);
relative_uri = g_strdup (physical_uri + strlen (EXCHANGE_URI_PREFIX));
is_contacts_folder = FALSE;
+ can_delete = !relative_uri || !strstr (relative_uri, ";personal/Calendar");
}
else if (folder_type == EXCHANGE_TASKS_FOLDER) {
source_list = e_source_list_new_for_gconf ( client,
CONF_KEY_TASKS);
relative_uri = g_strdup (physical_uri + strlen (EXCHANGE_URI_PREFIX));
is_contacts_folder = FALSE;
+ can_delete = !relative_uri || !strstr (relative_uri, ";personal/Tasks");
}
exchange_account_is_offline_sync_set (account, &mode);
@@ -157,6 +164,10 @@ add_folder_esource (ExchangeAccount *account,
source = e_source_new (folder_name, relative_uri);
}
+ if (!can_delete) {
+ e_source_set_property (source, "delete", "no");
+ }
+
if (mode == OFFLINE_MODE) {
/* If account is marked for offline sync during account
* creation, mark all the folders for offline sync
@@ -202,6 +213,10 @@ add_folder_esource (ExchangeAccount *account,
source = e_source_new (folder_name, relative_uri);
}
+ if (!can_delete) {
+ e_source_set_property (source, "delete", "no");
+ }
+
if (mode == OFFLINE_MODE)
e_source_set_property (source, "offline_sync", "1");
@@ -224,6 +239,8 @@ add_folder_esource (ExchangeAccount *account,
source_new = TRUE;
e_source_list_sync (source_list, NULL);
} else {
+ const gchar *old_delete = e_source_get_property (source, "delete");
+
update_selection = FALSE;
/* source group and source both already exist */
offline = e_source_get_property (source, "offline_sync");
@@ -252,6 +269,10 @@ add_folder_esource (ExchangeAccount *account,
g_free (expand_groups);
g_free (browse);
}
+
+ if ((!old_delete && !can_delete) || (old_delete && ((g_str_equal (old_delete, "no") && can_delete) || (!g_str_equal (old_delete, "no") && !can_delete)))) {
+ e_source_set_property (source, "delete", can_delete ? NULL : "no");
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]