diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-09-13 05:33:07 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-09-13 05:46:43 +0800 |
commit | cbf5c62ee8d0bf9d1529f65a1baa25c9a8ff46af (patch) | |
tree | 6ff582bc77fab2594a5394afd247e1ef92d24e64 /mail/em-folder-utils.c | |
parent | abb6b433052b9c32762dbfb8233aaff7799f736a (diff) | |
download | gsoc2013-evolution-cbf5c62ee8d0bf9d1529f65a1baa25c9a8ff46af.tar.gz gsoc2013-evolution-cbf5c62ee8d0bf9d1529f65a1baa25c9a8ff46af.tar.zst gsoc2013-evolution-cbf5c62ee8d0bf9d1529f65a1baa25c9a8ff46af.zip |
Bug 217066 - Rename folders directly inside folder list
Diffstat (limited to 'mail/em-folder-utils.c')
-rw-r--r-- | mail/em-folder-utils.c | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index 3a4636a87b..ac808adb23 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -47,7 +47,6 @@ #include <camel/camel-stream-fs.h> #include "e-util/e-mktemp.h" -#include "e-util/e-request.h" #include "e-util/e-error.h" @@ -483,87 +482,6 @@ em_folder_utils_delete_folder (CamelFolder *folder) gtk_widget_show (dialog); } -/* FIXME: this must become threaded */ -/* FIXME: these functions must be documented */ -void -em_folder_utils_rename_folder (CamelFolder *folder) -{ - gchar *prompt, *new_name; - const gchar *p; - CamelStore *local_store; - gboolean done = FALSE; - gsize base_len; - - local_store = e_mail_local_get_store (); - - /* don't allow user to rename one of the special local folders */ - if (folder->parent_store == local_store && emfu_is_special_local_folder (folder->full_name)) { - e_error_run(NULL, - "mail:no-rename-special-folder", folder->full_name, NULL); - return; - } - - if ((p = strrchr (folder->full_name, '/'))) - base_len = (gsize) (p - folder->full_name); - else - base_len = 0; - - prompt = g_strdup_printf (_("Rename the \"%s\" folder to:"), folder->name); - while (!done) { - new_name = e_request_string (NULL, _("Rename Folder"), prompt, folder->name); - if (new_name == NULL || !strcmp (folder->name, new_name)) { - /* old name == new name */ - done = TRUE; - } else if (strchr(new_name, '/') != NULL) { - e_error_run(NULL, - "mail:no-rename-folder", folder->name, new_name, _("Folder names cannot contain '/'"), NULL); - done = TRUE; - } else { - CamelFolderInfo *fi; - CamelException ex; - gchar *path, *tmp; - - if (base_len > 0) { - path = g_malloc (base_len + strlen (new_name) + 2); - memcpy (path, folder->full_name, base_len); - tmp = path + base_len; - *tmp++ = '/'; - strcpy (tmp, new_name); - } else { - path = g_strdup (new_name); - } - - camel_exception_init (&ex); - if ((fi = camel_store_get_folder_info (folder->parent_store, path, CAMEL_STORE_FOLDER_INFO_FAST, &ex)) != NULL) { - camel_store_free_folder_info (folder->parent_store, fi); - e_error_run(NULL, - "mail:no-rename-folder-exists", folder->name, new_name, NULL); - } else { - const gchar *oldpath, *newpath; - - oldpath = folder->full_name; - newpath = path; - - d(printf ("renaming %s to %s\n", oldpath, newpath)); - - camel_exception_clear (&ex); - camel_store_rename_folder (folder->parent_store, oldpath, newpath, &ex); - if (camel_exception_is_set (&ex)) { - e_error_run(NULL, - "mail:no-rename-folder", oldpath, newpath, ex.desc, NULL); - camel_exception_clear (&ex); - } - - done = TRUE; - } - - g_free (path); - } - - g_free (new_name); - } -} - struct _EMCreateFolder { MailMsg base; |