From 204ca8006aa29e0cb01c4e3c0ab5826cf4607ae9 Mon Sep 17 00:00:00 2001 From: Robert Schroll Date: Thu, 9 May 2013 15:30:37 -0700 Subject: [PATCH] Load all contacts into ContactStore: Closes #6921 All contacts are now loaded into the ContactStore, leaving it to the application (i.e. client) to decide what to display and what not to display. This moves that responsibility into the composer's autocompletion logic. This leaves the door open for other contact-related code (i.e. contact list regardless of their importance. --- src/client/composer/contact-entry-completion.vala | 6 ++++++ src/engine/api/geary-contact-importance.vala | 5 +---- src/engine/imap-db/imap-db-account.vala | 3 +-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/client/composer/contact-entry-completion.vala b/src/client/composer/contact-entry-completion.vala index 14d12de4..c9c7a7fc 100644 --- a/src/client/composer/contact-entry-completion.vala +++ b/src/client/composer/contact-entry-completion.vala @@ -8,6 +8,9 @@ public class ContactEntryCompletion : Gtk.EntryCompletion { // Sort column indices. private const int SORT_COLUMN = 0; + // Minimum visibility for the contact to appear in autocompletion. + private const Geary.ContactImportance CONTACT_VISIBILITY_THRESHOLD = Geary.ContactImportance.TO_TO; + private Gtk.ListStore list_store; private Gtk.TreeIter? last_iter = null; @@ -53,6 +56,9 @@ public class ContactEntryCompletion : Gtk.EntryCompletion { } private void add_contact(Geary.Contact contact) { + if (contact.highest_importance < CONTACT_VISIBILITY_THRESHOLD) + return; + string full_address = contact.get_rfc822_address().get_full_address(); Gtk.TreeIter iter; list_store.append(out iter); diff --git a/src/engine/api/geary-contact-importance.vala b/src/engine/api/geary-contact-importance.vala index d985e825..b3212597 100644 --- a/src/engine/api/geary-contact-importance.vala +++ b/src/engine/api/geary-contact-importance.vala @@ -31,8 +31,5 @@ public enum Geary.ContactImportance { TO_CC = 50, CC_FROM = 40, CC_TO = 30, - CC_CC = 20, - - // Minimum visibility for the contact to appear in autocompletion. - VISIBILITY_THRESHOLD = TO_TO; + CC_CC = 20 } diff --git a/src/engine/imap-db/imap-db-account.vala b/src/engine/imap-db/imap-db-account.vala index f7f5016a..3ddcd9d0 100644 --- a/src/engine/imap-db/imap-db-account.vala +++ b/src/engine/imap-db/imap-db-account.vala @@ -201,8 +201,7 @@ private class Geary.ImapDB.Account : BaseObject { (context) => { Db.Statement statement = context.prepare( "SELECT email, real_name, highest_importance, normalized_email " + - "FROM ContactTable WHERE highest_importance >= ?"); - statement.bind_int(0, ContactImportance.VISIBILITY_THRESHOLD); + "FROM ContactTable"); Db.Result result = statement.exec(cancellable); while (!result.finished) {