cleanup
This commit is contained in:
@@ -62,13 +62,11 @@ ChannelListRowDMChannel::ChannelListRowDMChannel(const ChannelData *data) {
|
|||||||
|
|
||||||
if (data->Type == ChannelType::DM) {
|
if (data->Type == ChannelType::DM) {
|
||||||
if (top_recipient.HasAvatar()) {
|
if (top_recipient.HasAvatar()) {
|
||||||
auto buf = Abaddon::Get().GetImageManager().GetFromURLIfCached(top_recipient.GetAvatarURL("png", "16"));
|
|
||||||
if (buf)
|
|
||||||
m_icon = Gtk::manage(new Gtk::Image(buf));
|
|
||||||
else {
|
|
||||||
m_icon = Gtk::manage(new Gtk::Image(Abaddon::Get().GetImageManager().GetPlaceholder(24)));
|
m_icon = Gtk::manage(new Gtk::Image(Abaddon::Get().GetImageManager().GetPlaceholder(24)));
|
||||||
Abaddon::Get().GetImageManager().LoadFromURL(top_recipient.GetAvatarURL("png", "16"), sigc::mem_fun(*this, &ChannelListRowDMChannel::OnImageLoad));
|
auto cb = [this](const Glib::RefPtr<Gdk::Pixbuf> &pb) {
|
||||||
}
|
m_icon->property_pixbuf() = pb->scale_simple(24, 24, Gdk::INTERP_BILINEAR);
|
||||||
|
};
|
||||||
|
Abaddon::Get().GetImageManager().LoadFromURL(top_recipient.GetAvatarURL("png", "16"), sigc::track_obj(cb, *this));
|
||||||
} else {
|
} else {
|
||||||
m_icon = Gtk::manage(new Gtk::Image(Abaddon::Get().GetImageManager().GetPlaceholder(24)));
|
m_icon = Gtk::manage(new Gtk::Image(Abaddon::Get().GetImageManager().GetPlaceholder(24)));
|
||||||
}
|
}
|
||||||
@@ -90,11 +88,6 @@ ChannelListRowDMChannel::ChannelListRowDMChannel(const ChannelData *data) {
|
|||||||
show_all_children();
|
show_all_children();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelListRowDMChannel::OnImageLoad(Glib::RefPtr<Gdk::Pixbuf> buf) {
|
|
||||||
if (m_icon != nullptr)
|
|
||||||
m_icon->property_pixbuf() = buf->scale_simple(24, 24, Gdk::INTERP_BILINEAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
ChannelListRowGuild::ChannelListRowGuild(const GuildData *data) {
|
ChannelListRowGuild::ChannelListRowGuild(const GuildData *data) {
|
||||||
ID = data->ID;
|
ID = data->ID;
|
||||||
m_ev = Gtk::manage(new Gtk::EventBox);
|
m_ev = Gtk::manage(new Gtk::EventBox);
|
||||||
@@ -129,21 +122,17 @@ ChannelListRowGuild::ChannelListRowGuild(const GuildData *data) {
|
|||||||
auto &img = Abaddon::Get().GetImageManager();
|
auto &img = Abaddon::Get().GetImageManager();
|
||||||
if (data->HasIcon()) {
|
if (data->HasIcon()) {
|
||||||
if (data->HasAnimatedIcon() && show_animations) {
|
if (data->HasAnimatedIcon() && show_animations) {
|
||||||
auto buf = img.GetAnimationFromURLIfCached(data->GetIconURL("gif", "32"), 24, 24);
|
|
||||||
if (buf)
|
|
||||||
m_icon = Gtk::manage(new Gtk::Image(buf));
|
|
||||||
else {
|
|
||||||
m_icon = Gtk::manage(new Gtk::Image(img.GetPlaceholder(24)));
|
m_icon = Gtk::manage(new Gtk::Image(img.GetPlaceholder(24)));
|
||||||
img.LoadAnimationFromURL(data->GetIconURL("gif", "32"), 24, 24, sigc::mem_fun(*this, &ChannelListRowGuild::OnAnimatedImageLoad));
|
auto cb = [this](const Glib::RefPtr<Gdk::PixbufAnimation> &pb) {
|
||||||
}
|
m_icon->property_pixbuf_animation() = pb;
|
||||||
|
};
|
||||||
|
img.LoadAnimationFromURL(data->GetIconURL("gif", "32"), 24, 24, sigc::track_obj(cb, *this));
|
||||||
} else {
|
} else {
|
||||||
auto buf = img.GetFromURLIfCached(data->GetIconURL("png", "32"));
|
|
||||||
if (buf)
|
|
||||||
m_icon = Gtk::manage(new Gtk::Image(buf->scale_simple(24, 24, Gdk::INTERP_BILINEAR)));
|
|
||||||
else {
|
|
||||||
m_icon = Gtk::manage(new Gtk::Image(img.GetPlaceholder(24)));
|
m_icon = Gtk::manage(new Gtk::Image(img.GetPlaceholder(24)));
|
||||||
img.LoadFromURL(data->GetIconURL("png", "32"), sigc::mem_fun(*this, &ChannelListRowGuild::OnImageLoad));
|
auto cb = [this](const Glib::RefPtr<Gdk::Pixbuf> &pb) {
|
||||||
}
|
m_icon->property_pixbuf() = pb->scale_simple(24, 24, Gdk::INTERP_BILINEAR);
|
||||||
|
};
|
||||||
|
img.LoadFromURL(data->GetIconURL("png", "32"), sigc::track_obj(cb, *this));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_icon = Gtk::manage(new Gtk::Image(Abaddon::Get().GetImageManager().GetPlaceholder(24)));
|
m_icon = Gtk::manage(new Gtk::Image(Abaddon::Get().GetImageManager().GetPlaceholder(24)));
|
||||||
@@ -166,14 +155,6 @@ ChannelListRowGuild::ChannelListRowGuild(const GuildData *data) {
|
|||||||
show_all_children();
|
show_all_children();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelListRowGuild::OnImageLoad(const Glib::RefPtr<Gdk::Pixbuf> &buf) {
|
|
||||||
m_icon->property_pixbuf() = buf->scale_simple(24, 24, Gdk::INTERP_BILINEAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChannelListRowGuild::OnAnimatedImageLoad(const Glib::RefPtr<Gdk::PixbufAnimation> &buf) {
|
|
||||||
m_icon->property_pixbuf_animation() = buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
ChannelListRowGuild::type_signal_copy_id ChannelListRowGuild::signal_copy_id() {
|
ChannelListRowGuild::type_signal_copy_id ChannelListRowGuild::signal_copy_id() {
|
||||||
return m_signal_copy_id;
|
return m_signal_copy_id;
|
||||||
}
|
}
|
||||||
@@ -284,8 +265,6 @@ ChannelList::ChannelList() {
|
|||||||
m_main->add(*m_list);
|
m_main->add(*m_list);
|
||||||
m_main->show_all();
|
m_main->show_all();
|
||||||
|
|
||||||
m_update_dispatcher.connect(sigc::mem_fun(*this, &ChannelList::UpdateListingInternal));
|
|
||||||
|
|
||||||
// maybe will regret doing it this way
|
// maybe will regret doing it this way
|
||||||
auto &discord = Abaddon::Get().GetDiscordClient();
|
auto &discord = Abaddon::Get().GetDiscordClient();
|
||||||
auto cb = [this, &discord](Snowflake message_id) {
|
auto cb = [this, &discord](Snowflake message_id) {
|
||||||
@@ -302,11 +281,6 @@ Gtk::Widget *ChannelList::GetRoot() const {
|
|||||||
return m_main;
|
return m_main;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelList::UpdateListing() {
|
|
||||||
//std::scoped_lock<std::mutex> guard(m_update_mutex);
|
|
||||||
m_update_dispatcher.emit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChannelList::UpdateNewGuild(Snowflake id) {
|
void ChannelList::UpdateNewGuild(Snowflake id) {
|
||||||
auto sort = Abaddon::Get().GetDiscordClient().GetUserSortedGuilds();
|
auto sort = Abaddon::Get().GetDiscordClient().GetUserSortedGuilds();
|
||||||
if (sort.size() == 1) {
|
if (sort.size() == 1) {
|
||||||
@@ -537,11 +511,6 @@ void ChannelList::UpdateGuild(Snowflake id) {
|
|||||||
m_list->insert(*new_row, index);
|
m_list->insert(*new_row, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelList::Clear() {
|
|
||||||
//std::scoped_lock<std::mutex> guard(m_update_mutex);
|
|
||||||
m_update_dispatcher.emit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChannelList::SetActiveChannel(Snowflake id) {
|
void ChannelList::SetActiveChannel(Snowflake id) {
|
||||||
auto it = m_id_to_row.find(id);
|
auto it = m_id_to_row.find(id);
|
||||||
if (it == m_id_to_row.end()) return;
|
if (it == m_id_to_row.end()) return;
|
||||||
@@ -707,7 +676,7 @@ void ChannelList::AddPrivateChannels() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelList::UpdateListingInternal() {
|
void ChannelList::UpdateListing() {
|
||||||
std::unordered_set<Snowflake> guilds = Abaddon::Get().GetDiscordClient().GetGuilds();
|
std::unordered_set<Snowflake> guilds = Abaddon::Get().GetDiscordClient().GetGuilds();
|
||||||
|
|
||||||
auto children = m_list->get_children();
|
auto children = m_list->get_children();
|
||||||
|
@@ -38,8 +38,6 @@ public:
|
|||||||
ChannelListRowDMChannel(const ChannelData *data);
|
ChannelListRowDMChannel(const ChannelData *data);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void OnImageLoad(Glib::RefPtr<Gdk::Pixbuf> buf);
|
|
||||||
|
|
||||||
Gtk::EventBox *m_ev;
|
Gtk::EventBox *m_ev;
|
||||||
Gtk::Box *m_box;
|
Gtk::Box *m_box;
|
||||||
Gtk::TextView *m_lbl;
|
Gtk::TextView *m_lbl;
|
||||||
@@ -53,9 +51,6 @@ public:
|
|||||||
int GuildIndex;
|
int GuildIndex;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void OnImageLoad(const Glib::RefPtr<Gdk::Pixbuf> &buf);
|
|
||||||
void OnAnimatedImageLoad(const Glib::RefPtr<Gdk::PixbufAnimation> &buf);
|
|
||||||
|
|
||||||
Gtk::EventBox *m_ev;
|
Gtk::EventBox *m_ev;
|
||||||
Gtk::Box *m_box;
|
Gtk::Box *m_box;
|
||||||
Gtk::TextView *m_lbl;
|
Gtk::TextView *m_lbl;
|
||||||
@@ -139,7 +134,6 @@ public:
|
|||||||
void UpdateCreateDMChannel(Snowflake id);
|
void UpdateCreateDMChannel(Snowflake id);
|
||||||
void UpdateCreateChannel(Snowflake id);
|
void UpdateCreateChannel(Snowflake id);
|
||||||
void UpdateGuild(Snowflake id);
|
void UpdateGuild(Snowflake id);
|
||||||
void Clear();
|
|
||||||
|
|
||||||
void SetActiveChannel(Snowflake id);
|
void SetActiveChannel(Snowflake id);
|
||||||
|
|
||||||
@@ -165,10 +159,6 @@ protected:
|
|||||||
Gtk::Menu m_channel_menu;
|
Gtk::Menu m_channel_menu;
|
||||||
Gtk::MenuItem *m_channel_menu_copyid;
|
Gtk::MenuItem *m_channel_menu_copyid;
|
||||||
|
|
||||||
Glib::Dispatcher m_update_dispatcher;
|
|
||||||
//mutable std::mutex m_update_mutex;
|
|
||||||
//std::queue<std::unordered_set<Snowflake>> m_update_queue;
|
|
||||||
|
|
||||||
// i would use one map but in really old guilds there can be a channel w/ same id as the guild so this hacky shit has to do
|
// i would use one map but in really old guilds there can be a channel w/ same id as the guild so this hacky shit has to do
|
||||||
std::unordered_map<Snowflake, ChannelListRow *> m_guild_id_to_row;
|
std::unordered_map<Snowflake, ChannelListRow *> m_guild_id_to_row;
|
||||||
std::unordered_map<Snowflake, ChannelListRow *> m_id_to_row;
|
std::unordered_map<Snowflake, ChannelListRow *> m_id_to_row;
|
||||||
@@ -176,8 +166,7 @@ protected:
|
|||||||
|
|
||||||
void InsertGuildAt(Snowflake id, int pos);
|
void InsertGuildAt(Snowflake id, int pos);
|
||||||
|
|
||||||
void AddPrivateChannels(); // retard moment
|
void AddPrivateChannels();
|
||||||
void UpdateListingInternal();
|
|
||||||
|
|
||||||
void CheckBumpDM(Snowflake channel_id);
|
void CheckBumpDM(Snowflake channel_id);
|
||||||
|
|
||||||
|
@@ -484,14 +484,7 @@ Gtk::Widget *ChatMessageItemContainer::CreateReactionsComponent(const Message &d
|
|||||||
img->set_can_focus(false);
|
img->set_can_focus(false);
|
||||||
box->add(*img);
|
box->add(*img);
|
||||||
} else { // custom
|
} else { // custom
|
||||||
const auto &pb = imgr.GetFromURLIfCached(reaction.Emoji.GetURL());
|
auto img = Gtk::manage(new LazyImage(reaction.Emoji.GetURL(), 16, 16));
|
||||||
Gtk::Image *img;
|
|
||||||
if (pb) {
|
|
||||||
img = Gtk::manage(new Gtk::Image(pb->scale_simple(16, 16, Gdk::INTERP_BILINEAR)));
|
|
||||||
} else {
|
|
||||||
img = Gtk::manage(new Gtk::Image(placeholder));
|
|
||||||
imgr.LoadFromURL(reaction.Emoji.GetURL(), sigc::bind<0>(sigc::mem_fun(*this, &ChatMessageItemContainer::ReactionUpdateImage), img));
|
|
||||||
}
|
|
||||||
img->set_can_focus(false);
|
img->set_can_focus(false);
|
||||||
box->add(*img);
|
box->add(*img);
|
||||||
}
|
}
|
||||||
@@ -574,10 +567,6 @@ Gtk::Widget *ChatMessageItemContainer::CreateReplyComponent(const Message &data)
|
|||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatMessageItemContainer::ReactionUpdateImage(Gtk::Image *img, const Glib::RefPtr<Gdk::Pixbuf> &pb) {
|
|
||||||
img->property_pixbuf() = pb->scale_simple(16, 16, Gdk::INTERP_BILINEAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
Glib::ustring ChatMessageItemContainer::GetText(const Glib::RefPtr<Gtk::TextBuffer> &buf) {
|
Glib::ustring ChatMessageItemContainer::GetText(const Glib::RefPtr<Gtk::TextBuffer> &buf) {
|
||||||
Gtk::TextBuffer::iterator a, b;
|
Gtk::TextBuffer::iterator a, b;
|
||||||
buf->get_bounds(a, b);
|
buf->get_bounds(a, b);
|
||||||
@@ -973,11 +962,20 @@ ChatMessageHeader::ChatMessageHeader(const Message *data) {
|
|||||||
auto &img = Abaddon::Get().GetImageManager();
|
auto &img = Abaddon::Get().GetImageManager();
|
||||||
|
|
||||||
m_avatar = Gtk::manage(new Gtk::Image(img.GetPlaceholder(AvatarSize)));
|
m_avatar = Gtk::manage(new Gtk::Image(img.GetPlaceholder(AvatarSize)));
|
||||||
if (author->HasAvatar())
|
if (author->HasAvatar()) {
|
||||||
img.LoadFromURL(author->GetAvatarURL(), sigc::mem_fun(*this, &ChatMessageHeader::OnAvatarLoad));
|
auto cb = [this](const Glib::RefPtr<Gdk::Pixbuf> &pb) {
|
||||||
|
m_static_avatar = pb;
|
||||||
|
m_avatar->property_pixbuf() = pb;
|
||||||
|
};
|
||||||
|
img.LoadFromURL(author->GetAvatarURL(), sigc::track_obj(cb, *this));
|
||||||
|
}
|
||||||
|
|
||||||
if (author->HasAnimatedAvatar())
|
if (author->HasAnimatedAvatar()) {
|
||||||
img.LoadAnimationFromURL(author->GetAvatarURL("gif"), AvatarSize, AvatarSize, sigc::mem_fun(*this, &ChatMessageHeader::OnAnimatedAvatarLoad));
|
auto cb = [this](const Glib::RefPtr<Gdk::PixbufAnimation> &pb) {
|
||||||
|
m_anim_avatar = pb;
|
||||||
|
};
|
||||||
|
img.LoadAnimationFromURL(author->GetAvatarURL("gif"), AvatarSize, AvatarSize, sigc::track_obj(cb, *this));
|
||||||
|
}
|
||||||
|
|
||||||
get_style_context()->add_class("message-container");
|
get_style_context()->add_class("message-container");
|
||||||
m_author->get_style_context()->add_class("message-container-author");
|
m_author->get_style_context()->add_class("message-container-author");
|
||||||
@@ -1089,15 +1087,6 @@ void ChatMessageHeader::UpdateNameColor() {
|
|||||||
m_author->set_markup(md);
|
m_author->set_markup(md);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatMessageHeader::OnAvatarLoad(const Glib::RefPtr<Gdk::Pixbuf> &pixbuf) {
|
|
||||||
m_static_avatar = pixbuf;
|
|
||||||
m_avatar->property_pixbuf() = pixbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChatMessageHeader::OnAnimatedAvatarLoad(const Glib::RefPtr<Gdk::PixbufAnimation> &pixbuf) {
|
|
||||||
m_anim_avatar = pixbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChatMessageHeader::AttachUserMenuHandler(Gtk::Widget &widget) {
|
void ChatMessageHeader::AttachUserMenuHandler(Gtk::Widget &widget) {
|
||||||
widget.signal_button_press_event().connect([this](GdkEventButton *ev) -> bool {
|
widget.signal_button_press_event().connect([this](GdkEventButton *ev) -> bool {
|
||||||
if (ev->type == GDK_BUTTON_PRESS && ev->button == GDK_BUTTON_SECONDARY) {
|
if (ev->type == GDK_BUTTON_PRESS && ev->button == GDK_BUTTON_SECONDARY) {
|
||||||
|
@@ -25,7 +25,6 @@ protected:
|
|||||||
Gtk::Widget *CreateStickerComponent(const StickerData &data);
|
Gtk::Widget *CreateStickerComponent(const StickerData &data);
|
||||||
Gtk::Widget *CreateReactionsComponent(const Message &data);
|
Gtk::Widget *CreateReactionsComponent(const Message &data);
|
||||||
Gtk::Widget *CreateReplyComponent(const Message &data);
|
Gtk::Widget *CreateReplyComponent(const Message &data);
|
||||||
void ReactionUpdateImage(Gtk::Image *img, const Glib::RefPtr<Gdk::Pixbuf> &pb);
|
|
||||||
|
|
||||||
static Glib::ustring GetText(const Glib::RefPtr<Gtk::TextBuffer> &buf);
|
static Glib::ustring GetText(const Glib::RefPtr<Gtk::TextBuffer> &buf);
|
||||||
|
|
||||||
@@ -107,9 +106,6 @@ public:
|
|||||||
void UpdateNameColor();
|
void UpdateNameColor();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void OnAvatarLoad(const Glib::RefPtr<Gdk::Pixbuf> &pixbuf);
|
|
||||||
void OnAnimatedAvatarLoad(const Glib::RefPtr<Gdk::PixbufAnimation> &pixbuf);
|
|
||||||
|
|
||||||
void AttachUserMenuHandler(Gtk::Widget &widget);
|
void AttachUserMenuHandler(Gtk::Widget &widget);
|
||||||
|
|
||||||
bool on_author_button_press(GdkEventButton *ev);
|
bool on_author_button_press(GdkEventButton *ev);
|
||||||
|
@@ -4,9 +4,6 @@
|
|||||||
LazyImage::LazyImage(int w, int h, bool use_placeholder)
|
LazyImage::LazyImage(int w, int h, bool use_placeholder)
|
||||||
: m_width(w)
|
: m_width(w)
|
||||||
, m_height(h) {
|
, m_height(h) {
|
||||||
static int sidx = 0;
|
|
||||||
sidx++;
|
|
||||||
m_idx = sidx;
|
|
||||||
if (use_placeholder)
|
if (use_placeholder)
|
||||||
property_pixbuf() = Abaddon::Get().GetImageManager().GetPlaceholder(w)->scale_simple(w, h, Gdk::INTERP_BILINEAR);
|
property_pixbuf() = Abaddon::Get().GetImageManager().GetPlaceholder(w)->scale_simple(w, h, Gdk::INTERP_BILINEAR);
|
||||||
signal_draw().connect(sigc::mem_fun(*this, &LazyImage::OnDraw));
|
signal_draw().connect(sigc::mem_fun(*this, &LazyImage::OnDraw));
|
||||||
@@ -16,9 +13,6 @@ LazyImage::LazyImage(const std::string &url, int w, int h, bool use_placeholder)
|
|||||||
: m_url(url)
|
: m_url(url)
|
||||||
, m_width(w)
|
, m_width(w)
|
||||||
, m_height(h) {
|
, m_height(h) {
|
||||||
static int sidx = 0;
|
|
||||||
sidx++;
|
|
||||||
m_idx = sidx;
|
|
||||||
if (use_placeholder)
|
if (use_placeholder)
|
||||||
property_pixbuf() = Abaddon::Get().GetImageManager().GetPlaceholder(w)->scale_simple(w, h, Gdk::INTERP_BILINEAR);
|
property_pixbuf() = Abaddon::Get().GetImageManager().GetPlaceholder(w)->scale_simple(w, h, Gdk::INTERP_BILINEAR);
|
||||||
signal_draw().connect(sigc::mem_fun(*this, &LazyImage::OnDraw));
|
signal_draw().connect(sigc::mem_fun(*this, &LazyImage::OnDraw));
|
||||||
|
@@ -13,7 +13,6 @@ private:
|
|||||||
bool OnDraw(const Cairo::RefPtr<Cairo::Context> &context);
|
bool OnDraw(const Cairo::RefPtr<Cairo::Context> &context);
|
||||||
|
|
||||||
bool m_needs_request = true;
|
bool m_needs_request = true;
|
||||||
int m_idx;
|
|
||||||
std::string m_url;
|
std::string m_url;
|
||||||
int m_width;
|
int m_width;
|
||||||
int m_height;
|
int m_height;
|
||||||
|
@@ -45,13 +45,7 @@ MemberListUserRow::MemberListUserRow(Snowflake guild_id, const UserData *data) {
|
|||||||
show_all();
|
show_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemberListUserRow::SetAvatarFromPixbuf(Glib::RefPtr<Gdk::Pixbuf> pixbuf) {
|
|
||||||
m_avatar->property_pixbuf() = pixbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
MemberList::MemberList() {
|
MemberList::MemberList() {
|
||||||
m_update_member_list_dispatcher.connect(sigc::mem_fun(*this, &MemberList::UpdateMemberListInternal));
|
|
||||||
|
|
||||||
m_main = Gtk::manage(new Gtk::ScrolledWindow);
|
m_main = Gtk::manage(new Gtk::ScrolledWindow);
|
||||||
m_listbox = Gtk::manage(new Gtk::ListBox);
|
m_listbox = Gtk::manage(new Gtk::ListBox);
|
||||||
|
|
||||||
@@ -74,7 +68,6 @@ void MemberList::Clear() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MemberList::SetActiveChannel(Snowflake id) {
|
void MemberList::SetActiveChannel(Snowflake id) {
|
||||||
std::scoped_lock<std::mutex> guard(m_mutex);
|
|
||||||
m_chan_id = id;
|
m_chan_id = id;
|
||||||
m_guild_id = Snowflake::Invalid;
|
m_guild_id = Snowflake::Invalid;
|
||||||
if (m_chan_id.IsValid()) {
|
if (m_chan_id.IsValid()) {
|
||||||
@@ -84,11 +77,6 @@ void MemberList::SetActiveChannel(Snowflake id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MemberList::UpdateMemberList() {
|
void MemberList::UpdateMemberList() {
|
||||||
std::scoped_lock<std::mutex> guard(m_mutex);
|
|
||||||
m_update_member_list_dispatcher.emit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemberList::UpdateMemberListInternal() {
|
|
||||||
m_id_to_row.clear();
|
m_id_to_row.clear();
|
||||||
|
|
||||||
auto children = m_listbox->get_children();
|
auto children = m_listbox->get_children();
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
class MemberListUserRow : public Gtk::ListBoxRow {
|
class MemberListUserRow : public Gtk::ListBoxRow {
|
||||||
public:
|
public:
|
||||||
MemberListUserRow(Snowflake guild_id, const UserData *data);
|
MemberListUserRow(Snowflake guild_id, const UserData *data);
|
||||||
void SetAvatarFromPixbuf(Glib::RefPtr<Gdk::Pixbuf> pixbuf);
|
|
||||||
|
|
||||||
Snowflake ID;
|
Snowflake ID;
|
||||||
|
|
||||||
@@ -29,12 +28,8 @@ public:
|
|||||||
void SetActiveChannel(Snowflake id);
|
void SetActiveChannel(Snowflake id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void UpdateMemberListInternal();
|
|
||||||
void AttachUserMenuHandler(Gtk::ListBoxRow *row, Snowflake id);
|
void AttachUserMenuHandler(Gtk::ListBoxRow *row, Snowflake id);
|
||||||
|
|
||||||
std::mutex m_mutex;
|
|
||||||
Glib::Dispatcher m_update_member_list_dispatcher;
|
|
||||||
|
|
||||||
Gtk::ScrolledWindow *m_main;
|
Gtk::ScrolledWindow *m_main;
|
||||||
Gtk::ListBox *m_listbox;
|
Gtk::ListBox *m_listbox;
|
||||||
|
|
||||||
|
@@ -128,13 +128,12 @@ void MainWindow::UpdateComponents() {
|
|||||||
m_menu_discord_set_status.set_sensitive(discord_active);
|
m_menu_discord_set_status.set_sensitive(discord_active);
|
||||||
|
|
||||||
if (!discord_active) {
|
if (!discord_active) {
|
||||||
m_channel_list.Clear();
|
|
||||||
m_chat.Clear();
|
m_chat.Clear();
|
||||||
m_members.Clear();
|
m_members.Clear();
|
||||||
} else {
|
} else {
|
||||||
UpdateChannelListing();
|
|
||||||
m_members.UpdateMemberList();
|
m_members.UpdateMemberList();
|
||||||
}
|
}
|
||||||
|
UpdateChannelListing();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::UpdateMembers() {
|
void MainWindow::UpdateMembers() {
|
||||||
|
Reference in New Issue
Block a user