From 2ddac42575aee5370d01701ce50444713d4d44b9 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Mon, 8 Feb 2021 15:57:55 -0500 Subject: show mutual friends --- windows/profilewindow.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'windows/profilewindow.cpp') diff --git a/windows/profilewindow.cpp b/windows/profilewindow.cpp index 2599065..332652b 100644 --- a/windows/profilewindow.cpp +++ b/windows/profilewindow.cpp @@ -7,11 +7,13 @@ ProfileWindow::ProfileWindow(Snowflake user_id) , m_upper(Gtk::ORIENTATION_HORIZONTAL) , m_badges(Gtk::ORIENTATION_HORIZONTAL) , m_pane_info(user_id) - , m_pane_guilds(user_id) { - const auto &discord = Abaddon::Get().GetDiscordClient(); + , m_pane_guilds(user_id) + , m_pane_friends(user_id) { + auto &discord = Abaddon::Get().GetDiscordClient(); auto user = *discord.GetUser(ID); - Abaddon::Get().GetDiscordClient().FetchUserProfile(user_id, sigc::mem_fun(*this, &ProfileWindow::OnFetchProfile)); + discord.FetchUserProfile(user_id, sigc::mem_fun(*this, &ProfileWindow::OnFetchProfile)); + discord.FetchUserRelationships(user_id, sigc::mem_fun(*this, &ProfileWindow::OnFetchRelationships)); set_name("user-profile"); set_default_size(450, 375); @@ -72,6 +74,7 @@ ProfileWindow::ProfileWindow(Snowflake user_id) m_stack.add(m_pane_info, "info", "User Info"); m_stack.add(m_pane_guilds, "guilds", "Mutual Servers"); + m_stack.add(m_pane_friends, "friends", "Mutual Friends"); m_badges.set_valign(Gtk::ALIGN_CENTER); m_badges_scroll.set_hexpand(true); @@ -126,3 +129,7 @@ void ProfileWindow::OnFetchProfile(const UserProfileData &data) { m_badges.add(*image); } } + +void ProfileWindow::OnFetchRelationships(const std::vector &data) { + m_pane_friends.SetMutualFriends(data); +} -- cgit v1.2.3