summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2022-05-02 02:31:15 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2022-05-02 02:31:15 -0400
commit63db16a711fa1f4127b11197940d47032867ec94 (patch)
tree2586a4434a5f356ef890504ac523b54ebfabe948 /src
parentc30ab91738a22570afb89b9b9e758f9b708b33c2 (diff)
downloadabaddon-portaudio-63db16a711fa1f4127b11197940d47032867ec94.tar.gz
abaddon-portaudio-63db16a711fa1f4127b11197940d47032867ec94.zip
open channel if its the first opened tab
Diffstat (limited to 'src')
-rw-r--r--src/components/channeltabswitcherhandy.cpp4
-rw-r--r--src/components/channeltabswitcherhandy.hpp2
-rw-r--r--src/components/chatwindow.cpp4
3 files changed, 10 insertions, 0 deletions
diff --git a/src/components/channeltabswitcherhandy.cpp b/src/components/channeltabswitcherhandy.cpp
index 9abceed..609d17c 100644
--- a/src/components/channeltabswitcherhandy.cpp
+++ b/src/components/channeltabswitcherhandy.cpp
@@ -113,6 +113,10 @@ void ChannelTabSwitcherHandy::GoForwardOnCurrent() {
AdvanceOnCurrent(1);
}
+int ChannelTabSwitcherHandy::GetNumberOfTabs() const {
+ return hdy_tab_view_get_n_pages(m_tab_view);
+}
+
void ChannelTabSwitcherHandy::CheckUnread(Snowflake id) {
if (auto it = m_pages.find(id); it != m_pages.end()) {
hdy_tab_page_set_needs_attention(it->second, Abaddon::Get().GetDiscordClient().GetUnreadStateForChannel(id) > -1);
diff --git a/src/components/channeltabswitcherhandy.hpp b/src/components/channeltabswitcherhandy.hpp
index 37a71ee..561d463 100644
--- a/src/components/channeltabswitcherhandy.hpp
+++ b/src/components/channeltabswitcherhandy.hpp
@@ -25,6 +25,8 @@ public:
void GoBackOnCurrent();
void GoForwardOnCurrent();
+ [[nodiscard]] int GetNumberOfTabs() const;
+
private:
void CheckUnread(Snowflake id);
void ClearPage(HdyTabPage *page);
diff --git a/src/components/chatwindow.cpp b/src/components/chatwindow.cpp
index fcaf6c4..8667488 100644
--- a/src/components/chatwindow.cpp
+++ b/src/components/chatwindow.cpp
@@ -170,6 +170,10 @@ void ChatWindow::SetTopic(const std::string &text) {
#ifdef WITH_LIBHANDY
void ChatWindow::OpenNewTab(Snowflake id) {
+ // open if its the first tab (in which case it really isnt a tab but whatever)
+ if (m_tab_switcher->GetNumberOfTabs() == 0) {
+ m_signal_action_channel_click.emit(id, false);
+ }
m_tab_switcher->AddChannelTab(id);
}