summaryrefslogtreecommitdiff
path: root/src/components/channeltabswitcherhandy.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2022-05-06 01:14:15 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2022-05-06 01:14:15 -0400
commit2c25319fb85e077f27c3a4cd0bfdc8f503c6020d (patch)
treee92422ddcb896fb6b5bb75576138100c4f32f43d /src/components/channeltabswitcherhandy.cpp
parent7daa0a250c76247c883cf536a3d339016a3852b4 (diff)
downloadabaddon-portaudio-2c25319fb85e077f27c3a4cd0bfdc8f503c6020d.tar.gz
abaddon-portaudio-2c25319fb85e077f27c3a4cd0bfdc8f503c6020d.zip
clear tabs when access lost, show blanks for missing channels
Diffstat (limited to 'src/components/channeltabswitcherhandy.cpp')
-rw-r--r--src/components/channeltabswitcherhandy.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/components/channeltabswitcherhandy.cpp b/src/components/channeltabswitcherhandy.cpp
index f7b0226..67dbff0 100644
--- a/src/components/channeltabswitcherhandy.cpp
+++ b/src/components/channeltabswitcherhandy.cpp
@@ -37,6 +37,8 @@ ChannelTabSwitcherHandy::ChannelTabSwitcherHandy() {
discord.signal_message_ack().connect([this](const MessageAckData &data) {
CheckUnread(data.ChannelID);
});
+
+ discord.signal_channel_accessibility_changed().connect(sigc::mem_fun(*this, &ChannelTabSwitcherHandy::OnChannelAccessibilityChanged));
}
void ChannelTabSwitcherHandy::AddChannelTab(Snowflake id) {
@@ -195,6 +197,18 @@ void ChannelTabSwitcherHandy::AdvanceOnCurrent(size_t by) {
history->second.CurrentVisitedIndex = real;
}
+void ChannelTabSwitcherHandy::OnChannelAccessibilityChanged(Snowflake id, bool accessibility) {
+ if (accessibility) return;
+ if (auto it = m_pages.find(id); it != m_pages.end()) {
+ if (hdy_tab_page_get_selected(it->second))
+ if (!hdy_tab_view_select_previous_page(m_tab_view))
+ hdy_tab_view_select_next_page(m_tab_view);
+
+ hdy_tab_view_close_page(m_tab_view, it->second);
+ ClearPage(it->second);
+ }
+}
+
ChannelTabSwitcherHandy::type_signal_channel_switched_to ChannelTabSwitcherHandy::signal_channel_switched_to() {
return m_signal_channel_switched_to;
}