~hkdb/geary/disco

« back to all changes in this revision

Viewing changes to src/client/composer/contact-list-store-cache.vala

  • Committer: hkdb
  • Date: 2019-09-26 19:40:48 UTC
  • Revision ID: hkdb@3df.io-20190926194048-n0vggm3yfo8p1ubr
Tags: upstream-3.32.2-disco
ImportĀ upstreamĀ versionĀ 3.32.2-disco

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright 2016 Software Freedom Conservancy Inc.
 
2
 *
 
3
 * This software is licensed under the GNU Lesser General Public License
 
4
 * (version 2.1 or later).  See the COPYING file in this distribution.
 
5
 */
 
6
 
 
7
public class ContactListStoreCache {
 
8
 
 
9
    private Gee.HashMap<Geary.ContactStore, ContactListStore> cache =
 
10
        new Gee.HashMap<Geary.ContactStore, ContactListStore>();
 
11
 
 
12
    public ContactListStore create(Geary.ContactStore contact_store) {
 
13
        ContactListStore list_store = new ContactListStore(contact_store);
 
14
 
 
15
        this.cache.set(contact_store, list_store);
 
16
 
 
17
        list_store.load.begin();
 
18
 
 
19
        return list_store;
 
20
    }
 
21
 
 
22
    public ContactListStore? get(Geary.ContactStore contact_store) {
 
23
        return this.cache.get(contact_store);
 
24
    }
 
25
 
 
26
    public void unset(Geary.ContactStore contact_store) {
 
27
        this.cache.unset(contact_store);
 
28
    }
 
29
}