diff --git a/src/ConversationList/ConversationList.vala b/src/ConversationList/ConversationList.vala index 9536267c6..ede996623 100644 --- a/src/ConversationList/ConversationList.vala +++ b/src/ConversationList/ConversationList.vala @@ -247,6 +247,9 @@ public class Mail.ConversationList : Gtk.Box { cancellable.cancel (); } + var cancellable = new GLib.Cancellable (); + this.cancellable = cancellable; + conversation_focused (null); conversation_selected (null); @@ -261,8 +264,6 @@ public class Mail.ConversationList : Gtk.Box { list_store.remove_all (); list_store.items_changed (0, previous_items, 0); - cancellable = new GLib.Cancellable (); - lock (this.folder_full_name_per_account) { foreach (var folder_full_name_entry in this.folder_full_name_per_account) { var current_account = folder_full_name_entry.key; @@ -311,14 +312,21 @@ public class Mail.ConversationList : Gtk.Box { } list_store.items_changed (0, 0, list_store.get_n_items ()); + refresh_folder.begin (cancellable); } public async void refresh_folder (GLib.Cancellable? cancellable = null) { + if (cancellable != null && cancellable.is_cancelled ()) { + return; + } + refresh_stack.set_visible_child_name ("spinner"); lock (folders) { foreach (var folder in folders.values) { try { yield folder.refresh_info (GLib.Priority.DEFAULT, cancellable); + } catch (IOError.CANCELLED e) { + break; } catch (Error e) { warning ("Error fetching messages for '%s' from '%s': %s", folder.display_name,