Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/ChangeLog,v
retrieving revision 1.107
diff -u -p -r1.107 ChangeLog
--- ChangeLog	6 Apr 2006 16:36:22 -0000	1.107
+++ ChangeLog	8 Apr 2006 07:04:45 -0000
@@ -1,3 +1,18 @@
+2006-04-07  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):
Index: exchange-operations.h
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-operations.h,v
retrieving revision 1.6
diff -u -p -r1.6 exchange-operations.h
--- exchange-operations.h	3 Aug 2005 09:58:28 -0000	1.6
+++ exchange-operations.h	8 Apr 2006 07:05:23 -0000
@@ -51,6 +51,8 @@ void exchange_operations_report_error (E
 
 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 */
Index: exchange-operations.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-operations.c,v
retrieving revision 1.16
diff -u -p -r1.16 exchange-operations.c
--- exchange-operations.c	6 Apr 2006 16:36:22 -0000	1.16
+++ exchange-operations.c	8 Apr 2006 07:06:22 -0000
@@ -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;
@@ -280,4 +282,21 @@ void exchange_operations_update_child_es
 			g_free (truri);	
 		}
 	}
+}
+
+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;
 }
Index: exchange-contacts.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-contacts.c,v
retrieving revision 1.20
diff -u -p -r1.20 exchange-contacts.c
--- exchange-contacts.c	6 Apr 2006 16:36:22 -0000	1.20
+++ exchange-contacts.c	8 Apr 2006 07:07:29 -0000
@@ -139,13 +139,13 @@ e_exchange_contacts_pcontacts (EPlugin *
 	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 *
 		}
 	}
 
-	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 *
 		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 *
 	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,
 		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,
 		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
 	}
 
 	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);
 
Index: exchange-calendar.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-calendar.c,v
retrieving revision 1.19
diff -u -p -r1.19 exchange-calendar.c
--- exchange-calendar.c	6 Apr 2006 16:36:22 -0000	1.19
+++ exchange-calendar.c	8 Apr 2006 07:09:26 -0000
@@ -156,6 +156,7 @@ e_exchange_calendar_pcalendar (EPlugin *
 	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 *
 	}
 
 	e_uri_free (uri);
-	g_free (uri_text);
 
 	parent = data->parent;
 	row = ((GtkTable*)parent)->nrows;
@@ -194,6 +194,7 @@ e_exchange_calendar_pcalendar (EPlugin *
 		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 *
 	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,
 	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,
 	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
 	}
 
 	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);
 
