[Xfce4-commits] <postler:master> Warn if writing 'attach' without attaching files

Christian Dywan noreply at xfce.org
Sun Dec 26 04:50:07 CET 2010


Updating branch refs/heads/master
         to caaaa811360402352eeba6e545c57267371dbc8c (commit)
       from 51b354e2d943ee81ef4ca6b937cc4861e036c4c9 (commit)

commit caaaa811360402352eeba6e545c57267371dbc8c
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Dec 25 12:46:17 2010 +0100

    Warn if writing 'attach' without attaching files

 postler/postler-composer.vala |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/postler/postler-composer.vala b/postler/postler-composer.vala
index e5644bb..dbf3a7f 100644
--- a/postler/postler-composer.vala
+++ b/postler/postler-composer.vala
@@ -141,6 +141,33 @@ public class Postler.Composer : Gtk.Window {
                 string body = clipboard.wait_for_text ();
                 clear_selection ();
 
+                if (attachments.iter_n_children (null) == 0) {
+                    /* i18n: A warning is displayed when writing a new message
+                             and there are no attachments but the text mentions
+                             attachments. Words are separated by |. */
+                    string[] attachments = _("attachment|attach").split ("|");
+                    foreach (string keyword in attachments)
+                        if (keyword in body) {
+                            var dialog = new Gtk.MessageDialog (this, 0,
+                                Gtk.MessageType.ERROR, Gtk.ButtonsType.NONE,
+                                _("An attachment is mentioned in the text, but "
+                                + "no files were attached."));
+                            dialog.format_secondary_text (_("Do you want to "
+                                + "send the message without attachments?"));
+                            dialog.add_buttons (
+                                Gtk.STOCK_CANCEL,
+                                Gtk.ResponseType.CANCEL,
+                                _("_Send message without attachments"),
+                                Gtk.ResponseType.OK);
+                            dialog.set_default_response (Gtk.ResponseType.CANCEL);
+                            int response = dialog.run ();
+                            dialog.destroy ();
+                            if (response != Gtk.ResponseType.OK)
+                                return;
+                            break;
+                         }
+                }
+
                 if (attachments.get_iter_first (out att_iter)) {
                     string boundary = GLib.Checksum.compute_for_string (
                         GLib.ChecksumType.MD5,



More information about the Xfce4-commits mailing list