[Xfce4-commits] <postler:master> Save localized folders and require folders when sending

Christian Dywan noreply at xfce.org
Wed Dec 1 03:24:01 CET 2010


Updating branch refs/heads/master
         to ff9502d79b6be724f9d74ee0384825f283ed5de9 (commit)
       from a68b101b098258ab5beea8011a95c493779fdaad (commit)

commit ff9502d79b6be724f9d74ee0384825f283ed5de9
Author: Christian Dywan <christian at twotoasts.de>
Date:   Tue Nov 30 23:09:38 2010 +0100

    Save localized folders and require folders when sending

 postler/postler-accounts.vala |   11 +++++++++++
 postler/postler-composer.vala |   11 +++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/postler/postler-accounts.vala b/postler/postler-accounts.vala
index 219b959..7e22e7e 100644
--- a/postler/postler-accounts.vala
+++ b/postler/postler-accounts.vala
@@ -199,6 +199,12 @@ public class Postler.Accounts : GLib.Object {
                     if (account_info.hide != null
                      && account_info.hide != hide_folder_default)
                         keyfile.set_string (group, "hide", account_info.hide);
+                    for (int type = 0; type < FolderType.MAX; type++)
+                        if (account_info.folders[type] != null) {
+                            keyfile.set_string (group,
+                                "localized" + type.to_string (),
+                                account_info.folders[type]);
+                        }
                 }
                 else if (account_info.type == AccountType.SEARCH) {
                     keyfile.set_string (group, "type", "search");
@@ -298,6 +304,11 @@ public class Postler.Accounts : GLib.Object {
                         info.organization = keyfile.get_string (group, "organization");
                     if (keyfile.has_key (group, "hide"))
                         info.hide = keyfile.get_string (group, "hide");
+                    for (int ftype = 0; ftype < FolderType.MAX; ftype++) {
+                        string keyname = "localized" + ftype.to_string ();
+                        if (keyfile.has_key (group, keyname))
+                            info.folders[ftype] = keyfile.get_string (group, keyname);
+                    }
                 }
                 else if (type == "search") {
                     info.type = AccountType.SEARCH;
diff --git a/postler/postler-composer.vala b/postler/postler-composer.vala
index 54f6698..b91f7cc 100644
--- a/postler/postler-composer.vala
+++ b/postler/postler-composer.vala
@@ -99,9 +99,16 @@ public class Postler.Composer : Gtk.Window {
             if (info.address != null && from[1] in info.address) {
                 string queue = info.path + "/" + info.get_folder (FolderType.QUEUE);
                 string sent = info.path + "/" + info.get_folder (FolderType.SENT);
-                if (!Postler.Messages.ensure_folder (queue)
+                if (queue.has_suffix ("/") || sent.has_suffix ("/")
+                 || !Postler.Messages.ensure_folder (queue)
                  || !Postler.Messages.ensure_folder (sent)) {
-                    GLib.critical (_("Folders for sent messages couldn't be created."));
+                    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."));
+                    dialog.add_buttons (Gtk.STOCK_OK, Gtk.ResponseType.OK);
+                    dialog.run ();
+                    dialog.destroy ();
                     return;
                 }
                 var now = new Soup.Date.from_now (0);



More information about the Xfce4-commits mailing list