evolution r37517 - trunk/mail



Author: pchen
Date: Mon Apr 13 09:03:19 2009
New Revision: 37517
URL: http://svn.gnome.org/viewvc/evolution?rev=37517&view=rev

Log:
Fixes #471083 (bnc)
Do not allow deletion of system folders.

Modified:
   trunk/mail/ChangeLog
   trunk/mail/em-folder-utils.c
   trunk/mail/mail-folder-cache.c
   trunk/mail/mail-folder-cache.h

Modified: trunk/mail/em-folder-utils.c
==============================================================================
--- trunk/mail/em-folder-utils.c	(original)
+++ trunk/mail/em-folder-utils.c	Mon Apr 13 09:03:19 2009
@@ -61,6 +61,7 @@
 #include "mail-config.h"
 #include "mail-component.h"
 #include "mail-vfolder.h"
+#include "mail-folder-cache.h"
 
 #include "em-utils.h"
 #include "em-popup.h"
@@ -401,6 +402,8 @@
 {
 	CamelStore *local;
 	GtkWidget *dialog;
+	char *uri;
+	int flags = 0;
 
 	local = mail_component_peek_local_store (NULL);
 
@@ -409,7 +412,14 @@
 		em_utils_show_error_silent (dialog);
 		return;
 	}
+	
+	if (mail_folder_cache_get_folder_info_flags (folder, &flags) && (flags & CAMEL_FOLDER_SYSTEM)) 
+	{
+		e_error_run(NULL,"mail:no-delete-special-folder", folder->name, NULL);
+		return;
+	}
 
+	g_free (uri);
 	camel_object_ref (folder);
 
 	dialog = e_error_new(NULL,

Modified: trunk/mail/mail-folder-cache.c
==============================================================================
--- trunk/mail/mail-folder-cache.c	(original)
+++ trunk/mail/mail-folder-cache.c	Mon Apr 13 09:03:19 2009
@@ -56,6 +56,7 @@
 #include "mail-ops.h"
 #include "mail-session.h"
 #include "mail-component.h"
+#include "mail-tools.h"
 
 /* For notifications of changes */
 #include "mail-vfolder.h"
@@ -1043,3 +1044,32 @@
 
 	return fi.fi != NULL;
 }
+
+gboolean 
+mail_folder_cache_get_folder_info_flags (CamelFolder *folder, int *flags)
+{
+	char *uri;
+
+	uri = mail_tools_folder_to_url (folder);
+	
+	struct _find_info fi = { uri, NULL, NULL };
+
+	if (stores == NULL)
+		return FALSE;
+
+	fi.url = camel_url_new(uri, NULL);
+
+	LOCK(info_lock);
+	g_hash_table_foreach(stores, (GHFunc)storeinfo_find_folder_info, &fi);
+	if (flags) {
+		if (fi.fi) {
+			*flags = fi.fi->flags;
+		} 
+	}
+	UNLOCK(info_lock);
+
+	camel_url_free(fi.url);
+	g_free (uri);
+
+	return fi.fi != NULL;
+}

Modified: trunk/mail/mail-folder-cache.h
==============================================================================
--- trunk/mail/mail-folder-cache.h	(original)
+++ trunk/mail/mail-folder-cache.h	Mon Apr 13 09:03:19 2009
@@ -49,5 +49,6 @@
 /* Returns true if a folder is available (yet), and also sets *folderp (if supplied)
    to a (referenced) copy of the folder if it has already been opened */
 int mail_note_get_folder_from_uri (const char *uri, CamelFolder **folderp);
+gboolean mail_folder_cache_get_folder_info_flags (CamelFolder *folder, int *flags);
 
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]