aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-07-03 09:38:45 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-07-03 09:38:45 +0800
commit36765e48f24ad968a2bda97e7ee2056d9b91a4da (patch)
tree02019ab3fa399e944e0b0bc31cb96693eb03991d /mail
parentd3cd60c2a009985c88175881d95880f8e524a768 (diff)
downloadgsoc2013-evolution-36765e48f24ad968a2bda97e7ee2056d9b91a4da.tar
gsoc2013-evolution-36765e48f24ad968a2bda97e7ee2056d9b91a4da.tar.gz
gsoc2013-evolution-36765e48f24ad968a2bda97e7ee2056d9b91a4da.tar.bz2
gsoc2013-evolution-36765e48f24ad968a2bda97e7ee2056d9b91a4da.tar.lz
gsoc2013-evolution-36765e48f24ad968a2bda97e7ee2056d9b91a4da.tar.xz
gsoc2013-evolution-36765e48f24ad968a2bda97e7ee2056d9b91a4da.tar.zst
gsoc2013-evolution-36765e48f24ad968a2bda97e7ee2056d9b91a4da.zip
Updated for the mail_transfer_messages API.
2001-07-02 Jeffrey Stedfast <fejj@ximian.com> * mail-callbacks.c (transfer_msg): Updated for the mail_transfer_messages API. * folder-browser.c (message_list_drag_data_recieved): Update for the mail_transfer_messages API. (selection_received): Same. * mail-ops.c (mail_transfer_messages): Renamed from mail_do_transfer_messages and also added a callback/data arguments since we need it component_factory::xfer_folder. * component-factory.c (xfer_folder): Use mail_transfer_messages instead. (destination_folder_handle_drop): Update to pass in a NULL callback arg and a NULL data argument to mail_transfer_messages. svn path=/trunk/; revision=10710
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog18
-rw-r--r--mail/component-factory.c30
-rw-r--r--mail/folder-browser.c5
-rw-r--r--mail/mail-callbacks.c3
-rw-r--r--mail/mail-config.glade14
-rw-r--r--mail/mail-ops.c148
-rw-r--r--mail/mail-ops.h8
7 files changed, 90 insertions, 136 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 0f62287f5e..67ad37d278 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,21 @@
+2001-07-02 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-callbacks.c (transfer_msg): Updated for the
+ mail_transfer_messages API.
+
+ * folder-browser.c (message_list_drag_data_recieved): Update for
+ the mail_transfer_messages API.
+ (selection_received): Same.
+
+ * mail-ops.c (mail_transfer_messages): Renamed from
+ mail_do_transfer_messages and also added a callback/data arguments
+ since we need it component_factory::xfer_folder.
+
+ * component-factory.c (xfer_folder): Use mail_transfer_messages
+ instead.
+ (destination_folder_handle_drop): Update to pass in a NULL
+ callback arg and a NULL data argument to mail_transfer_messages.
+
2001-07-02 Larry Ewing <lewing@ximian.com>
* mail-display.c (save_part): move the saving logic out of save_cb
diff --git a/mail/component-factory.c b/mail/component-factory.c
index f568734921..149159faf6 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -232,13 +232,13 @@ remove_folder (EvolutionShellComponent *shell_component,
}
static void
-do_xfer_folder (char *src_uri, char *dest_uri, gboolean remove_source, CamelFolder *dest_folder, void *data)
+do_xfer_folder (gboolean ok, void *data)
{
GNOME_Evolution_ShellComponentListener listener = data;
GNOME_Evolution_ShellComponentListener_Result result;
CORBA_Environment ev;
- if (dest_folder)
+ if (ok)
result = GNOME_Evolution_ShellComponentListener_OK;
else
result = GNOME_Evolution_ShellComponentListener_INVALID_URI;
@@ -258,12 +258,24 @@ xfer_folder (EvolutionShellComponent *shell_component,
void *closure)
{
CORBA_Environment ev;
+ CamelFolder *source;
+ CamelException ex;
+ GPtrArray *uids;
+
+ camel_exception_init (&ex);
+ source = mail_tool_uri_to_folder (source_physical_uri, &ex);
+ camel_exception_clear (&ex);
CORBA_exception_init (&ev);
- mail_xfer_folder (source_physical_uri, destination_physical_uri, remove_source, do_xfer_folder,
- CORBA_Object_duplicate (listener, &ev));
- GNOME_Evolution_ShellComponentListener_notifyResult (listener,
- GNOME_Evolution_ShellComponentListener_OK, &ev);
+ if (source) {
+ uids = camel_folder_get_uids (source);
+ mail_transfer_messages (source, uids, remove_source, destination_physical_uri,
+ do_xfer_folder,
+ CORBA_Object_duplicate (listener, &ev));
+
+ GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_OK, &ev);
+ } else
+ GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_INVALID_URI, &ev);
CORBA_exception_free (&ev);
}
@@ -446,9 +458,9 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *fol
inptr++;
}
- mail_do_transfer_messages (source, uids,
- action == GNOME_Evolution_ShellComponentDnd_ACTION_MOVE,
- physical_uri);
+ mail_transfer_messages (source, uids,
+ action == GNOME_Evolution_ShellComponentDnd_ACTION_MOVE,
+ physical_uri, NULL, NULL);
camel_object_unref (CAMEL_OBJECT (source));
break;
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 85a9084d68..fca23c8f2f 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -465,7 +465,8 @@ message_list_drag_data_recieved (ETree *tree, int row, ETreePath path, int col,
goto fail;
}
- mail_do_transfer_messages (folder, uids, context->action == GDK_ACTION_MOVE, fb->uri);
+ mail_transfer_messages (folder, uids, context->action == GDK_ACTION_MOVE,
+ fb->uri, NULL, NULL);
camel_object_unref (CAMEL_OBJECT (folder));
break;
@@ -519,7 +520,7 @@ selection_received (GtkWidget *widget, GtkSelectionData *selection_data,
return;
}
- mail_do_transfer_messages (source, uids, FALSE, fb->uri);
+ mail_transfer_messages (source, uids, FALSE, fb->uri, NULL, NULL);
camel_object_unref (CAMEL_OBJECT (source));
}
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 3e737788a0..b4c42ba1cf 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -984,7 +984,8 @@ transfer_msg (GtkWidget *widget, gpointer user_data, gboolean delete_from_source
uids = g_ptr_array_new ();
message_list_foreach (ml, enumerate_msg, uids);
- mail_do_transfer_messages (ml->folder, uids, delete_from_source, physical);
+ mail_transfer_messages (ml->folder, uids, delete_from_source,
+ physical, NULL, NULL);
}
void
diff --git a/mail/mail-config.glade b/mail/mail-config.glade
index 54b7ce04f7..f233e30313 100644
--- a/mail/mail-config.glade
+++ b/mail/mail-config.glade
@@ -2640,6 +2640,20 @@ Quoted
</child>
</widget>
</widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>chkEmptyTrashOnExit</name>
+ <can_focus>True</can_focus>
+ <label>Empty trash folders on exit</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
</widget>
<widget>
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 0fd73805fa..43c83f78e4 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -833,6 +833,9 @@ struct _transfer_msg {
GPtrArray *uids;
gboolean delete;
char *dest_uri;
+
+ void (*done)(gboolean ok, void *data);
+ void *data;
};
static char *
@@ -879,30 +882,41 @@ transfer_messages_transfer (struct _mail_msg *mm)
}
static void
+transfer_messages_transferred (struct _mail_msg *mm)
+{
+ struct _transfer_msg *m = (struct _transfer_msg *)mm;
+
+ if (m->done)
+ m->done (!camel_exception_is_set (&mm->ex), m->data);
+}
+
+static void
transfer_messages_free (struct _mail_msg *mm)
{
struct _transfer_msg *m = (struct _transfer_msg *)mm;
int i;
- camel_object_unref((CamelObject *)m->source);
- g_free(m->dest_uri);
- for (i=0;i<m->uids->len;i++)
- g_free(m->uids->pdata[i]);
- g_ptr_array_free(m->uids, TRUE);
+ camel_object_unref (CAMEL_OBJECT (m->source));
+ g_free (m->dest_uri);
+ for (i = 0; i < m->uids->len; i++)
+ g_free (m->uids->pdata[i]);
+ g_ptr_array_free (m->uids, TRUE);
}
static struct _mail_msg_op transfer_messages_op = {
transfer_messages_desc,
transfer_messages_transfer,
- NULL,
+ transfer_messages_transferred,
transfer_messages_free,
};
void
-mail_do_transfer_messages (CamelFolder *source, GPtrArray *uids,
- gboolean delete_from_source,
- const char *dest_uri)
+mail_transfer_messages (CamelFolder *source, GPtrArray *uids,
+ gboolean delete_from_source,
+ const char *dest_uri,
+ void (*done) (gboolean ok, void *data),
+ void *data)
{
struct _transfer_msg *m;
@@ -912,11 +926,13 @@ mail_do_transfer_messages (CamelFolder *source, GPtrArray *uids,
m = mail_msg_new(&transfer_messages_op, NULL, sizeof(*m));
m->source = source;
- camel_object_ref((CamelObject *)source);
+ camel_object_ref (CAMEL_OBJECT (source));
m->uids = uids;
m->delete = delete_from_source;
m->dest_uri = g_strdup (dest_uri);
-
+ m->done = done;
+ m->data = data;
+
e_thread_put(mail_thread_queued, (EMsg *)m);
}
@@ -1414,116 +1430,6 @@ mail_remove_folder (const char *uri, void (*done) (char *uri, gboolean removed,
e_thread_put (mail_thread_new, (EMsg *)m);
}
-/* ** XFER FOLDER ******************************************************* */
-
-struct _xfer_folder_msg {
- struct _mail_msg msg;
-
- char *src_uri;
- char *dest_uri;
- gboolean remove;
- CamelFolder *folder;
- void (*done) (char *src_uri, char *dest_uri, gboolean remove, CamelFolder *folder, void *data);
- void *data;
-};
-
-static char *
-xfer_folder_desc (struct _mail_msg *mm, int done)
-{
- struct _xfer_folder_msg *m = (struct _xfer_folder_msg *)mm;
-
- if (m->remove)
- return g_strdup_printf (_("Moving folder %s to %s"), m->src_uri, m->dest_uri);
- else
- return g_strdup_printf (_("Copying folder %s to %s"), m->src_uri, m->dest_uri);
-}
-
-static void
-xfer_folder_get (struct _mail_msg *mm)
-{
- struct _xfer_folder_msg *m = (struct _xfer_folder_msg *)mm;
- CamelFolder *src, *dest = NULL;
- GPtrArray *uids;
-
- camel_operation_register (mm->cancel);
-
- src = mail_tool_uri_to_folder (m->src_uri, &mm->ex);
- if (camel_exception_is_set (&mm->ex))
- goto done;
-
- dest = mail_tool_get_folder_from_urlname (m->dest_uri, "mbox",
- CAMEL_STORE_FOLDER_CREATE | CAMEL_STORE_FOLDER_BODY_INDEX,
- &mm->ex);
- if (camel_exception_is_set (&mm->ex))
- goto done;
-
- uids = camel_folder_get_uids (src);
- if (m->remove)
- camel_folder_move_messages_to (src, uids, dest, &mm->ex);
- else
- camel_folder_copy_messages_to (src, uids, dest, &mm->ex);
-
- camel_folder_free_uids (src, uids);
-
- if (camel_exception_is_set (&mm->ex))
- goto done;
-
- if (m->remove)
- camel_store_delete_folder (src->parent_store, src->full_name, &mm->ex);
-
- done:
- if (src)
- camel_object_unref (CAMEL_OBJECT (src));
-
- m->folder = dest;
-
- camel_operation_unregister (mm->cancel);
-}
-
-static void
-xfer_folder_got (struct _mail_msg *mm)
-{
- struct _xfer_folder_msg *m = (struct _xfer_folder_msg *)mm;
-
- if (m->done)
- m->done (m->src_uri, m->dest_uri, m->remove, m->folder, m->data);
-}
-
-static void
-xfer_folder_free (struct _mail_msg *mm)
-{
- struct _xfer_folder_msg *m = (struct _xfer_folder_msg *)mm;
-
- g_free (m->src_uri);
- g_free (m->dest_uri);
- if (m->folder)
- camel_object_unref (CAMEL_OBJECT (m->folder));
-}
-
-static struct _mail_msg_op xfer_folder_op = {
- xfer_folder_desc,
- xfer_folder_get,
- xfer_folder_got,
- xfer_folder_free,
-};
-
-void
-mail_xfer_folder (const char *src_uri, const char *dest_uri, gboolean remove_source,
- void (*done) (char *src_uri, char *dest_uri, gboolean remove, CamelFolder *folder, void *data),
- void *data)
-{
- struct _xfer_folder_msg *m;
-
- m = mail_msg_new (&xfer_folder_op, NULL, sizeof(*m));
- m->src_uri = g_strdup (src_uri);
- m->dest_uri = g_strdup (dest_uri);
- m->remove = remove_source;
- m->data = data;
- m->done = done;
-
- e_thread_put (mail_thread_new, (EMsg *)m);
-}
-
/* ** SYNC FOLDER ********************************************************* */
struct _sync_folder_msg {
diff --git a/mail/mail-ops.h b/mail/mail-ops.h
index a7b777116c..7d00ec85da 100644
--- a/mail/mail-ops.h
+++ b/mail/mail-ops.h
@@ -43,9 +43,11 @@ void mail_append_mail (CamelFolder *folder, CamelMimeMessage *message, CamelMess
void (*done)(CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data),
void *data);
-void mail_do_transfer_messages (CamelFolder *source, GPtrArray *uids,
- gboolean delete_from_source,
- const char *dest_uri);
+void mail_transfer_messages (CamelFolder *source, GPtrArray *uids,
+ gboolean delete_from_source,
+ const char *dest_uri,
+ void (*done) (gboolean ok, void *data),
+ void *data);
/* get a single message, asynchronously */
void mail_get_message (CamelFolder *folder, const char *uid,