[geary] Fix a few warnings when switching between folders quickly



commit 3a120f1130b38817f07e86d59b9450af9f7481f1
Author: Michael Gratton <mike vee net>
Date:   Fri Feb 8 11:25:45 2019 +1100

    Fix a few warnings when switching between folders quickly

 src/client/conversation-list/conversation-list-store.vala | 11 +++++++----
 src/client/conversation-viewer/conversation-email.vala    |  6 ++++++
 2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/client/conversation-list/conversation-list-store.vala 
b/src/client/conversation-list/conversation-list-store.vala
index 44ce84bf..c8f37c04 100644
--- a/src/client/conversation-list/conversation-list-store.vala
+++ b/src/client/conversation-list/conversation-list-store.vala
@@ -208,10 +208,13 @@ public class ConversationListStore : Gtk.ListStore {
         try {
             emails = yield email_store.list_email_by_sparse_id_async(emails_needing_previews,
                 ConversationListStore.WITH_PREVIEW_FIELDS, flags, cancellable);
-        } catch (Error err) {
-            // Ignore NOT_FOUND, as that's entirely possible when waiting for the remote to open
-            if (!(err is Geary.EngineError.NOT_FOUND))
-                warning("Unable to fetch preview: %s", err.message);
+        } catch (GLib.IOError.CANCELLED err) {
+            // All good
+        } catch (Geary.EngineError.NOT_FOUND err) {
+            // All good also, as that's entirely possible when waiting
+            // for the remote to open
+        } catch (GLib.Error err) {
+            warning("Unable to fetch preview: %s", err.message);
         }
 
         return emails ?? new Gee.ArrayList<Geary.Email>();
diff --git a/src/client/conversation-viewer/conversation-email.vala 
b/src/client/conversation-viewer/conversation-email.vala
index 27600ae7..6ab8311a 100644
--- a/src/client/conversation-viewer/conversation-email.vala
+++ b/src/client/conversation-viewer/conversation-email.vala
@@ -550,6 +550,8 @@ public class ConversationEmail : Gtk.Box, Geary.BaseInterface {
             on_service_status_change
         );
 
+        this.load_cancellable.cancelled.connect(on_load_cancelled);
+
         this.body_loading_timeout = new Geary.TimeoutManager.milliseconds(
             BODY_LOAD_TIMEOUT_MSEC, this.on_body_loading_timeout
         );
@@ -1014,6 +1016,10 @@ public class ConversationEmail : Gtk.Box, Geary.BaseInterface {
         this.primary_message.show_loading_pane();
     }
 
+    private void on_load_cancelled() {
+        this.body_loading_timeout.reset();
+    }
+
     private void on_flag_remote_images(ConversationMessage view) {
         // XXX check we aren't already auto loading the image
         mark_email(Geary.EmailFlags.LOAD_REMOTE_IMAGES, null);


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