diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2000-06-20 12:59:16 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2000-06-20 12:59:16 +0800 |
commit | 0f56e5e54e6a5e227d6a7a5407f63b74f4af378b (patch) | |
tree | c601891d2d531a18361807d9e68b1917f69893fb /mail/mail-ops.c | |
parent | 1ede35fcdd55e7d95faa2fc7d2b26e0388fc200b (diff) | |
download | gsoc2013-evolution-0f56e5e54e6a5e227d6a7a5407f63b74f4af378b.tar.gz gsoc2013-evolution-0f56e5e54e6a5e227d6a7a5407f63b74f4af378b.tar.zst gsoc2013-evolution-0f56e5e54e6a5e227d6a7a5407f63b74f4af378b.zip |
Add a confirmation dialog box for when the user tries to send a
message without a subject.
svn path=/trunk/; revision=3644
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r-- | mail/mail-ops.c | 28 |
1 files changed, 28 insertions, 0 deletions
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)"); |