aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/mail-callbacks.c50
2 files changed, 54 insertions, 4 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 714c5ed7ba..91a9818e97 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,11 @@
+2002-08-09 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-callbacks.c (save_draft_done): If the ccd is NULL, create a
+ new ccd, disconnect the old signal handlers, and then reconnect
+ the signal handlers using the non-NULL ccd as the user_data.
+ (composer_send_queued_cb): Same, but only if the queue append
+ operation failed.
+
2002-08-09 Dan Winship <danw@ximian.com>
* mail-callbacks.c (composer_send_queued_cb, save_draft_done):
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 0fa94b7f9d..3a1d52d697 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -390,6 +390,28 @@ composer_send_queued_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessag
mail_send ();
}
} else {
+ if (!ccd) {
+ ccd = g_new (struct _composer_callback_data, 1);
+ ccd->drafts_folder = NULL;
+ ccd->drafts_uid = NULL;
+ ccd->folder = NULL;
+ ccd->uid = NULL;
+
+ /* disconnect the previous signal handlers */
+ gtk_signal_disconnect_by_func (GTK_OBJECT (send->composer),
+ GTK_SIGNAL_FUNC (composer_send_cb), NULL);
+ gtk_signal_disconnect_by_func (GTK_OBJECT (send->composer),
+ GTK_SIGNAL_FUNC (composer_save_draft_cb), NULL);
+
+ /* reconnect to the signals using a non-NULL ccd for the callback data */
+ gtk_signal_connect (GTK_OBJECT (send->composer), "send",
+ GTK_SIGNAL_FUNC (composer_send_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (send->composer), "save-draft",
+ GTK_SIGNAL_FUNC (composer_save_draft_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (send->composer), "destroy",
+ GTK_SIGNAL_FUNC (free_ccd), ccd);
+ }
+
e_msg_composer_set_enable_autosave (send->composer, TRUE);
gtk_widget_show (GTK_WIDGET (send->composer));
gtk_object_unref (GTK_OBJECT (send->composer));
@@ -612,9 +634,29 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i
GNOME_GtkHTML_Editor_Engine_runCommand (sdi->composer->editor_engine, "saved", &ev);
CORBA_exception_free (&ev);
- ccd = sdi->ccd;
+ if ((ccd = sdi->ccd) == NULL) {
+ ccd = g_new (struct _composer_callback_data, 1);
+ ccd->drafts_folder = NULL;
+ ccd->drafts_uid = NULL;
+ ccd->folder = NULL;
+ ccd->uid = NULL;
+
+ /* disconnect the previous signal handlers */
+ gtk_signal_disconnect_by_func (GTK_OBJECT (sdi->composer),
+ GTK_SIGNAL_FUNC (composer_send_cb), NULL);
+ gtk_signal_disconnect_by_func (GTK_OBJECT (sdi->composer),
+ GTK_SIGNAL_FUNC (composer_save_draft_cb), NULL);
+
+ /* reconnect to the signals using a non-NULL ccd for the callback data */
+ gtk_signal_connect (GTK_OBJECT (sdi->composer), "send",
+ GTK_SIGNAL_FUNC (composer_send_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (sdi->composer), "save-draft",
+ GTK_SIGNAL_FUNC (composer_save_draft_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (sdi->composer), "destroy",
+ GTK_SIGNAL_FUNC (free_ccd), ccd);
+ }
- if (ccd && ccd->drafts_folder) {
+ if (ccd->drafts_folder) {
/* delete the original draft message */
camel_folder_set_message_flags (ccd->drafts_folder, ccd->drafts_uid,
CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN,
@@ -625,7 +667,7 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i
ccd->drafts_uid = NULL;
}
- if (ccd && ccd->folder) {
+ if (ccd->folder) {
/* set the replied flags etc */
camel_folder_set_message_flags (ccd->folder, ccd->uid, ccd->flags, ccd->set);
camel_object_unref (ccd->folder);
@@ -634,7 +676,7 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i
ccd->uid = NULL;
}
- if (ccd && appended_uid) {
+ if (appended_uid) {
camel_object_ref (folder);
ccd->drafts_folder = folder;
ccd->drafts_uid = g_strdup (appended_uid);