aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-02-21 10:18:22 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-02-21 10:18:22 +0800
commit822b1964647ff9ecd3be57d1982bddfa43cba73e (patch)
tree361fafd4a05f2c3ab3dfd7317bdb0ed304242cbe
parent33041e67fcbf0e88b449ea4991d6648b51a84b38 (diff)
downloadgsoc2013-evolution-822b1964647ff9ecd3be57d1982bddfa43cba73e.tar.gz
gsoc2013-evolution-822b1964647ff9ecd3be57d1982bddfa43cba73e.tar.zst
gsoc2013-evolution-822b1964647ff9ecd3be57d1982bddfa43cba73e.zip
Use mail_append_mail to save to drafts instead of custom thread handler.
2001-02-21 Not Zed <NotZed@Ximian.com> * e-msg-composer.c (menu_file_save_draft_cb): (exit_dialog_cb): Use mail_append_mail to save to drafts instead of custom thread handler. svn path=/trunk/; revision=8313
-rw-r--r--composer/ChangeLog6
-rw-r--r--composer/e-msg-composer.c109
2 files changed, 39 insertions, 76 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 34acb6e362..5a987198aa 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,9 @@
+2001-02-21 Not Zed <NotZed@Ximian.com>
+
+ * e-msg-composer.c (menu_file_save_draft_cb):
+ (exit_dialog_cb): Use mail_append_mail to save to drafts instead
+ of custom thread handler.
+
2001-02-19 Jeffrey Stedfast <fejj@ximian.com>
* e-msg-composer.c (build_message): Handle exceptions a little
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index aa13d442ca..03e747c481 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -48,7 +48,7 @@
#include "mail/mail.h"
#include "mail/mail-crypto.h"
#include "mail/mail-tools.h"
-#include "mail/mail-threads.h"
+#include "mail/mail-ops.h"
#include "e-util/e-html-utils.h"
#include <gal/widgets/e-gui-utils.h>
@@ -717,104 +717,61 @@ load (EMsgComposer *composer,
enum { REPLY_YES = 0, REPLY_NO, REPLY_CANCEL };
-typedef struct save_draft_input_s {
+struct _save_info {
EMsgComposer *composer;
-} save_draft_input_t;
-
-typedef struct save_draft_data_s {
- CamelMimeMessage *msg;
- CamelMessageInfo *info;
-} save_draft_data_t;
+ int quitok;
+};
-static gchar *
-describe_save_draft (gpointer in_data, gboolean gerund)
+static void save_done(CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data)
{
- if (gerund) {
- return g_strdup (_("Saving changes to message..."));
- } else {
- return g_strdup (_("Save changes to message..."));
- }
-}
+ struct _save_info *si = data;
-static void
-setup_save_draft (gpointer in_data, gpointer op_data, CamelException *ex)
-{
- save_draft_input_t *input = (save_draft_input_t *) in_data;
- save_draft_data_t *data = (save_draft_data_t *) op_data;
-
- g_return_if_fail (input->composer != NULL);
-
- /* initialize op_data */
- input->composer->send_html = TRUE; /* always save drafts as HTML to keep formatting */
- data->msg = e_msg_composer_get_message (input->composer);
- data->info = g_new0 (CamelMessageInfo, 1);
- data->info->flags = CAMEL_MESSAGE_DRAFT;
+ if (ok && si->quitok)
+ gtk_widget_destroy((GtkWidget *)si->composer);
+ else
+ gtk_object_unref((GtkObject *)si->composer);
+
+ g_free(info);
+ g_free(si);
}
static void
-do_save_draft (gpointer in_data, gpointer op_data, CamelException *ex)
+save_draft(EMsgComposer *composer, int quitok)
{
- /*save_draft_input_t *input = (save_draft_input_t *) in_data;*/
- save_draft_data_t *data = (save_draft_data_t *) op_data;
+ CamelMimeMessage *msg;
+ CamelMessageInfo *info;
extern CamelFolder *drafts_folder;
-
- /* perform camel operations */
- mail_tool_camel_lock_up ();
- camel_folder_append_message (drafts_folder, data->msg, data->info, ex);
- mail_tool_camel_lock_down ();
-}
+ struct _save_info *si;
-static void
-cleanup_save_draft (gpointer in_data, gpointer op_data, CamelException *ex)
-{
- save_draft_input_t *input = (save_draft_input_t *) in_data;
- /*save_draft_data_t *data = (save_draft_data_t *) op_data;*/
-
- if (camel_exception_is_set (ex)) {
- char *reason;
-
- reason = g_strdup_printf (_("Error saving composition to 'Drafts': %s"),
- camel_exception_get_description (ex));
-
- gnome_warning_dialog_parented (reason, GTK_WINDOW (input->composer));
- g_free (reason);
- } else {
- gtk_widget_destroy (GTK_WIDGET (input->composer));
- }
-}
+ composer->send_html = TRUE; /* always save drafts as HTML to keep formatting */
+ msg = e_msg_composer_get_message(composer);
-static const mail_operation_spec op_save_draft = {
- describe_save_draft,
- sizeof (save_draft_data_t),
- setup_save_draft,
- do_save_draft,
- cleanup_save_draft
-};
+ info = g_new0 (CamelMessageInfo, 1);
+ info->flags = CAMEL_MESSAGE_DRAFT;
+
+ si = g_malloc(sizeof(*si));
+ si->composer = composer;
+ gtk_object_ref((GtkObject *)composer);
+ si->quitok = quitok;
+
+ mail_append_mail(drafts_folder, msg, info, save_done, si);
+ camel_object_unref((CamelObject *)msg);
+}
static void
menu_file_save_draft_cb (BonoboUIComponent *uic, void *data, const char *path)
{
- EMsgComposer *composer;
- save_draft_input_t *input;
-
- composer = E_MSG_COMPOSER (data);
-
- input = g_new0 (save_draft_input_t, 1);
- input->composer = composer;
- mail_operation_queue (&op_save_draft, input, TRUE);
+ save_draft(E_MSG_COMPOSER(data), FALSE);
}
static void
exit_dialog_cb (int reply, EMsgComposer *composer)
{
- save_draft_input_t *input;
-
switch (reply) {
case REPLY_YES:
/* this has to be done async */
- input = g_new0 (save_draft_input_t, 1);
- input->composer = composer;
- mail_operation_queue (&op_save_draft, input, TRUE);
+ save_draft(composer, TRUE);
+ break;
case REPLY_NO:
gtk_widget_destroy (GTK_WIDGET (composer));
break;