summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2020-09-19 18:58:47 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2020-09-19 18:58:47 -0400
commit83b480742b46f120b73042791e2f91c70ce3fe84 (patch)
tree31165ded8fc274cfa6de12b2dcc51066c98e389b /components
parent72d0a0d2a098d9f75291bdad73d02d3601c82945 (diff)
downloadabaddon-portaudio-83b480742b46f120b73042791e2f91c70ce3fe84.tar.gz
abaddon-portaudio-83b480742b46f120b73042791e2f91c70ce3fe84.zip
guild icons
Diffstat (limited to 'components')
-rw-r--r--components/channels.cpp16
-rw-r--r--components/channels.hpp1
2 files changed, 17 insertions, 0 deletions
diff --git a/components/channels.cpp b/components/channels.cpp
index 227d791..db6beb1 100644
--- a/components/channels.cpp
+++ b/components/channels.cpp
@@ -3,6 +3,7 @@
#include <map>
#include <unordered_map>
#include "../abaddon.hpp"
+#include "../imgmanager.hpp"
ChannelListRow::type_signal_list_collapse ChannelListRow::signal_list_collapse() {
return m_signal_list_collapse;
@@ -57,12 +58,27 @@ ChannelListRowGuild::ChannelListRowGuild(const Guild *data) {
m_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
m_lbl = Gtk::manage(new Gtk::Label);
+ auto buf = Abaddon::Get().GetImageManager().GetFromURLIfCached(data->GetIconURL("png", "32"));
+ if (buf)
+ m_icon = Gtk::manage(new Gtk::Image(buf));
+ else {
+ m_icon = Gtk::manage(new Gtk::Image(Abaddon::Get().GetImageManager().GetPlaceholder(24)));
+ Abaddon::Get().GetImageManager().LoadFromURL(data->GetIconURL("png", "32"), [this](Glib::RefPtr<Gdk::Pixbuf> ldbuf) {
+ Glib::signal_idle().connect([this, ldbuf]() -> bool {
+ m_icon->property_pixbuf() = ldbuf->scale_simple(24, 24, Gdk::INTERP_BILINEAR);
+
+ return false;
+ });
+ });
+ }
+
get_style_context()->add_class("channel-row");
get_style_context()->add_class("channel-row-guild");
m_lbl->get_style_context()->add_class("channel-row-label");
m_lbl->set_markup("<b>" + Glib::Markup::escape_text(data->Name) + "</b>");
m_box->set_halign(Gtk::ALIGN_START);
+ m_box->pack_start(*m_icon);
m_box->pack_start(*m_lbl);
m_ev->add(*m_box);
add(*m_ev);
diff --git a/components/channels.hpp b/components/channels.hpp
index a771933..f898df7 100644
--- a/components/channels.hpp
+++ b/components/channels.hpp
@@ -55,6 +55,7 @@ protected:
Gtk::EventBox *m_ev;
Gtk::Box *m_box;
Gtk::Label *m_lbl;
+ Gtk::Image *m_icon;
};
class ChannelListRowCategory : public ChannelListRow {