[gnote/gnome-42] Add accelerators for switching tabs in main window
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote/gnome-42] Add accelerators for switching tabs in main window
- Date: Mon, 6 Jun 2022 20:01:30 +0000 (UTC)
commit fee89a096be8de4a536c8cfbca246085007f37a9
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun May 8 21:17:10 2022 +0300
Add accelerators for switching tabs in main window
Fixes https://gitlab.gnome.org/GNOME/gnote/-/issues/124
src/recentchanges.cpp | 23 +++++++++++++++++++++++
src/recentchanges.hpp | 2 ++
2 files changed, 25 insertions(+)
---
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index f27e87a6..a0ae1f9b 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -154,6 +154,10 @@ namespace gnote {
GDK_KEY_W, Gdk::CONTROL_MASK, (Gtk::AccelFlags)0);
m_keybinder.add_accelerator(sigc::mem_fun(*this, &NoteRecentChanges::close_window),
GDK_KEY_Q, Gdk::CONTROL_MASK, (Gtk::AccelFlags)0);
+ m_keybinder.add_accelerator(sigc::mem_fun(*this, &NoteRecentChanges::next_tab),
+ GDK_KEY_Page_Down, Gdk::CONTROL_MASK, (Gtk::AccelFlags)0);
+ m_keybinder.add_accelerator(sigc::mem_fun(*this, &NoteRecentChanges::previous_tab),
+ GDK_KEY_Page_Up, Gdk::CONTROL_MASK, (Gtk::AccelFlags)0);
}
@@ -612,6 +616,25 @@ namespace gnote {
return true;
}
+ void NoteRecentChanges::next_tab()
+ {
+ int next_page = 1 + m_embed_book.get_current_page();
+ if(next_page >= m_embed_book.get_n_pages()) {
+ next_page = 0;
+ }
+
+ m_embed_book.set_current_page(next_page);
+ }
+
+ void NoteRecentChanges::previous_tab()
+ {
+ int prev_page = m_embed_book.get_current_page() - 1;
+ if(prev_page < 0) {
+ prev_page = m_embed_book.get_n_pages() - 1;
+ }
+
+ m_embed_book.set_current_page(prev_page);
+ }
void NoteRecentChanges::on_show()
{
diff --git a/src/recentchanges.hpp b/src/recentchanges.hpp
index a2eacfc6..59cb0a2b 100644
--- a/src/recentchanges.hpp
+++ b/src/recentchanges.hpp
@@ -105,6 +105,8 @@ private:
void callbacks_changed();
void register_callbacks();
void unregister_callbacks();
+ void next_tab();
+ void previous_tab();
IGnote &m_gnote;
NoteManagerBase &m_note_manager;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]