open channel if its the first opened tab
This commit is contained in:
@@ -113,6 +113,10 @@ void ChannelTabSwitcherHandy::GoForwardOnCurrent() {
|
|||||||
AdvanceOnCurrent(1);
|
AdvanceOnCurrent(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ChannelTabSwitcherHandy::GetNumberOfTabs() const {
|
||||||
|
return hdy_tab_view_get_n_pages(m_tab_view);
|
||||||
|
}
|
||||||
|
|
||||||
void ChannelTabSwitcherHandy::CheckUnread(Snowflake id) {
|
void ChannelTabSwitcherHandy::CheckUnread(Snowflake id) {
|
||||||
if (auto it = m_pages.find(id); it != m_pages.end()) {
|
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);
|
hdy_tab_page_set_needs_attention(it->second, Abaddon::Get().GetDiscordClient().GetUnreadStateForChannel(id) > -1);
|
||||||
|
@@ -25,6 +25,8 @@ public:
|
|||||||
void GoBackOnCurrent();
|
void GoBackOnCurrent();
|
||||||
void GoForwardOnCurrent();
|
void GoForwardOnCurrent();
|
||||||
|
|
||||||
|
[[nodiscard]] int GetNumberOfTabs() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CheckUnread(Snowflake id);
|
void CheckUnread(Snowflake id);
|
||||||
void ClearPage(HdyTabPage *page);
|
void ClearPage(HdyTabPage *page);
|
||||||
|
@@ -170,6 +170,10 @@ void ChatWindow::SetTopic(const std::string &text) {
|
|||||||
|
|
||||||
#ifdef WITH_LIBHANDY
|
#ifdef WITH_LIBHANDY
|
||||||
void ChatWindow::OpenNewTab(Snowflake id) {
|
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);
|
m_tab_switcher->AddChannelTab(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user