From 0f56e5e54e6a5e227d6a7a5407f63b74f4af378b Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Tue, 20 Jun 2000 04:59:16 +0000 Subject: Add a confirmation dialog box for when the user tries to send a message without a subject. svn path=/trunk/; revision=3644 --- mail/ChangeLog | 7 +++++++ mail/mail-ops.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 4d647f134d..68e119b7e2 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,10 @@ +2000-06-19 Ettore Perazzoli + + * mail-ops.c (ask_confirm_for_empty_subject): New function to ask + confirmation for an empty subject line. + (composer_send_cb): Use it if the subject is empty and only send + the message if the user confirms. + 2000-06-20 Jeffrey Stedfast * component-factory.c (create_imap_storage): Now creates the IMAP diff --git a/mail/mail-ops.c b/mail/mail-ops.c index c28c4a0de6..6f27acefd4 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -276,12 +276,32 @@ struct post_send_data { guint32 flags; }; +static gboolean +ask_confirm_for_empty_subject (EMsgComposer *composer) +{ + GtkWidget *message_box; + int button; + + message_box = gnome_message_box_new (_("This message has no subject.\nReally send?"), + GNOME_MESSAGE_BOX_QUESTION, + GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, + NULL); + + button = gnome_dialog_run_and_close (GNOME_DIALOG (message_box)); + + if (button == 0) + return TRUE; + else + return FALSE; +} + static void composer_send_cb (EMsgComposer *composer, gpointer data) { static CamelTransport *transport = NULL; struct post_send_data *psd = data; static char *from = NULL; + const char *subject; CamelException *ex; CamelMimeMessage *message; char *name, *addr, *path; @@ -328,6 +348,14 @@ composer_send_cb (EMsgComposer *composer, gpointer data) message = e_msg_composer_get_message (composer); + subject = camel_mime_message_get_subject (message); + if (subject == NULL || subject[0] == '\0') { + if (! ask_confirm_for_empty_subject (composer)) { + gtk_object_unref (GTK_OBJECT (message)); + return; + } + } + camel_mime_message_set_from (message, from); camel_medium_add_header (CAMEL_MEDIUM (message), "X-Mailer", "Evolution (Developer Preview)"); -- cgit v1.2.3