[geary] Don't launch multiple list ops when changing folders: Bug #712977
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Don't launch multiple list ops when changing folders: Bug #712977
- Date: Thu, 22 Jan 2015 00:31:46 +0000 (UTC)
commit cec8b3f350c34da8c104ce25de9578a631ad3ec1
Author: Jim Nelson <jim yorba org>
Date: Wed Jan 21 16:30:25 2015 -0800
Don't launch multiple list ops when changing folders: Bug #712977
Clearing the ConversationListStore caused multiple selection-changed
notifications to the ConversationListView, whose signals in turn
caused I/O in the GearyController. This stops that process in its
tracks.
.../conversation-list/conversation-list-store.vala | 5 +++++
.../conversation-list/conversation-list-view.vala | 13 +++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/client/conversation-list/conversation-list-store.vala
b/src/client/conversation-list/conversation-list-store.vala
index 2444f7c..179937b 100644
--- a/src/client/conversation-list/conversation-list-store.vala
+++ b/src/client/conversation-list/conversation-list-store.vala
@@ -38,6 +38,7 @@ public class ConversationListStore : Gtk.ListStore {
public string? account_owner_email { get; set; default = null; }
public Geary.ProgressMonitor preview_monitor { get; private set; default =
new Geary.SimpleProgressMonitor(Geary.ProgressType.ACTIVITY); }
+ public bool is_clearing { get; private set; default = false; }
private Geary.App.ConversationMonitor conversation_monitor;
private Geary.Folder? current_folder = null;
@@ -70,6 +71,8 @@ public class ConversationListStore : Gtk.ListStore {
}
private void on_conversation_monitor_changed() {
+ is_clearing = true;
+
if (conversation_monitor != null) {
conversation_monitor.scan_completed.disconnect(on_scan_completed);
conversation_monitor.conversations_added.disconnect(on_conversations_added);
@@ -93,6 +96,8 @@ public class ConversationListStore : Gtk.ListStore {
conversation_monitor.conversation_trimmed.connect(on_conversation_trimmed);
conversation_monitor.email_flags_changed.connect(on_email_flags_changed);
}
+
+ is_clearing = false;
}
public void set_current_folder(Geary.Folder? current_folder, Cancellable? cancellable_folder) {
diff --git a/src/client/conversation-list/conversation-list-view.vala
b/src/client/conversation-list/conversation-list-view.vala
index bdc1370..08cf5f1 100644
--- a/src/client/conversation-list/conversation-list-view.vala
+++ b/src/client/conversation-list/conversation-list-view.vala
@@ -314,6 +314,19 @@ public class ConversationListView : Gtk.TreeView {
// Gtk.TreeSelection can fire its "changed" signal even when nothing's changed, so look for that
// and prevent to avoid subscribers from doing the same things multiple times
private void on_selection_changed() {
+ // if the ConversationListStore is clearing, then this is called repeatedly as the elements
+ // are removed, causing signals to fire and a flurry of I/O that is immediately cancelled
+ // this prevents that, merely firing the signal once to indicate all selections are
+ // dropped while clearing
+ if (conversation_list_store.is_clearing) {
+ if (selected.size > 0) {
+ selected.clear();
+ conversations_selected(selected.read_only_view);
+ }
+
+ return;
+ }
+
List<Gtk.TreePath> paths = get_all_selected_paths();
if (paths.length() == 0) {
// only notify if this is different than what was previously reported
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]