[geary/wip/create-folders-713492] WIP use FolderPath in AccountInformation



commit 4ea1754c55628a6f61e18a169ef6925b47f3addc
Author: Charles Lindsay <chaz yorba org>
Date:   Tue Feb 4 18:12:04 2014 -0800

    WIP use FolderPath in AccountInformation

 src/engine/api/geary-account-information.vala |   60 +++++++++++++-----------
 1 files changed, 32 insertions(+), 28 deletions(-)
---
diff --git a/src/engine/api/geary-account-information.vala b/src/engine/api/geary-account-information.vala
index 5607216..161e71b 100644
--- a/src/engine/api/geary-account-information.vala
+++ b/src/engine/api/geary-account-information.vala
@@ -27,10 +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";
+    private const string DRAFTS_FOLDER_KEY = "drafts_folder";
+    private const string SENT_MAIL_FOLDER_KEY = "sent_mail_folder";
+    private const string SPAM_FOLDER_KEY = "spam_folder";
+    private const string TRASH_FOLDER_KEY = "trash_folder";
     
     //
     // "Retired" keys
@@ -85,10 +85,10 @@ public class Geary.AccountInformation : BaseObject {
     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.FolderPath? drafts_folder_path { get; set; default = null; }
+    public Geary.FolderPath? sent_mail_folder_path { get; set; default = null; }
+    public Geary.FolderPath? spam_folder_path { get; set; default = null; }
+    public Geary.FolderPath? trash_folder_path { get; set; default = null; }
 
     public Geary.Credentials imap_credentials { get; set; default = new Geary.Credentials(null, null); }
     public bool imap_remember_password { get; set; default = true; }
@@ -152,18 +152,18 @@ public class Geary.AccountInformation : BaseObject {
                 }
             }
             
-            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;
+            drafts_folder_path = get_string_value(key_file, GROUP, DRAFTS_FOLDER_KEY);
+            if (Geary.String.is_empty_or_whitespace(drafts_folder_path))
+                drafts_folder_path = null;
+            sent_mail_folder_path = get_string_value(key_file, GROUP, SENT_MAIL_FOLDER_KEY);
+            if (Geary.String.is_empty_or_whitespace(sent_mail_folder_path))
+                sent_mail_folder_path = null;
+            spam_folder_path = get_string_value(key_file, GROUP, SPAM_FOLDER_KEY);
+            if (Geary.String.is_empty_or_whitespace(spam_folder_path))
+                spam_folder_path = null;
+            trash_folder_path = get_string_value(key_file, GROUP, TRASH_FOLDER_KEY);
+            if (Geary.String.is_empty_or_whitespace(trash_folder_path))
+                trash_folder_path = null;
         }
     }
     
@@ -189,10 +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;
+        drafts_folder_path = from.drafts_folder_path;
+        sent_mail_folder_path = from.sent_mail_folder_path;
+        spam_folder_path = from.spam_folder_path;
+        trash_folder_path = from.trash_folder_path;
     }
     
     /**
@@ -516,10 +516,14 @@ 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 ?? "");
+        key_file.set_string_list(GROUP, DRAFTS_FOLDER_KEY, (drafts_folder_path != null
+            ? drafts_folder_path.as_list().to_array() : string[] { }));
+        key_file.set_string_list(GROUP, SENT_MAIL_FOLDER_KEY, (sent_mail_folder_path != null
+            ? sent_mail_folder_path.as_list().to_array() : string[] { }));
+        key_file.set_string_list(GROUP, SPAM_FOLDER_KEY, (spam_folder_path != null
+            ? spam_folder_path.as_list().to_array() : string[] { }));
+        key_file.set_string_list(GROUP, TRASH_FOLDER_KEY, (trash_folder_path != null
+            ? trash_folder_path.as_list().to_array() : string[] { }));
         
         string data = key_file.to_data();
         string new_etag;


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