diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-10-06 22:03:02 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-10-06 22:03:41 +0200 |
commit | b5a043cf425ec2fa2d7154728317a7d55024a095 (patch) | |
tree | 6eb59b187b628218f407fba87f64a732c9b781f1 | |
parent | ac3079b43301c1fcf0de3ed8bfaea427fb55391c (diff) | |
download | serenity-b5a043cf425ec2fa2d7154728317a7d55024a095.zip |
Browser: Add a simple "Go home" button to the toolbar
Currently this just takes us to /home/anon/www/welcome.html :^)
-rw-r--r-- | Applications/Browser/main.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Applications/Browser/main.cpp b/Applications/Browser/main.cpp index aef4e98e20..eccff08c80 100644 --- a/Applications/Browser/main.cpp +++ b/Applications/Browser/main.cpp @@ -20,6 +20,8 @@ #include <LibHTML/Parser/HTMLParser.h> #include <stdio.h> +static const char* home_url = "file:///home/anon/www/welcome.html"; + int main(int argc, char** argv) { GApplication app(argc, argv); @@ -43,7 +45,11 @@ int main(int argc, char** argv) // FIXME: Implement forward action })); - toolbar->add_action(GAction::create("Reload", { Mod_Ctrl, Key_R }, GraphicsBitmap::load_from_file("/res/icons/16x16/reload.png"), [&](auto&) { + toolbar->add_action(GCommonActions::make_go_home_action([&](auto&) { + html_widget->load(home_url); + })); + + toolbar->add_action(GCommonActions::make_reload_action([&](auto&) { html_widget->reload(); })); @@ -94,7 +100,7 @@ int main(int argc, char** argv) window->set_main_widget(widget); window->show(); - String url_to_load = "file:///home/anon/www/welcome.html"; + String url_to_load = home_url; if (app.args().size() >= 1) url_to_load = app.args()[0]; |