summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2021-07-04 02:21:32 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2021-07-04 02:21:32 -0400
commitc154a63967264c5a22e5b4e4d4e7dfd83e265b9c (patch)
treef2868ab8ec04ed65cc5c7c38436af7dd99a17432 /components
parent4102db1eb9027e6d41f00893a5f4a5b3215ac07a (diff)
downloadabaddon-portaudio-c154a63967264c5a22e5b4e4d4e7dfd83e265b9c.tar.gz
abaddon-portaudio-c154a63967264c5a22e5b4e4d4e7dfd83e265b9c.zip
update guild
Diffstat (limited to 'components')
-rw-r--r--components/channels.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/components/channels.cpp b/components/channels.cpp
index 80c321c..5746259 100644
--- a/components/channels.cpp
+++ b/components/channels.cpp
@@ -159,6 +159,22 @@ void ChannelList::UpdateCreateChannel(Snowflake id) {
}
void ChannelList::UpdateGuild(Snowflake id) {
+ auto iter = GetIteratorForGuildFromID(id);
+ auto &img = Abaddon::Get().GetImageManager();
+ const auto guild = Abaddon::Get().GetDiscordClient().GetGuild(id);
+ if (!iter || !guild.has_value()) return;
+
+ (*iter)[m_columns.m_name] = "<b>" + Glib::Markup::escape_text(guild->Name) + "</b>";
+ (*iter)[m_columns.m_icon] = img.GetPlaceholder(24);
+ if (guild->HasIcon()) {
+ const auto cb = [this, id](const Glib::RefPtr<Gdk::Pixbuf> &pb) {
+ // iter might be invalid
+ auto iter = GetIteratorForGuildFromID(id);
+ if (iter)
+ (*iter)[m_columns.m_icon] = pb->scale_simple(24, 24, Gdk::INTERP_BILINEAR);
+ };
+ img.LoadFromURL(guild->GetIconURL("png", "32"), sigc::track_obj(cb, *this));
+ }
}
void ChannelList::SetActiveChannel(Snowflake id) {