aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2005-08-10 10:04:31 +0800
committerMichael Zucci <zucchi@src.gnome.org>2005-08-10 10:04:31 +0800
commite14a0019e799ea6c91ca6320ab0ca6c3c89dc7b6 (patch)
tree11de1e177b25c26eed619ef60b187fc1835aba66 /mail
parent7bbb6938b70d7eef0de8e17de3541e447682d9c9 (diff)
downloadgsoc2013-evolution-e14a0019e799ea6c91ca6320ab0ca6c3c89dc7b6.tar
gsoc2013-evolution-e14a0019e799ea6c91ca6320ab0ca6c3c89dc7b6.tar.gz
gsoc2013-evolution-e14a0019e799ea6c91ca6320ab0ca6c3c89dc7b6.tar.bz2
gsoc2013-evolution-e14a0019e799ea6c91ca6320ab0ca6c3c89dc7b6.tar.lz
gsoc2013-evolution-e14a0019e799ea6c91ca6320ab0ca6c3c89dc7b6.tar.xz
gsoc2013-evolution-e14a0019e799ea6c91ca6320ab0ca6c3c89dc7b6.tar.zst
gsoc2013-evolution-e14a0019e799ea6c91ca6320ab0ca6c3c89dc7b6.zip
** See #312715.
2005-08-09 Not Zed <NotZed@Ximian.com> ** See #312715. * em-folder-tree.c (emft_drop_folder_rec): removed. (emft_drop_folder): call em_folder_utils_copy_folders to perform the operation rather than: doing it sync when it shouldn't be, and 2; copying code redundantly. * em-folder-utils.c (em_folder_utils_move_folder): remove this redundant api. (em_folder_utils_copy_folder): add delete flag. (em_folder_utils_copy_folders): export this function. fix strange argument order. svn path=/trunk/; revision=30066
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog15
-rw-r--r--mail/em-folder-browser.c4
-rw-r--r--mail/em-folder-tree.c89
-rw-r--r--mail/em-folder-utils.c36
-rw-r--r--mail/em-folder-utils.h5
-rw-r--r--mail/mail-ops.c8
6 files changed, 44 insertions, 113 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index f26a7ac6a1..33439d45b7 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,18 @@
+2005-08-09 Not Zed <NotZed@Ximian.com>
+
+ ** See #312715.
+
+ * em-folder-tree.c (emft_drop_folder_rec): removed.
+ (emft_drop_folder): call em_folder_utils_copy_folders to perform
+ the operation rather than: doing it sync when it shouldn't be, and
+ 2; copying code redundantly.
+
+ * em-folder-utils.c (em_folder_utils_move_folder): remove this
+ redundant api.
+ (em_folder_utils_copy_folder): add delete flag.
+ (em_folder_utils_copy_folders): export this function. fix strange
+ argument order.
+
2005-08-10 Tor Lillqvist <tml@novell.com>
* Makefile.am: Link with all needed libraries. Use -no-undefined
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index 6d3937126d..1f89a2c569 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -585,7 +585,7 @@ emfb_folder_copy(BonoboUIComponent *uid, void *data, const char *path)
emfb->view.folder->full_name,
CAMEL_STORE_FOLDER_INFO_FAST,
&ex)) != NULL)
- em_folder_utils_copy_folder (fi);
+ em_folder_utils_copy_folder(fi, FALSE);
camel_exception_clear (&ex);
@@ -608,7 +608,7 @@ emfb_folder_move(BonoboUIComponent *uid, void *data, const char *path)
emfb->view.folder->full_name,
CAMEL_STORE_FOLDER_INFO_FAST,
&ex)) != NULL)
- em_folder_utils_move_folder (fi);
+ em_folder_utils_copy_folder(fi, TRUE);
camel_exception_clear (&ex);
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 5546bf7748..c3da19e64f 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -822,89 +822,16 @@ struct _DragDataReceivedAsync {
};
static void
-emft_drop_folder_rec (CamelStore *store, CamelFolderInfo *fi, const char *parent_name, CamelException *ex)
-{
- CamelFolder *src, *dest;
- CamelFolderInfo *nfi;
- char *new_name;
-
- while (fi != NULL) {
- if (!(src = mail_tool_uri_to_folder (fi->uri, 0, ex)))
- break;
-
- /* handles dropping to the root properly */
- if (parent_name && parent_name[0])
- new_name = g_strdup_printf ("%s/%s", parent_name, src->name);
- else
- new_name = g_strdup (src->name);
-
- if ((nfi = camel_store_create_folder (store, parent_name, src->name, ex))) {
- camel_store_free_folder_info (store, nfi);
-
- if (camel_store_supports_subscriptions (store))
- camel_store_subscribe_folder (store, new_name, ex);
-
- /* copy the folder to the new location */
- if ((dest = camel_store_get_folder (store, new_name, 0, ex))) {
- GPtrArray *uids;
-
- uids = camel_folder_get_uids (src);
- camel_folder_transfer_messages_to (src, uids, dest, NULL, FALSE, ex);
- camel_folder_free_uids (src, uids);
-
- camel_object_unref (dest);
- }
- }
-
- camel_object_unref (src);
-
- if (fi->child)
- emft_drop_folder_rec (store, fi->child, new_name, ex);
-
- g_free (new_name);
- fi = fi->next;
- }
-}
-
-static void
emft_drop_folder(struct _DragDataReceivedAsync *m)
{
CamelFolder *src;
- char *new_name;
d(printf(" * Drop folder '%s' onto '%s'\n", m->selection->data, m->full_name));
if (!(src = mail_tool_uri_to_folder(m->selection->data, 0, &m->msg.ex)))
return;
-
- /* handles dropping to the root properly */
- if (m->full_name)
- new_name = g_strdup_printf("%s/%s", m->full_name, src->name);
- else
- new_name = g_strdup(src->name);
-
- if (src->parent_store == m->store && m->move) {
- /* simple case, rename */
- camel_store_rename_folder(m->store, src->full_name, new_name, &m->msg.ex);
- m->moved = !camel_exception_is_set (&m->msg.ex);
- } else {
- CamelFolderInfo *fi, *nfi;
-
- /* FIXME: should check we're not coming from a vfolder, otherwise bad stuff could happen */
-
- if ((fi = camel_store_get_folder_info (src->parent_store, src->full_name, CAMEL_STORE_FOLDER_INFO_FAST |
- CAMEL_STORE_FOLDER_INFO_RECURSIVE, &m->msg.ex))) {
- if (!(nfi = camel_store_get_folder_info (m->store, new_name, CAMEL_STORE_FOLDER_INFO_FAST, &m->msg.ex))) {
- /* Good. The folder doesn't already exist... */
- camel_exception_clear (&m->msg.ex);
- emft_drop_folder_rec (m->store, fi, m->full_name, &m->msg.ex);
- }
-
- camel_store_free_folder_info (src->parent_store, fi);
- }
- }
-
- g_free(new_name);
+
+ em_folder_utils_copy_folders(src->parent_store, src->full_name, m->store, m->full_name?m->full_name:"", m->move);
camel_object_unref(src);
}
@@ -2005,9 +1932,9 @@ emft_popup_copy(EPopup *ep, EPopupItem *item, void *data)
EMFolderTree *emft = data;
CamelFolderInfo *fi = NULL;
- if ((fi = em_folder_tree_get_selected_folder_info (emft)) != NULL) {
- em_folder_utils_copy_folder (fi);
- }
+ /* FIXME: use async apis */
+ if ((fi = em_folder_tree_get_selected_folder_info (emft)) != NULL)
+ em_folder_utils_copy_folder(fi, FALSE);
}
static void
@@ -2016,9 +1943,9 @@ emft_popup_move(EPopup *ep, EPopupItem *item, void *data)
EMFolderTree *emft = data;
CamelFolderInfo *fi = NULL;
- if ((fi = em_folder_tree_get_selected_folder_info (emft)) != NULL) {
- em_folder_utils_move_folder(fi);
- }
+ /* FIXME: use async apis */
+ if ((fi = em_folder_tree_get_selected_folder_info (emft)) != NULL)
+ em_folder_utils_copy_folder(fi, TRUE);
}
static void
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index ca8299361c..6578423880 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -244,11 +244,12 @@ static struct _mail_msg_op copy_folders_op = {
emft_copy_folders__free,
};
-static void
-emfu_copy_folders (CamelStore *tostore, const char *tobase, CamelStore *fromstore, const char *frombase, int delete)
+int
+em_folder_utils_copy_folders(CamelStore *fromstore, const char *frombase, CamelStore *tostore, const char *tobase, int delete)
{
struct _EMCopyFolders *m;
-
+ int seq;
+
m = mail_msg_new (&copy_folders_op, NULL, sizeof (struct _EMCopyFolders));
camel_object_ref (fromstore);
m->fromstore = fromstore;
@@ -257,8 +258,11 @@ emfu_copy_folders (CamelStore *tostore, const char *tobase, CamelStore *fromstor
m->frombase = g_strdup (frombase);
m->tobase = g_strdup (tobase);
m->delete = delete;
-
+ seq = m->msg.seq;
+
e_thread_put (mail_thread_new, (EMsg *) m);
+
+ return seq;
}
struct _copy_folder_data {
@@ -308,7 +312,7 @@ emfu_copy_folder_selected (const char *uri, void *data)
if (tobase == NULL)
tobase = "";
- emfu_copy_folders (tostore, tobase, fromstore, cfd->fi->full_name, cfd->delete);
+ em_folder_utils_copy_folders(fromstore, cfd->fi->full_name, tostore, tobase, cfd->delete);
camel_url_free (url);
fail:
@@ -353,31 +357,15 @@ emfu_copy_folder_exclude(EMFolderTree *tree, GtkTreeModel *model, GtkTreeIter *i
/* FIXME: this interface references the folderinfo without copying it */
/* FIXME: these functions must be documented */
void
-em_folder_utils_copy_folder (CamelFolderInfo *folderinfo)
+em_folder_utils_copy_folder(CamelFolderInfo *folderinfo, int delete)
{
struct _copy_folder_data *cfd;
cfd = g_malloc (sizeof (*cfd));
cfd->fi = folderinfo;
- cfd->delete = FALSE;
-
- em_select_folder (NULL, _("Select folder"), _("C_opy"),
- NULL, emfu_copy_folder_exclude,
- emfu_copy_folder_selected, cfd);}
-
-
-/* FIXME: this interface references the folderinfo without copying it */
-/* FIXME: these functions must be documented */
-void
-em_folder_utils_move_folder (CamelFolderInfo *folderinfo)
-{
- struct _copy_folder_data *cfd;
-
- cfd = g_malloc (sizeof (*cfd));
- cfd->fi = folderinfo;
- cfd->delete = TRUE;
+ cfd->delete = delete;
- em_select_folder (NULL, _("Select folder"), _("_Move"),
+ em_select_folder (NULL, _("Select folder"), delete?_("_Move"):_("C_opy"),
NULL, emfu_copy_folder_exclude,
emfu_copy_folder_selected, cfd);
}
diff --git a/mail/em-folder-utils.h b/mail/em-folder-utils.h
index c8b8438777..c063e04759 100644
--- a/mail/em-folder-utils.h
+++ b/mail/em-folder-utils.h
@@ -24,10 +24,11 @@
#ifndef _EM_FOLDER_UTILS_H
#define _EM_FOLDER_UTILS_H
+int em_folder_utils_copy_folders(CamelStore *fromstore, const char *frombase, CamelStore *tostore, const char *tobase, int delete);
+
/* FIXME: These api's are really busted, there is no consistency and most rely on the wrong data */
-void em_folder_utils_copy_folder (struct _CamelFolderInfo *folderinfo);
-void em_folder_utils_move_folder (struct _CamelFolderInfo *folderinfo);
+void em_folder_utils_copy_folder (struct _CamelFolderInfo *folderinfo, int delete);
void em_folder_utils_delete_folder (struct _CamelFolder *folder);
void em_folder_utils_rename_folder (struct _CamelFolder *folder);
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 57347b3f69..030fe8afc2 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -490,7 +490,7 @@ mail_send_message(CamelFolder *queue, const char *uid, const char *destination,
tmp = camel_header_raw_find(&xev, "X-Evolution-Transport", NULL);
if (tmp)
transport_url = g_strstrip(g_strdup(tmp));
-
+
tmp = camel_header_raw_find(&xev, "X-Evolution-Fcc", NULL);
if (tmp)
sent_folder_uri = g_strstrip(g_strdup(tmp));
@@ -698,7 +698,7 @@ send_queue_send(struct _mail_msg *mm)
if (!(uids = camel_folder_get_uids (m->queue)))
return;
-
+
send_uids = g_ptr_array_sized_new (uids->len);
for (i = 0, j = 0; i < uids->len; i++) {
CamelMessageInfo *info;
@@ -765,10 +765,10 @@ send_queue_send(struct _mail_msg *mm)
camel_object_unref (m->driver);
m->driver = NULL;
}
-
+
camel_folder_free_uids (m->queue, uids);
g_ptr_array_free (send_uids, TRUE);
-
+
camel_folder_sync (m->queue, TRUE, &ex);
camel_exception_clear (&ex);