diff options
| author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-11-28 22:48:30 -0500 |
|---|---|---|
| committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-11-28 22:48:30 -0500 |
| commit | e1703aea3fd597b23bde90e6c505278c517be611 (patch) | |
| tree | 37d98fc90c9cd0844388bfb79beda2204f44af92 /windows/profile/mutualfriendspane.cpp | |
| parent | fd53a76bf6f53a095a639765923a30f2206b2cd6 (diff) | |
| parent | e02107feea8214a045e6faa969f00dcbc0d2b072 (diff) | |
| download | abaddon-portaudio-e1703aea3fd597b23bde90e6c505278c517be611.tar.gz abaddon-portaudio-e1703aea3fd597b23bde90e6c505278c517be611.zip | |
merge master
Diffstat (limited to 'windows/profile/mutualfriendspane.cpp')
| -rw-r--r-- | windows/profile/mutualfriendspane.cpp | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/windows/profile/mutualfriendspane.cpp b/windows/profile/mutualfriendspane.cpp deleted file mode 100644 index 5e6120a..0000000 --- a/windows/profile/mutualfriendspane.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "mutualfriendspane.hpp" -#include "../../abaddon.hpp" - -MutualFriendItem::MutualFriendItem(const UserData &user) - : Gtk::Box(Gtk::ORIENTATION_HORIZONTAL) { - get_style_context()->add_class("mutual-friend-item"); - m_name.get_style_context()->add_class("mutual-friend-item-name"); - m_avatar.get_style_context()->add_class("mutual-friend-item-avatar"); - - m_avatar.set_margin_end(10); - - const auto show_animations = Abaddon::Get().GetSettings().GetShowAnimations(); - auto &img = Abaddon::Get().GetImageManager(); - m_avatar.property_pixbuf() = img.GetPlaceholder(24); - if (user.HasAnimatedAvatar() && show_animations) { - auto cb = [this](const Glib::RefPtr<Gdk::PixbufAnimation> &pb) { - m_avatar.property_pixbuf_animation() = pb; - }; - img.LoadAnimationFromURL(user.GetAvatarURL("gif", "32"), 24, 24, sigc::track_obj(cb, *this)); - } else { - auto cb = [this](const Glib::RefPtr<Gdk::Pixbuf> &pb) { - m_avatar.property_pixbuf() = pb->scale_simple(24, 24, Gdk::INTERP_BILINEAR); - }; - img.LoadFromURL(user.GetAvatarURL("png", "32"), sigc::track_obj(cb, *this)); - } - - m_name.set_markup(user.GetEscapedBoldString<false>()); - - m_name.set_valign(Gtk::ALIGN_CENTER); - add(m_avatar); - add(m_name); - show_all_children(); -} - -MutualFriendsPane::MutualFriendsPane(Snowflake id) - : UserID(id) { - signal_map().connect(sigc::mem_fun(*this, &MutualFriendsPane::OnMap)); - add(m_list); - show_all_children(); -} - -void MutualFriendsPane::OnFetchRelationships(const std::vector<UserData> &users) { - for (auto child : m_list.get_children()) - delete child; - - for (const auto &user : users) { - auto *item = Gtk::manage(new MutualFriendItem(user)); - item->show(); - m_list.add(*item); - } -} - -void MutualFriendsPane::OnMap() { - if (m_requested) return; - m_requested = true; - - Abaddon::Get().GetDiscordClient().FetchUserRelationships(UserID, sigc::mem_fun(*this, &MutualFriendsPane::OnFetchRelationships)); -} |
