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) {