[geary/wip/create-folders-713492: 2/4] Add folder names to account info



commit 7b999e32b3daa305faa28db785e16a5ff5ac01a9
Author: Charles Lindsay <chaz yorba org>
Date:   Fri Jan 31 15:55:02 2014 -0800

    Add folder names to account info

 src/engine/api/geary-account-information.vala |   31 +++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/src/engine/api/geary-account-information.vala b/src/engine/api/geary-account-information.vala
index 78957ef..5607216 100644
--- a/src/engine/api/geary-account-information.vala
+++ b/src/engine/api/geary-account-information.vala
@@ -27,6 +27,10 @@ public class Geary.AccountInformation : BaseObject {
     private const string SMTP_STARTTLS = "smtp_starttls";
     private const string SMTP_NOAUTH = "smtp_noauth";
     private const string SAVE_SENT_MAIL_KEY = "save_sent_mail";
+    private const string DRAFTS_NAME_KEY = "drafts_folder_name";
+    private const string SENT_MAIL_NAME_KEY = "sent_mail_folder_name";
+    private const string SPAM_NAME_KEY = "spam_folder_name";
+    private const string TRASH_NAME_KEY = "trash_folder_name";
     
     //
     // "Retired" keys
@@ -80,6 +84,11 @@ public class Geary.AccountInformation : BaseObject {
     public bool default_smtp_server_ssl  { get; set; }
     public bool default_smtp_server_starttls { get; set; }
     public bool default_smtp_server_noauth { get; set; }
+    
+    public string? drafts_folder_name { get; set; }
+    public string? sent_mail_folder_name { get; set; }
+    public string? spam_folder_name { get; set; }
+    public string? trash_folder_name { get; set; }
 
     public Geary.Credentials imap_credentials { get; set; default = new Geary.Credentials(null, null); }
     public bool imap_remember_password { get; set; default = true; }
@@ -142,6 +151,19 @@ public class Geary.AccountInformation : BaseObject {
                     smtp_credentials = null;
                 }
             }
+            
+            drafts_folder_name = get_string_value(key_file, GROUP, DRAFTS_NAME_KEY);
+            if (Geary.String.is_empty_or_whitespace(drafts_folder_name))
+                drafts_folder_name = null;
+            sent_mail_folder_name = get_string_value(key_file, GROUP, SENT_MAIL_NAME_KEY);
+            if (Geary.String.is_empty_or_whitespace(sent_mail_folder_name))
+                sent_mail_folder_name = null;
+            spam_folder_name = get_string_value(key_file, GROUP, SPAM_NAME_KEY);
+            if (Geary.String.is_empty_or_whitespace(spam_folder_name))
+                spam_folder_name = null;
+            trash_folder_name = get_string_value(key_file, GROUP, TRASH_NAME_KEY);
+            if (Geary.String.is_empty_or_whitespace(trash_folder_name))
+                trash_folder_name = null;
         }
     }
     
@@ -167,6 +189,10 @@ public class Geary.AccountInformation : BaseObject {
         imap_remember_password = from.imap_remember_password;
         smtp_credentials = from.smtp_credentials;
         smtp_remember_password = from.smtp_remember_password;
+        drafts_folder_name = from.drafts_folder_name;
+        sent_mail_folder_name = from.sent_mail_folder_name;
+        spam_folder_name = from.spam_folder_name;
+        trash_folder_name = from.trash_folder_name;
     }
     
     /**
@@ -490,6 +516,11 @@ public class Geary.AccountInformation : BaseObject {
             key_file.set_boolean(GROUP, SMTP_NOAUTH, default_smtp_server_noauth);
         }
         
+        key_file.set_value(GROUP, DRAFTS_NAME_KEY, drafts_folder_name ?? "");
+        key_file.set_value(GROUP, SENT_MAIL_NAME_KEY, sent_mail_folder_name ?? "");
+        key_file.set_value(GROUP, SPAM_NAME_KEY, spam_folder_name ?? "");
+        key_file.set_value(GROUP, TRASH_NAME_KEY, trash_folder_name ?? "");
+        
         string data = key_file.to_data();
         string new_etag;
         


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]