use discord's default avatars instead of placeholder

This commit is contained in:
ouwou
2021-04-07 20:42:53 -04:00
parent 0faff42e17
commit 1251d89ef0
9 changed files with 54 additions and 67 deletions

View File

@@ -1042,13 +1042,11 @@ ChatMessageHeader::ChatMessageHeader(const Message *data) {
auto &img = Abaddon::Get().GetImageManager();
m_avatar = Gtk::manage(new Gtk::Image(img.GetPlaceholder(AvatarSize)));
if (author->HasAvatar()) {
auto cb = [this](const Glib::RefPtr<Gdk::Pixbuf> &pb) {
m_static_avatar = pb->scale_simple(AvatarSize, AvatarSize, Gdk::INTERP_BILINEAR);
m_avatar->property_pixbuf() = m_static_avatar;
};
img.LoadFromURL(author->GetAvatarURL(), sigc::track_obj(cb, *this));
}
auto cb = [this](const Glib::RefPtr<Gdk::Pixbuf> &pb) {
m_static_avatar = pb->scale_simple(AvatarSize, AvatarSize, Gdk::INTERP_BILINEAR);
m_avatar->property_pixbuf() = m_static_avatar;
};
img.LoadFromURL(author->GetAvatarURL(), sigc::track_obj(cb, *this));
if (author->HasAnimatedAvatar()) {
auto cb = [this](const Glib::RefPtr<Gdk::PixbufAnimation> &pb) {