[geary/mjog/account-command-stacks: 6/27] ConversationList: Minor selection-related perf tweak
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/account-command-stacks: 6/27] ConversationList: Minor selection-related perf tweak
- Date: Sat, 26 Oct 2019 05:34:44 +0000 (UTC)
commit afd2634d4bf5894fa56357b2b93b202d1d5ec230
Author: Michael Gratton <mike vee net>
Date: Sat Oct 5 19:12:13 2019 +1000
ConversationList: Minor selection-related perf tweak
Return a RO view of the existing selection object from
ConversationListView::get_selected_conversations.
.../conversation-list/conversation-list-view.vala | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/src/client/conversation-list/conversation-list-view.vala
b/src/client/conversation-list/conversation-list-view.vala
index 4ab74dad..39a503d9 100644
--- a/src/client/conversation-list/conversation-list-view.vala
+++ b/src/client/conversation-list/conversation-list-view.vala
@@ -122,6 +122,11 @@ public class ConversationListView : Gtk.TreeView, Geary.BaseInterface {
selection.changed.connect(on_selection_changed);
}
+ /** Returns a read-only collection of the current selection. */
+ public Gee.Set<Geary.App.Conversation> get_selected_conversations() {
+ return this.selected.read_only_view;
+ }
+
public void scroll(Gtk.ScrollType where) {
Gtk.TreeSelection selection = get_selection();
weak Gtk.TreeModel model;
@@ -484,18 +489,6 @@ public class ConversationListView : Gtk.TreeView, Geary.BaseInterface {
return visible_conversations;
}
- public Gee.Set<Geary.App.Conversation> get_selected_conversations() {
- Gee.HashSet<Geary.App.Conversation> selected_conversations = new
Gee.HashSet<Geary.App.Conversation>();
-
- foreach (Gtk.TreePath path in get_all_selected_paths()) {
- Geary.App.Conversation? conversation = get_model().get_conversation_at_path(path);
- if (path != null)
- selected_conversations.add(conversation);
- }
-
- return selected_conversations;
- }
-
// Always returns false, so it can be used as a one-time SourceFunc
private bool update_visible_conversations() {
Gee.Set<Geary.App.Conversation> visible_conversations = get_visible_conversations();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]