[Xfce4-commits] <postler:master> Show error messages before grace timeout

Christian Dywan noreply at xfce.org
Sun Feb 27 04:10:01 CET 2011


Updating branch refs/heads/master
         to bc0d36e27448b544a3743c4269c3d3bb01f68e2f (commit)
       from 37897cd646fa1ebaff9eaa29455d145a4b042ae0 (commit)

commit bc0d36e27448b544a3743c4269c3d3bb01f68e2f
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Feb 27 04:09:43 2011 +0100

    Show error messages before grace timeout

 postler/postler-composer.vala |   93 +++++++++++++++++++++--------------------
 1 files changed, 48 insertions(+), 45 deletions(-)

diff --git a/postler/postler-composer.vala b/postler/postler-composer.vala
index 588be4e..14f9085 100644
--- a/postler/postler-composer.vala
+++ b/postler/postler-composer.vala
@@ -124,6 +124,51 @@ public class Postler.Composer : Gtk.Window {
             return;
         }
 
+        if (entry_subject.text == "") {
+            var dialog = new Gtk.MessageDialog (this, 0,
+                Gtk.MessageType.WARNING, Gtk.ButtonsType.NONE,
+                _("You did not enter a subject."));
+            dialog.format_secondary_text (
+                _("Do you want to send the message without a subject?"));
+            dialog.add_buttons (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
+                _("_Send message without subject"), Gtk.ResponseType.OK);
+            dialog.set_default_response (Gtk.ResponseType.CANCEL);
+            int response = dialog.run ();
+            dialog.destroy ();
+            if (response != Gtk.ResponseType.OK)
+                return;
+        }
+
+        string? sender = combo_from.get_active_text ();
+        if (sender == null) {
+            var dialog = new Gtk.MessageDialog (this, 0,
+                Gtk.MessageType.ERROR, Gtk.ButtonsType.NONE,
+                _("You have not configured any accounts for sending."));
+            dialog.add_buttons (Gtk.STOCK_OK, Gtk.ResponseType.OK);
+            dialog.run ();
+            dialog.destroy ();
+            return;
+        }
+
+        var info = selected_account_for_address (sender);
+        string queue = info.path + "/" + info.get_folder (FolderType.QUEUE);
+        string sent = info.path + "/" + info.get_folder (FolderType.SENT);
+        if (queue.has_suffix ("/") || sent.has_suffix ("/")
+         || !Postler.Messages.ensure_folder (queue)
+         || !Postler.Messages.ensure_folder (sent)) {
+            var dialog = new Gtk.MessageDialog (this, 0,
+                 Gtk.MessageType.ERROR, Gtk.ButtonsType.NONE,
+                _("Folders for sent messages and outbox can't be created. "
+                + "You need to fetch mail at least once.\n"
+                + "If you see this error after fetching, right-click "
+                + "the folder for sent messages, \"Use as...\" and "
+                + "select \"Sent\". Do the same for the outbox."));
+            dialog.add_buttons (Gtk.STOCK_OK, Gtk.ResponseType.OK);
+            dialog.run ();
+            dialog.destroy ();
+            return;
+        }
+
         toggle_sensitivity (false);
         progressbar.fraction = 0.0;
         progressbar.show ();
@@ -273,55 +318,13 @@ public class Postler.Composer : Gtk.Window {
         progress_timer = GLib.Timeout.add_seconds (1, send_progress_timer);
         button_send.sensitive = false;
 
-        if (entry_subject.text == "") {
-            var dialog = new Gtk.MessageDialog (this, 0,
-                Gtk.MessageType.WARNING, Gtk.ButtonsType.NONE,
-                _("You did not enter a subject."));
-            dialog.format_secondary_text (
-                _("Do you want to send the message without a subject?"));
-            dialog.add_buttons (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
-                _("_Send message without subject"), Gtk.ResponseType.OK);
-            dialog.set_default_response (Gtk.ResponseType.CANCEL);
-            int response = dialog.run ();
-            dialog.destroy ();
-            if (response != Gtk.ResponseType.OK)
-                return;
-        }
-
         string? sender = combo_from.get_active_text ();
-        if (sender == null) {
-            var dialog = new Gtk.MessageDialog (this, 0,
-                Gtk.MessageType.ERROR, Gtk.ButtonsType.NONE,
-                _("You have not configured any accounts for sending."));
-            dialog.add_buttons (Gtk.STOCK_OK, Gtk.ResponseType.OK);
-            dialog.run ();
-            dialog.destroy ();
-            return;
-        }
-
-                var info = selected_account_for_address (sender);
-                string queue = info.path + "/" + info.get_folder (FolderType.QUEUE);
-                string sent = info.path + "/" + info.get_folder (FolderType.SENT);
-                if (queue.has_suffix ("/") || sent.has_suffix ("/")
-                 || !Postler.Messages.ensure_folder (queue)
-                 || !Postler.Messages.ensure_folder (sent)) {
-                    var dialog = new Gtk.MessageDialog (this, 0,
-                        Gtk.MessageType.ERROR, Gtk.ButtonsType.NONE,
-                        _("Folders for sent messages and outbox can't be created. "
-                        + "You need to fetch mail at least once.\n"
-                        + "If you see this error after fetching, right-click "
-                        + "the folder for sent messages, \"Use as...\" and "
-                        + "select \"Sent\". Do the same for the outbox."));
-                    dialog.add_buttons (Gtk.STOCK_OK, Gtk.ResponseType.OK);
-                    dialog.run ();
-                    dialog.destroy ();
-                    return;
-                }
-
-                string message = generate_message (sender, info);
+        var info = selected_account_for_address (sender);
+        string message = generate_message (sender, info);
 
                 try {
                     /* TODO: Put in /Queue/new/ first and move on success */
+                    string sent = info.path + "/" + info.get_folder (FolderType.SENT);
                     string filename = Postler.Messages.generate_filename (sent + "/cur/", "S");
                     FileUtils.set_contents (filename, message, -1);
                     FileUtils.chmod (filename, 0700);



More information about the Xfce4-commits mailing list