[geary/wip/composer-folks: 5/22] Clean up contact importance API



commit 5ab35da47b280859f5403772a6e1caf725f60e1c
Author: Michael Gratton <mike vee net>
Date:   Sun Jun 9 22:21:08 2019 +1000

    Clean up contact importance API
    
    Move Importance enum into Contact since it's only used there, simplify
    members and clean up call sites.

 po/POTFILES.in                               |  1 -
 src/client/composer/contact-list-store.vala  |  5 ++--
 src/engine/api/geary-contact-importance.vala | 35 ----------------------------
 src/engine/api/geary-contact.vala            | 16 +++++++++++--
 src/engine/meson.build                       |  1 -
 5 files changed, 17 insertions(+), 41 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index dd26b805..84efca9a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -111,7 +111,6 @@ src/engine/api/geary-attachment.vala
 src/engine/api/geary-base-object.vala
 src/engine/api/geary-client-service.vala
 src/engine/api/geary-composed-email.vala
-src/engine/api/geary-contact-importance.vala
 src/engine/api/geary-contact-store.vala
 src/engine/api/geary-contact.vala
 src/engine/api/geary-credentials-mediator.vala
diff --git a/src/client/composer/contact-list-store.vala b/src/client/composer/contact-list-store.vala
index d1d83a2e..c30c08a1 100644
--- a/src/client/composer/contact-list-store.vala
+++ b/src/client/composer/contact-list-store.vala
@@ -7,7 +7,8 @@
 public class ContactListStore : Gtk.ListStore, Geary.BaseInterface {
 
     // Minimum visibility for the contact to appear in autocompletion.
-    private const Geary.ContactImportance CONTACT_VISIBILITY_THRESHOLD = Geary.ContactImportance.TO_TO;
+    private const Geary.Contact.Importance VISIBILITY_THRESHOLD =
+        Geary.Contact.Importance.RECEIVED_FROM;
 
     // Batch size for loading contacts asynchronously
     private uint LOAD_BATCH_SIZE = 4096;
@@ -112,7 +113,7 @@ public class ContactListStore : Gtk.ListStore, Geary.BaseInterface {
     }
 
     private inline void add_contact(Geary.Contact contact) {
-        if (contact.highest_importance >= CONTACT_VISIBILITY_THRESHOLD) {
+        if (contact.highest_importance >= VISIBILITY_THRESHOLD) {
             Gtk.TreeIter iter;
             append(out iter);
             set(iter,
diff --git a/src/engine/api/geary-contact.vala b/src/engine/api/geary-contact.vala
index a8c031e4..40d9e8fb 100644
--- a/src/engine/api/geary-contact.vala
+++ b/src/engine/api/geary-contact.vala
@@ -1,12 +1,24 @@
-/* Copyright 2016 Software Freedom Conservancy Inc.
+/*
+ * Copyright 2016 Software Freedom Conservancy Inc.
+ * Copyright 2019 Michael Gratton <mike vee net>
  *
  * This software is licensed under the GNU Lesser General Public License
- * (version 2.1 or later).  See the COPYING file in this distribution.
+ * (version 2.1 or later). See the COPYING file in this distribution.
  */
 
 public class Geary.Contact : BaseObject {
 
 
+    /**
+     * Standard values for contact importance..
+     */
+    public enum Importance {
+        DESKTOP = 200,
+        SENT_TO = 100,
+        RECEIVED_FROM = 70,  // Equivalent to old TO_FROM value
+        SEEN = 30 // Equivalent to old CC_TO value
+    }
+
     /**
      * Named flags for contact objects.
      */
diff --git a/src/engine/meson.build b/src/engine/meson.build
index b82d7e01..816a8696 100644
--- a/src/engine/meson.build
+++ b/src/engine/meson.build
@@ -10,7 +10,6 @@ geary_engine_vala_sources = files(
   'api/geary-client-service.vala',
   'api/geary-composed-email.vala',
   'api/geary-contact.vala',
-  'api/geary-contact-importance.vala',
   'api/geary-contact-store.vala',
   'api/geary-credentials.vala',
   'api/geary-credentials-mediator.vala',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]