[geary/wip/trash-714212] Fixes from CR



commit 8b3642247f43fe306b5c9c4e3a23b45ed943372b
Author: Charles Lindsay <chaz yorba org>
Date:   Tue Jan 7 14:58:05 2014 -0800

    Fixes from CR

 src/client/application/geary-controller.vala       |    6 ++--
 src/engine/abstract/geary-abstract-account.vala    |    9 +++----
 src/engine/api/geary-account.vala                  |   21 +++++++------------
 .../gmail/imap-engine-gmail-account.vala           |    6 +----
 .../imap-engine/imap-engine-generic-account.vala   |   15 ++-----------
 .../other/imap-engine-other-account.vala           |    2 +-
 .../outlook/imap-engine-outlook-account.vala       |    2 +-
 .../yahoo/imap-engine-yahoo-account.vala           |    2 +-
 8 files changed, 22 insertions(+), 41 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index dc5d4d8..b9e1e9b 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -930,7 +930,7 @@ public class GearyController : Geary.BaseObject {
         update_tooltips();
         main_window.main_toolbar.update_trash_buttons(
             current_folder_supports_trash() || !(current_folder is Geary.FolderSupport.Remove),
-            current_account.can_support_archive());
+            current_account.can_support_archive);
     }
     
     private void on_folder_selected(Geary.Folder? folder) {
@@ -1307,7 +1307,7 @@ public class GearyController : Geary.BaseObject {
     private void on_shift_key(bool pressed) {
         main_window.main_toolbar.update_trash_buttons(
             (!pressed && current_folder_supports_trash()) || !(current_folder is Geary.FolderSupport.Remove),
-            current_account.can_support_archive());
+            current_account.can_support_archive);
     }
     
     // this signal does not necessarily indicate that the application previously didn't have
@@ -1867,7 +1867,7 @@ public class GearyController : Geary.BaseObject {
         out Geary.FolderPath? trash_path = null) {
         try {
             if (current_folder != null && current_folder.special_folder_type != Geary.SpecialFolderType.TRASH
-                && current_account != null && !current_account.folder_is_local_only(current_folder.path)) {
+                && !current_folder.properties.is_local_only && current_account != null) {
                 Geary.FolderSupport.Move? supports_move = current_folder as Geary.FolderSupport.Move;
                 Geary.Folder? trash_folder = 
current_account.get_special_folder(Geary.SpecialFolderType.TRASH);
                 if (supports_move != null && trash_folder != null) {
diff --git a/src/engine/abstract/geary-abstract-account.vala b/src/engine/abstract/geary-abstract-account.vala
index 4d3dff1..920a268 100644
--- a/src/engine/abstract/geary-abstract-account.vala
+++ b/src/engine/abstract/geary-abstract-account.vala
@@ -11,11 +11,14 @@ public abstract class Geary.AbstractAccount : BaseObject, Geary.Account {
     public Geary.ProgressMonitor opening_monitor { get; protected set; }
     public Geary.ProgressMonitor sending_monitor { get; protected set; }
     
+    public virtual bool can_support_archive { get; protected set; }
+    
     private string name;
     
-    public AbstractAccount(string name, AccountInformation information) {
+    public AbstractAccount(string name, AccountInformation information, bool can_support_archive) {
         this.name = name;
         this.information = information;
+        this.can_support_archive = can_support_archive;
     }
     
     protected virtual void notify_folders_available_unavailable(Gee.List<Geary.Folder>? available,
@@ -81,8 +84,6 @@ public abstract class Geary.AbstractAccount : BaseObject, Geary.Account {
     
     public abstract bool is_open();
     
-    public abstract bool can_support_archive();
-    
     public abstract async void rebuild_async(Cancellable? cancellable = null) throws Error;
     
     public abstract Gee.Collection<Geary.Folder> list_matching_folders(
@@ -95,8 +96,6 @@ public abstract class Geary.AbstractAccount : BaseObject, Geary.Account {
     public abstract async bool folder_exists_async(Geary.FolderPath path, Cancellable? cancellable = null)
         throws Error;
     
-    public abstract bool folder_is_local_only(Geary.FolderPath path) throws Error;
-    
     public abstract async Geary.Folder fetch_folder_async(Geary.FolderPath path,
         Cancellable? cancellable = null) throws Error;
     
diff --git a/src/engine/api/geary-account.vala b/src/engine/api/geary-account.vala
index 1c9232e..3c83947 100644
--- a/src/engine/api/geary-account.vala
+++ b/src/engine/api/geary-account.vala
@@ -21,6 +21,14 @@ public interface Geary.Account : BaseObject {
     public abstract Geary.ProgressMonitor opening_monitor { get; protected set; }
     public abstract Geary.ProgressMonitor sending_monitor { get; protected set; }
     
+    /**
+     * HACK: for now, only certain account types support folders with
+     * FolderSupport.Archive.  It's useful to know whether an account supports
+     * archive because the button is hidden for accounts that will never
+     * support it.
+     */
+    public abstract bool can_support_archive { get; protected set; }
+    
     public signal void opened();
     
     public signal void closed();
@@ -205,14 +213,6 @@ public interface Geary.Account : BaseObject {
     public abstract bool is_open();
     
     /**
-     * HACK: for now, only certain account types support folders with
-     * FolderSupport.Archive.  It's useful to know whether an account supports
-     * archive because the button is hidden for accounts that will never
-     * support it.
-     */
-    public abstract bool can_support_archive();
-    
-    /**
      * Rebuild the local data stores for this { link Account}.
      *
      * This should only be used if { link open_async} throws { link EngineError.CORRUPTION},
@@ -261,11 +261,6 @@ public interface Geary.Account : BaseObject {
         throws Error;
     
     /**
-     * Returns true if the given folder path exists locally but not on the server.
-     */
-    public abstract bool folder_is_local_only(Geary.FolderPath path) throws Error;
-    
-    /**
      * Fetches a Folder object corresponding to the supplied path.  If the backing medium does
      * not have a record of a folder at the path, EngineError.NOT_FOUND will be thrown.
      *
diff --git a/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala 
b/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
index 5324507..bf1e159 100644
--- a/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
+++ b/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
@@ -38,7 +38,7 @@ private class Geary.ImapEngine.GmailAccount : Geary.ImapEngine.GenericAccount {
     
     public GmailAccount(string name, Geary.AccountInformation account_information,
         Imap.Account remote, ImapDB.Account local) {
-        base (name, account_information, remote, local);
+        base (name, account_information, true, remote, local);
         
         if (path_type_map == null) {
             path_type_map = new Gee.HashMap<Geary.FolderPath, Geary.SpecialFolderType>();
@@ -71,10 +71,6 @@ private class Geary.ImapEngine.GmailAccount : Geary.ImapEngine.GenericAccount {
         }
     }
     
-    protected override bool can_support_archive() {
-        return true;
-    }
-    
     protected override GenericFolder new_folder(Geary.FolderPath path, Imap.Account remote_account,
         ImapDB.Account local_account, ImapDB.Folder local_folder) {
         // although Gmail supports XLIST, this will be called on startup if the XLIST properties
diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala 
b/src/engine/imap-engine/imap-engine-generic-account.vala
index 80a7838..2fce9e5 100644
--- a/src/engine/imap-engine/imap-engine-generic-account.vala
+++ b/src/engine/imap-engine/imap-engine-generic-account.vala
@@ -21,9 +21,9 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.AbstractAccount {
     private Cancellable refresh_cancellable = new Cancellable();
     private bool awaiting_credentials = false;
     
-    public GenericAccount(string name, Geary.AccountInformation information, Imap.Account remote,
-        ImapDB.Account local) {
-        base (name, information);
+    public GenericAccount(string name, Geary.AccountInformation information, bool can_support_archive,
+        Imap.Account remote, ImapDB.Account local) {
+        base (name, information, can_support_archive);
         
         this.remote = remote;
         this.local = local;
@@ -169,10 +169,6 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.AbstractAccount {
         return open;
     }
     
-    public override bool can_support_archive() {
-        return false;
-    }
-    
     public override async void rebuild_async(Cancellable? cancellable = null) throws Error {
         if (open)
             throw new EngineError.ALREADY_OPEN("Account cannot be open during rebuild");
@@ -385,11 +381,6 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.AbstractAccount {
         return local.contact_store;
     }
     
-    public override bool folder_is_local_only(Geary.FolderPath path) throws Error {
-        check_open();
-        return (path in local_only.keys);
-    }
-    
     public override async bool folder_exists_async(Geary.FolderPath path,
         Cancellable? cancellable = null) throws Error {
         check_open();
diff --git a/src/engine/imap-engine/other/imap-engine-other-account.vala 
b/src/engine/imap-engine/other/imap-engine-other-account.vala
index 2be84e1..52d1f25 100644
--- a/src/engine/imap-engine/other/imap-engine-other-account.vala
+++ b/src/engine/imap-engine/other/imap-engine-other-account.vala
@@ -7,7 +7,7 @@
 private class Geary.ImapEngine.OtherAccount : Geary.ImapEngine.GenericAccount {
     public OtherAccount(string name, AccountInformation account_information,
         Imap.Account remote, ImapDB.Account local) {
-        base (name, account_information, remote, local);
+        base (name, account_information, false, remote, local);
     }
     
     protected override GenericFolder new_folder(Geary.FolderPath path, Imap.Account remote_account,
diff --git a/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala 
b/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
index 5ae1baa..4007f10 100644
--- a/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
+++ b/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
@@ -33,7 +33,7 @@ private class Geary.ImapEngine.OutlookAccount : Geary.ImapEngine.GenericAccount
     
     public OutlookAccount(string name, AccountInformation account_information, Imap.Account remote,
         ImapDB.Account local) {
-        base (name, account_information, remote, local);
+        base (name, account_information, false, remote, local);
     }
     
     protected override GenericFolder new_folder(Geary.FolderPath path, Imap.Account remote_account,
diff --git a/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala 
b/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
index 655103a..6b2b86e 100644
--- a/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
+++ b/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
@@ -35,7 +35,7 @@ private class Geary.ImapEngine.YahooAccount : Geary.ImapEngine.GenericAccount {
     
     public YahooAccount(string name, AccountInformation account_information,
         Imap.Account remote, ImapDB.Account local) {
-        base (name, account_information, remote, local);
+        base (name, account_information, false, remote, local);
         
         if (special_map == null) {
             special_map = new Gee.HashMap<Geary.FolderPath, Geary.SpecialFolderType>();


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