aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/em-folder-utils.c10
-rw-r--r--mail/mail-folder-cache.c30
-rw-r--r--mail/mail-folder-cache.h1
4 files changed, 49 insertions, 0 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 4c81c8e768..62310e394e 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,11 @@
+2009-04-13 Chenthill Palanisamy <pchenthill@novell.com>
+
+ Fixes #471083 (bnc)
+ * mail/em-folder-utils.c:
+ * mail/mail-folder-cache.c:
+ * mail/mail-folder-cache.h: Do not allow deleting
+ system folders.
+
2008-04-04 Tobias Mueller <tobiasmue@gnome.org>
** Fix for bug #569765
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index f3a839f926..56111abe6c 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -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 @@ em_folder_utils_delete_folder (CamelFolder *folder)
{
CamelStore *local;
GtkWidget *dialog;
+ char *uri;
+ int flags = 0;
local = mail_component_peek_local_store (NULL);
@@ -409,7 +412,14 @@ em_folder_utils_delete_folder (CamelFolder *folder)
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,
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index cd63967090..165f5941c2 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -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 @@ int mail_note_get_folder_from_uri(const char *uri, CamelFolder **folderp)
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;
+}
diff --git a/mail/mail-folder-cache.h b/mail/mail-folder-cache.h
index f62d94169b..c0f7e866cf 100644
--- a/mail/mail-folder-cache.h
+++ b/mail/mail-folder-cache.h
@@ -49,5 +49,6 @@ void mail_note_folder (CamelFolder *folder);
/* 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