mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-06 20:15:19 +03:00
add ctrl+number key shortcuts for tabs
This commit is contained in:
@@ -117,6 +117,20 @@ static bool HandleKeyEvents(GdkEvent *event, MainWindow *main_window) {
|
||||
else
|
||||
main_window->GoToNextTab();
|
||||
return true;
|
||||
case GDK_KEY_1:
|
||||
case GDK_KEY_2:
|
||||
case GDK_KEY_3:
|
||||
case GDK_KEY_4:
|
||||
case GDK_KEY_5:
|
||||
case GDK_KEY_6:
|
||||
case GDK_KEY_7:
|
||||
case GDK_KEY_8:
|
||||
case GDK_KEY_9:
|
||||
main_window->GoToTab(event->key.keyval - GDK_KEY_1);
|
||||
return true;
|
||||
case GDK_KEY_0:
|
||||
main_window->GoToTab(9);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,6 +131,11 @@ void ChannelTabSwitcherHandy::GoToNextTab() {
|
||||
}
|
||||
}
|
||||
|
||||
void ChannelTabSwitcherHandy::GoToTab(int idx) {
|
||||
if (hdy_tab_view_get_n_pages(m_tab_view) >= idx + 1)
|
||||
hdy_tab_view_set_selected_page(m_tab_view, hdy_tab_view_get_nth_page(m_tab_view, idx));
|
||||
}
|
||||
|
||||
int ChannelTabSwitcherHandy::GetNumberOfTabs() const {
|
||||
return hdy_tab_view_get_n_pages(m_tab_view);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
void GoForwardOnCurrent();
|
||||
void GoToPreviousTab();
|
||||
void GoToNextTab();
|
||||
void GoToTab(int idx);
|
||||
|
||||
[[nodiscard]] int GetNumberOfTabs() const;
|
||||
|
||||
|
||||
@@ -200,6 +200,10 @@ void ChatWindow::GoToPreviousTab() {
|
||||
void ChatWindow::GoToNextTab() {
|
||||
m_tab_switcher->GoToNextTab();
|
||||
}
|
||||
|
||||
void ChatWindow::GoToTab(int idx) {
|
||||
m_tab_switcher->GoToTab(idx);
|
||||
}
|
||||
#endif
|
||||
|
||||
Snowflake ChatWindow::GetActiveChannel() const {
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
void GoForward();
|
||||
void GoToPreviousTab();
|
||||
void GoToNextTab();
|
||||
void GoToTab(int idx);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
@@ -173,6 +173,10 @@ void MainWindow::GoToPreviousTab() {
|
||||
void MainWindow::GoToNextTab() {
|
||||
m_chat.GoToNextTab();
|
||||
}
|
||||
|
||||
void MainWindow::GoToTab(int idx) {
|
||||
m_chat.GoToTab(idx);
|
||||
}
|
||||
#endif
|
||||
|
||||
void MainWindow::OnDiscordSubmenuPopup() {
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
void GoForward();
|
||||
void GoToPreviousTab();
|
||||
void GoToNextTab();
|
||||
void GoToTab(int idx);
|
||||
#endif
|
||||
|
||||
ChannelList *GetChannelList();
|
||||
|
||||
Reference in New Issue
Block a user