[geary/mjog/notfication-avatars: 1/6] Application.Contact: Add method to access avatars
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/notfication-avatars: 1/6] Application.Contact: Add method to access avatars
- Date: Sat, 21 Mar 2020 22:00:59 +0000 (UTC)
commit 21fb82fd2a8698c27dc9c154e4b9a1f901ee8a5e
Author: Michael Gratton <mike vee net>
Date: Thu Mar 12 10:13:02 2020 +1100
Application.Contact: Add method to access avatars
Allows access to avatars without requiring access to the store.
src/client/application/application-contact-store.vala | 5 ++++-
src/client/application/application-contact.vala | 15 +++++++++++++++
src/client/application/application-controller.vala | 2 +-
3 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/src/client/application/application-contact-store.vala
b/src/client/application/application-contact-store.vala
index bbb4db22..e5f03219 100644
--- a/src/client/application/application-contact-store.vala
+++ b/src/client/application/application-contact-store.vala
@@ -44,6 +44,7 @@ public class Application.ContactStore : Geary.BaseObject {
public Geary.Account account { get; private set; }
internal Folks.IndividualAggregator individuals;
+ internal AvatarStore avatars;
// Cache for storing Folks individuals by email address. Store
// nulls so that negative lookups are cached as well.
@@ -61,12 +62,14 @@ public class Application.ContactStore : Geary.BaseObject {
/** Constructs a new contact store for an account. */
public ContactStore(Geary.Account account,
- Folks.IndividualAggregator individuals) {
+ Folks.IndividualAggregator individuals,
+ AvatarStore avatars) {
this.account = account;
this.individuals = individuals;
this.individuals.individuals_changed_detailed.connect(
on_individuals_changed
);
+ this.avatars = avatars;
}
~ContactStore() {
diff --git a/src/client/application/application-contact.vala b/src/client/application/application-contact.vala
index 6b7d2d89..7f9a7cc5 100644
--- a/src/client/application/application-contact.vala
+++ b/src/client/application/application-contact.vala
@@ -265,6 +265,21 @@ public class Application.Contact : Geary.BaseObject {
);
}
+ /** Returns the avatar for this contact. */
+ public async Gdk.Pixbuf? load_avatar(Geary.RFC822.MailboxAddress source,
+ int pixel_size,
+ GLib.Cancellable cancellable)
+ throws GLib.Error {
+ Gdk.Pixbuf? avatar = null;
+ ContactStore? store = this.store;
+ if (store != null) {
+ avatar = yield store.avatars.load(
+ this, source, pixel_size, cancellable
+ );
+ }
+ return avatar;
+ }
+
/** Sets remote resource loading for this contact. */
public async void set_remote_resource_loading(bool enabled,
GLib.Cancellable? cancellable)
diff --git a/src/client/application/application-controller.vala
b/src/client/application/application-controller.vala
index b7fb880e..cffee279 100644
--- a/src/client/application/application-controller.vala
+++ b/src/client/application/application-controller.vala
@@ -878,7 +878,7 @@ internal class Application.Controller : Geary.BaseObject {
account,
new Geary.App.SearchFolder(account, account.local_folder_root),
new Geary.App.EmailStore(account),
- new Application.ContactStore(account, this.folks)
+ new Application.ContactStore(account, this.folks, this.avatars)
);
this.accounts.set(account.information, context);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]