From bddaa43024a70eea24b988efa37e1c74acb475a4 Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 13 Sep 2024 06:58:35 +0300 Subject: [PATCH] reorganize accels, remove extra argument from browser construction --- src/app.cpp | 3 +- src/app/browser.cpp | 75 +++++++++++++++++++++++---------------------- src/app/browser.hpp | 3 +- 3 files changed, 40 insertions(+), 41 deletions(-) diff --git a/src/app.cpp b/src/app.cpp index 0b83c23a..7bfb5be8 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -22,7 +22,6 @@ int main( return app->make_window_and_run( argc, argv, - db, - app + db ); } \ No newline at end of file diff --git a/src/app/browser.cpp b/src/app/browser.cpp index 093762e1..95f2dd02 100644 --- a/src/app/browser.cpp +++ b/src/app/browser.cpp @@ -5,8 +5,7 @@ using namespace app; Browser::Browser( - sqlite3 * db, - const Glib::RefPtr & APP + sqlite3 * db ) { // Init database DB::SESSION::init( @@ -62,11 +61,6 @@ Browser::Browser( } ); - APP->set_accel_for_action( - "win.debug", - "i" - ); - const auto ACTION__MAIN_TAB_APPEND = add_action( "main_tab_append", [this] @@ -75,11 +69,6 @@ Browser::Browser( } ); - APP->set_accel_for_action( - "win.main_tab_append", - "t" - ); - const auto ACTION__MAIN_TAB_CLOSE_ACTIVE = add_action( "main_tab_close_active", [this] @@ -92,11 +81,6 @@ Browser::Browser( false ); - APP->set_accel_for_action( - "win.main_tab_close_active", - "Escape" - ); - add_action( "main_tab_close_left", [this] @@ -141,11 +125,6 @@ Browser::Browser( false ); - APP->set_accel_for_action( - "win.main_tab_page_navigation_reload", - "r" - ); - const auto ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK = add_action( "main_tab_page_navigation_history_back", [this] @@ -158,11 +137,6 @@ Browser::Browser( false ); - APP->set_accel_for_action( - "win.main_tab_page_navigation_history_back", - "Left" - ); - const auto ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD = add_action( "main_tab_page_navigation_history_forward", [this] @@ -175,11 +149,6 @@ Browser::Browser( false ); - APP->set_accel_for_action( - "win.main_tab_page_navigation_history_forward", - "Right" - ); - const auto ACTION__QUIT = add_action( "quit", [this] @@ -188,11 +157,6 @@ Browser::Browser( } ); - APP->set_accel_for_action( - "win.quit", - "q" - ); - // Init widget set_title( _("Yoda") @@ -242,6 +206,43 @@ Browser::Browser( signal_realize().connect( [this] { + const auto APP = get_application(); + + APP->set_accel_for_action( + "win.debug", + "i" + ); + + APP->set_accel_for_action( + "win.main_tab_append", + "t" + ); + + APP->set_accel_for_action( + "win.main_tab_close_active", + "Escape" + ); + + APP->set_accel_for_action( + "win.main_tab_page_navigation_reload", + "r" + ); + + APP->set_accel_for_action( + "win.main_tab_page_navigation_history_back", + "Left" + ); + + APP->set_accel_for_action( + "win.main_tab_page_navigation_history_forward", + "Right" + ); + + APP->set_accel_for_action( + "win.quit", + "q" + ); + restore(); // last session from DB } ); diff --git a/src/app/browser.hpp b/src/app/browser.hpp index b3c600bf..e625279d 100644 --- a/src/app/browser.hpp +++ b/src/app/browser.hpp @@ -80,8 +80,7 @@ namespace app public: Browser( - sqlite3 * db, - const Glib::RefPtr & APP + sqlite3 * db ); // Actions