aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSushma Rai <rsushma@src.gnome.org>2006-04-10 11:54:09 +0800
committerSushma Rai <rsushma@src.gnome.org>2006-04-10 11:54:09 +0800
commita7373b94386efc63050f6194e72a80e622b3938c (patch)
tree2189060c5a5a40ba2725687f4a359570097cfb6b
parent09c279136cbb72cf162c439b114942860b21a60a (diff)
downloadgsoc2013-evolution-a7373b94386efc63050f6194e72a80e622b3938c.tar
gsoc2013-evolution-a7373b94386efc63050f6194e72a80e622b3938c.tar.gz
gsoc2013-evolution-a7373b94386efc63050f6194e72a80e622b3938c.tar.bz2
gsoc2013-evolution-a7373b94386efc63050f6194e72a80e622b3938c.tar.lz
gsoc2013-evolution-a7373b94386efc63050f6194e72a80e622b3938c.tar.xz
gsoc2013-evolution-a7373b94386efc63050f6194e72a80e622b3938c.tar.zst
gsoc2013-evolution-a7373b94386efc63050f6194e72a80e622b3938c.zip
Handling rename opearion for public and subscribed folders.
Fixes #328813 and #315522. svn path=/trunk/; revision=31792
-rw-r--r--plugins/exchange-operations/ChangeLog15
-rw-r--r--plugins/exchange-operations/exchange-calendar.c28
-rw-r--r--plugins/exchange-operations/exchange-contacts.c35
-rw-r--r--plugins/exchange-operations/exchange-operations.c19
-rw-r--r--plugins/exchange-operations/exchange-operations.h2
5 files changed, 81 insertions, 18 deletions
diff --git a/plugins/exchange-operations/ChangeLog b/plugins/exchange-operations/ChangeLog
index b67f343aa8..d47f0ab09a 100644
--- a/plugins/exchange-operations/ChangeLog
+++ b/plugins/exchange-operations/ChangeLog
@@ -1,3 +1,18 @@
+2006-04-10 Sushma Rai <rsushma@novell.com>
+
+ * exchange-operations.[ch] (is_exchange_personal_folder): Added new to
+ check if a folder is a personal folder or not.
+
+ * exchange-contacts.c (e_exchange_contacts_pcontacts): Printing the
+ folder size only for the personal folders, in properties window.
+ (e_exchange_contacts_check): Returning FALSE in case of rename of
+ non-personal folders.
+ (e_exchange_contacts_commit): Renaming only the personal folders.
+
+ * exchange-calendar.c (e_exchange_calendar_pcalendar)
+ (e_exchange_calendar_check)(e_exchange_calendar_commit): Similar.
+ Fixes #328813 and #315522.
+
2006-04-06 Sushma Rai <rsushma@novell.com>
* exchange-operations.c (exchange_operations_update_child_esources):
diff --git a/plugins/exchange-operations/exchange-calendar.c b/plugins/exchange-operations/exchange-calendar.c
index a1ae07018b..15d4b1de28 100644
--- a/plugins/exchange-operations/exchange-calendar.c
+++ b/plugins/exchange-operations/exchange-calendar.c
@@ -156,6 +156,7 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data)
gint offline_status;
char *offline_msg;
GtkWidget *lbl_offline_msg;
+ gboolean is_personal;
if (!hidden)
hidden = gtk_label_new ("");
@@ -177,7 +178,6 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data)
}
e_uri_free (uri);
- g_free (uri_text);
parent = data->parent;
row = ((GtkTable*)parent)->nrows;
@@ -194,6 +194,7 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data)
g_free (offline_msg);
gtk_widget_show (lbl_offline_msg);
gtk_table_attach (GTK_TABLE (parent), lbl_offline_msg, 0, 2, row, row+1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
+ g_free (uri_text);
return lbl_offline_msg;
}
@@ -211,11 +212,14 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data)
account = exchange_operations_get_exchange_account ();
if (!account) {
g_free (calendar_old_source_uri);
+ g_free (uri_text);
return NULL;
}
account_name = account->account_name;
+ is_personal = is_exchange_personal_folder (account, uri_text);
+ g_free (uri_text);
- if (calendar_src_exists) {
+ if (calendar_src_exists && is_personal) {
cal_name = (gchar*) e_source_peek_name (source);
model = exchange_account_folder_size_get_model (account);
if (model)
@@ -326,12 +330,16 @@ e_exchange_calendar_check (EPlugin *epl, EConfigHookPageCheckData *data)
EUri *euri;
int uri_len;
gchar *uri_text, *uri_string, *path, *folder_name;
+ gboolean is_personal;
account = exchange_operations_get_exchange_account ();
uri_text = e_source_get_uri (t->source);
euri = e_uri_new (uri_text);
uri_string = e_uri_to_string (euri, FALSE);
e_uri_free (euri);
+
+ is_personal = is_exchange_personal_folder (account, uri_text);
+
uri_len = strlen (uri_string) + 1;
g_free (uri_string);
path = g_build_filename ("/", uri_text + uri_len, NULL);
@@ -339,11 +347,14 @@ e_exchange_calendar_check (EPlugin *epl, EConfigHookPageCheckData *data)
folder_name = g_strdup (g_strrstr (path, "/") +1);
g_free (path);
- if (strcmp (folder_name, e_source_peek_name (t->source)) &&
- exchange_account_get_standard_uri (account, folder_name)) {
- /* rename of standard folder */
- g_free (folder_name);
- return FALSE;
+ if (strcmp (folder_name, e_source_peek_name (t->source))) {
+ /* rename */
+ if (exchange_account_get_standard_uri (account, folder_name) ||
+ !is_personal) {
+ /* rename of standard/non-personal folder */
+ g_free (folder_name);
+ return FALSE;
+ }
}
g_free (folder_name);
@@ -376,6 +387,9 @@ e_exchange_calendar_commit (EPlugin *epl, EConfigTarget *target)
}
account = exchange_operations_get_exchange_account ();
+ if (!is_exchange_personal_folder (account, uri_text))
+ return;
+
username = exchange_account_get_username (account);
authtype = exchange_account_get_authtype (account);
diff --git a/plugins/exchange-operations/exchange-contacts.c b/plugins/exchange-operations/exchange-contacts.c
index 96ab3793e2..936b64deaf 100644
--- a/plugins/exchange-operations/exchange-contacts.c
+++ b/plugins/exchange-operations/exchange-contacts.c
@@ -139,13 +139,13 @@ e_exchange_contacts_pcontacts (EPlugin *epl, EConfigHookItemFactoryData *data)
GtkWidget *lbl_offline_msg, *vb_offline_msg;
char *offline_msg;
gint offline_status;
- gboolean gal_folder = FALSE;
+ gboolean gal_folder = FALSE, is_personal;
if (data->old) {
gtk_widget_destroy (vb_pcontacts);
}
- uri_text = e_source_get_uri (source);
+ uri_text = e_source_get_uri (source);
if (uri_text && g_ascii_strncasecmp (uri_text, "exchange", 8)) {
if (g_ascii_strncasecmp (uri_text, "gal", 3)) {
g_free (uri_text);
@@ -156,8 +156,6 @@ e_exchange_contacts_pcontacts (EPlugin *epl, EConfigHookItemFactoryData *data)
}
}
- g_free (uri_text);
-
exchange_config_listener_get_offline_status (exchange_global_config_listener,
&offline_status);
if (offline_status == OFFLINE_MODE) {
@@ -172,11 +170,13 @@ e_exchange_contacts_pcontacts (EPlugin *epl, EConfigHookItemFactoryData *data)
g_free (offline_msg);
gtk_box_pack_start (GTK_BOX (vb_offline_msg), lbl_offline_msg, FALSE, FALSE, 0);
gtk_widget_show_all (vb_offline_msg);
+ g_free (uri_text);
return vb_offline_msg;
}
if (gal_folder) {
contacts_src_exists = TRUE;
+ g_free (uri_text);
return NULL;
}
@@ -196,12 +196,16 @@ e_exchange_contacts_pcontacts (EPlugin *epl, EConfigHookItemFactoryData *data)
account = exchange_operations_get_exchange_account ();
if (!account) {
g_free (contacts_old_src_uri);
+ g_free (uri_text);
return NULL;
}
account_name = account->account_name;
hbx_size = NULL;
- if (contacts_src_exists) {
+ is_personal = is_exchange_personal_folder (account, uri_text);
+ g_free (uri_text);
+
+ if (contacts_src_exists && is_personal ) {
abook_name = (char*)e_source_peek_name (source);
model = exchange_account_folder_size_get_model (account);
if (model)
@@ -365,11 +369,15 @@ e_exchange_contacts_check (EPlugin *epl, EConfigHookPageCheckData *data)
EUri *euri;
int uri_len;
gchar *uri_text, *uri_string, *path, *folder_name;
+ gboolean is_personal;
uri_text = e_source_get_uri (t->source);
euri = e_uri_new (uri_text);
uri_string = e_uri_to_string (euri, FALSE);
e_uri_free (euri);
+
+ is_personal = is_exchange_personal_folder (account, uri_text);
+
uri_len = strlen (uri_string) + 1;
g_free (uri_string);
path = g_build_filename ("/", uri_text + uri_len, NULL);
@@ -377,15 +385,17 @@ e_exchange_contacts_check (EPlugin *epl, EConfigHookPageCheckData *data)
folder_name = g_strdup (g_strrstr (path, "/") +1);
g_free (path);
- if (strcmp (folder_name, e_source_peek_name (t->source)) &&
- exchange_account_get_standard_uri (account, folder_name)) {
- /* rename of standard folder */
+ if (strcmp (folder_name, e_source_peek_name (t->source))) {
+ /* rename */
+ if (exchange_account_get_standard_uri (account, folder_name) ||
+ !is_personal) {
+ /* rename of standard/non-personal folder */
+ g_free (folder_name);
+ return FALSE;
+ }
g_free (folder_name);
- return FALSE;
}
- g_free (folder_name);
}
-
return TRUE;
}
@@ -416,6 +426,9 @@ e_exchange_contacts_commit (EPlugin *epl, EConfigTarget *target)
}
account = exchange_operations_get_exchange_account ();
+ if (!is_exchange_personal_folder (account, uri_text))
+ return;
+
username = exchange_account_get_username (account);
authtype = exchange_account_get_authtype (account);
diff --git a/plugins/exchange-operations/exchange-operations.c b/plugins/exchange-operations/exchange-operations.c
index 86d1830388..57340d4ccc 100644
--- a/plugins/exchange-operations/exchange-operations.c
+++ b/plugins/exchange-operations/exchange-operations.c
@@ -23,6 +23,8 @@
#include <glib/gi18n.h>
#include "exchange-operations.h"
+#include <e-folder-exchange.h>
+#include <exchange-hierarchy.h>
#include <e-util/e-error.h>
ExchangeConfigListener *exchange_global_config_listener=NULL;
@@ -281,3 +283,20 @@ void exchange_operations_update_child_esources (ESource *source, const gchar *ol
}
}
}
+
+gboolean
+is_exchange_personal_folder (ExchangeAccount *account, char *uri)
+{
+ ExchangeHierarchy *hier;
+ EFolder *folder;
+
+ folder = exchange_account_get_folder (account, uri);
+ if (folder) {
+ hier = e_folder_exchange_get_hierarchy (folder);
+ if (hier->type != EXCHANGE_HIERARCHY_PERSONAL)
+ return FALSE;
+ else
+ return TRUE;
+ }
+ return FALSE;
+}
diff --git a/plugins/exchange-operations/exchange-operations.h b/plugins/exchange-operations/exchange-operations.h
index 35cdfca444..0fe30aa76c 100644
--- a/plugins/exchange-operations/exchange-operations.h
+++ b/plugins/exchange-operations/exchange-operations.h
@@ -51,6 +51,8 @@ void exchange_operations_report_error (ExchangeAccount *account, ExchangeAccount
void exchange_operations_update_child_esources (ESource *source, const gchar *old_path, const gchar *new_path);
+gboolean is_exchange_personal_folder (ExchangeAccount *account, char *uri);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */