mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
reorganize accels for actions
This commit is contained in:
parent
ec1864a858
commit
bc21425acc
3 changed files with 112 additions and 105 deletions
|
|
@ -5,7 +5,7 @@
|
|||
using namespace app;
|
||||
|
||||
Browser::Browser(
|
||||
//const Glib::RefPtr<Gtk::Application> & app,
|
||||
const Glib::RefPtr<Gtk::Application> & APP
|
||||
//const std::shared_ptr<lib::Database> & db
|
||||
) {
|
||||
// Init window actions
|
||||
|
|
@ -33,7 +33,11 @@ Browser::Browser(
|
|||
}
|
||||
);
|
||||
|
||||
// Tab actions
|
||||
APP->set_accel_for_action(
|
||||
"win.debug",
|
||||
"<Primary>i"
|
||||
);
|
||||
|
||||
add_action(
|
||||
"main_tab_append",
|
||||
[this]
|
||||
|
|
@ -42,6 +46,11 @@ Browser::Browser(
|
|||
}
|
||||
);
|
||||
|
||||
APP->set_accel_for_action(
|
||||
"win.main_tab_append",
|
||||
"<Primary>t"
|
||||
);
|
||||
|
||||
const auto ACTION__MAIN_TAB_CLOSE = add_action(
|
||||
"main_tab_close",
|
||||
[this]
|
||||
|
|
@ -93,6 +102,11 @@ Browser::Browser(
|
|||
false
|
||||
);
|
||||
|
||||
APP->set_accel_for_action(
|
||||
"win.main_tab_page_navigation_update",
|
||||
"<Primary>r"
|
||||
);
|
||||
|
||||
const auto ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK = add_action(
|
||||
"main_tab_page_navigation_history_back",
|
||||
[this]
|
||||
|
|
@ -101,6 +115,15 @@ Browser::Browser(
|
|||
}
|
||||
);
|
||||
|
||||
ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_BACK->set_enabled(
|
||||
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]
|
||||
|
|
@ -109,6 +132,15 @@ Browser::Browser(
|
|||
}
|
||||
);
|
||||
|
||||
ACTION__MAIN_TAB_PAGE_NAVIGATION_HISTORY_FORWARD->set_enabled(
|
||||
false
|
||||
);
|
||||
|
||||
APP->set_accel_for_action(
|
||||
"win.main_tab_page_navigation_history_forward",
|
||||
"<Primary>Right"
|
||||
);
|
||||
|
||||
// Init widget
|
||||
set_title(
|
||||
_("Yoda")
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <giomm/simpleaction.h>
|
||||
#include <glibmm/i18n.h>
|
||||
#include <glibmm/refptr.h>
|
||||
#include <gtkmm/application.h>
|
||||
#include <gtkmm/applicationwindow.h>
|
||||
#include <gtkmm/object.h>
|
||||
|
||||
|
|
@ -33,7 +34,7 @@ namespace app
|
|||
public:
|
||||
|
||||
Browser(
|
||||
//const Glib::RefPtr<Gtk::Application> & app,
|
||||
const Glib::RefPtr<Gtk::Application> & APP
|
||||
//const std::shared_ptr<lib::Database> & db
|
||||
);
|
||||
};
|
||||
|
|
|
|||
46
src/main.cpp
46
src/main.cpp
|
|
@ -7,61 +7,35 @@ int main(
|
|||
char * argv[]
|
||||
) {
|
||||
// Init profile database
|
||||
const std::shared_ptr<lib::Database> db(
|
||||
const std::shared_ptr<lib::Database> DB( // @TODO
|
||||
new lib::Database(
|
||||
"database.sqlite3"
|
||||
)
|
||||
);
|
||||
|
||||
// Init app
|
||||
const Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(
|
||||
const Glib::RefPtr<Gtk::Application> APP = Gtk::Application::create(
|
||||
"io.github.yggverse.Yoda"
|
||||
);
|
||||
|
||||
app->add_action(
|
||||
APP->add_action(
|
||||
"quit",
|
||||
[app]
|
||||
[APP]
|
||||
{
|
||||
app->quit();
|
||||
APP->quit();
|
||||
}
|
||||
);
|
||||
|
||||
// Init accels @TODO db settings
|
||||
app->set_accel_for_action(
|
||||
"win.debug",
|
||||
"<Primary>i"
|
||||
);
|
||||
|
||||
app->set_accel_for_action(
|
||||
APP->set_accel_for_action(
|
||||
"app.quit",
|
||||
"<Primary>q"
|
||||
);
|
||||
|
||||
app->set_accel_for_action(
|
||||
"win.main_tab_append",
|
||||
"<Primary>t"
|
||||
);
|
||||
|
||||
app->set_accel_for_action(
|
||||
"win.main_tab_page_navigation_update",
|
||||
"<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"
|
||||
);
|
||||
|
||||
// Launch browser component
|
||||
return app->make_window_and_run<app::Browser>(
|
||||
return APP->make_window_and_run<app::Browser>(
|
||||
argc,
|
||||
argv
|
||||
//app,
|
||||
//db
|
||||
argv,
|
||||
APP
|
||||
// DB
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue