Browse Source

reorganize accels, remove extra argument from browser construction

CPP-GTK4
yggverse 2 months ago
parent
commit
bddaa43024
  1. 3
      src/app.cpp
  2. 75
      src/app/browser.cpp
  3. 3
      src/app/browser.hpp

3
src/app.cpp

@ -22,7 +22,6 @@ int main( @@ -22,7 +22,6 @@ int main(
return app->make_window_and_run<app::Browser>(
argc,
argv,
db,
app
db
);
}

75
src/app/browser.cpp

@ -5,8 +5,7 @@ @@ -5,8 +5,7 @@
using namespace app;
Browser::Browser(
sqlite3 * db,
const Glib::RefPtr<Gtk::Application> & APP
sqlite3 * db
) {
// Init database
DB::SESSION::init(
@ -62,11 +61,6 @@ Browser::Browser( @@ -62,11 +61,6 @@ Browser::Browser(
}
);
APP->set_accel_for_action(
"win.debug",
"<Primary>i"
);
const auto ACTION__MAIN_TAB_APPEND = add_action(
"main_tab_append",
[this]
@ -75,11 +69,6 @@ Browser::Browser( @@ -75,11 +69,6 @@ Browser::Browser(
}
);
APP->set_accel_for_action(
"win.main_tab_append",
"<Primary>t"
);
const auto ACTION__MAIN_TAB_CLOSE_ACTIVE = add_action(
"main_tab_close_active",
[this]
@ -92,11 +81,6 @@ Browser::Browser( @@ -92,11 +81,6 @@ Browser::Browser(
false
);
APP->set_accel_for_action(
"win.main_tab_close_active",
"<Primary>Escape"
);
add_action(
"main_tab_close_left",
[this]
@ -141,11 +125,6 @@ Browser::Browser( @@ -141,11 +125,6 @@ Browser::Browser(
false
);
APP->set_accel_for_action(
"win.main_tab_page_navigation_reload",
"<Primary>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( @@ -158,11 +137,6 @@ Browser::Browser(
false
);
APP->set_accel_for_action(
"win.main_tab_page_navigation_history_back",
"<Primary>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( @@ -175,11 +149,6 @@ Browser::Browser(
false
);
APP->set_accel_for_action(
"win.main_tab_page_navigation_history_forward",
"<Primary>Right"
);
const auto ACTION__QUIT = add_action(
"quit",
[this]
@ -188,11 +157,6 @@ Browser::Browser( @@ -188,11 +157,6 @@ Browser::Browser(
}
);
APP->set_accel_for_action(
"win.quit",
"<Primary>q"
);
// Init widget
set_title(
_("Yoda")
@ -242,6 +206,43 @@ Browser::Browser( @@ -242,6 +206,43 @@ Browser::Browser(
signal_realize().connect(
[this]
{
const auto APP = get_application();
APP->set_accel_for_action(
"win.debug",
"<Primary>i"
);
APP->set_accel_for_action(
"win.main_tab_append",
"<Primary>t"
);
APP->set_accel_for_action(
"win.main_tab_close_active",
"<Primary>Escape"
);
APP->set_accel_for_action(
"win.main_tab_page_navigation_reload",
"<Primary>r"
);
APP->set_accel_for_action(
"win.main_tab_page_navigation_history_back",
"<Primary>Left"
);
APP->set_accel_for_action(
"win.main_tab_page_navigation_history_forward",
"<Primary>Right"
);
APP->set_accel_for_action(
"win.quit",
"<Primary>q"
);
restore(); // last session from DB
}
);

3
src/app/browser.hpp

@ -80,8 +80,7 @@ namespace app @@ -80,8 +80,7 @@ namespace app
public:
Browser(
sqlite3 * db,
const Glib::RefPtr<Gtk::Application> & APP
sqlite3 * db
);
// Actions

Loading…
Cancel
Save