diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-10-06 21:59:46 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-10-06 22:00:04 +0200 |
commit | ac3079b43301c1fcf0de3ed8bfaea427fb55391c (patch) | |
tree | d7d8e506931466a974443859078d3f2728d4efe4 /Libraries | |
parent | 122d12e61797533f3948f9b36dd147551d45d572 (diff) | |
download | serenity-ac3079b43301c1fcf0de3ed8bfaea427fb55391c.zip |
LibGUI: Add "Go home" to GCommonActions
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibGUI/GAction.cpp | 5 | ||||
-rw-r--r-- | Libraries/LibGUI/GAction.h | 1 | ||||
-rw-r--r-- | Libraries/LibGUI/GFilePicker.cpp | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/Libraries/LibGUI/GAction.cpp b/Libraries/LibGUI/GAction.cpp index 73376b0977..451da3ab7f 100644 --- a/Libraries/LibGUI/GAction.cpp +++ b/Libraries/LibGUI/GAction.cpp @@ -71,6 +71,11 @@ NonnullRefPtr<GAction> make_go_forward_action(Function<void(GAction&)> callback, return GAction::create("Go forward", { Mod_Alt, Key_Right }, GraphicsBitmap::load_from_file("/res/icons/16x16/go-forward.png"), move(callback), widget); } +NonnullRefPtr<GAction> make_go_home_action(Function<void(GAction&)> callback, GWidget* widget) +{ + return GAction::create("Go home", GraphicsBitmap::load_from_file("/res/icons/16x16/go-home.png"), move(callback), widget); +} + NonnullRefPtr<GAction> make_reload_action(Function<void(GAction&)> callback, GWidget* widget) { return GAction::create("Reload", { Mod_Ctrl, Key_R }, GraphicsBitmap::load_from_file("/res/icons/16x16/reload.png"), move(callback), widget); diff --git a/Libraries/LibGUI/GAction.h b/Libraries/LibGUI/GAction.h index cb3e4752f2..285df968db 100644 --- a/Libraries/LibGUI/GAction.h +++ b/Libraries/LibGUI/GAction.h @@ -32,6 +32,7 @@ NonnullRefPtr<GAction> make_fullscreen_action(Function<void(GAction&)>, GWidget* NonnullRefPtr<GAction> make_quit_action(Function<void(GAction&)>); NonnullRefPtr<GAction> make_go_back_action(Function<void(GAction&)>, GWidget* widget = nullptr); NonnullRefPtr<GAction> make_go_forward_action(Function<void(GAction&)>, GWidget* widget = nullptr); +NonnullRefPtr<GAction> make_go_home_action(Function<void(GAction&)> callback, GWidget* widget = nullptr); NonnullRefPtr<GAction> make_reload_action(Function<void(GAction&)>, GWidget* widget = nullptr); }; diff --git a/Libraries/LibGUI/GFilePicker.cpp b/Libraries/LibGUI/GFilePicker.cpp index 9d649cf5af..f0648916d2 100644 --- a/Libraries/LibGUI/GFilePicker.cpp +++ b/Libraries/LibGUI/GFilePicker.cpp @@ -95,7 +95,7 @@ GFilePicker::GFilePicker(Mode mode, const StringView& file_name, const StringVie }); toolbar->add_action(*open_parent_directory_action); - auto go_home_action = GAction::create("Go to Home Directory", GraphicsBitmap::load_from_file("/res/icons/16x16/go-home.png"), [this](auto&) { + auto go_home_action = GCommonActions::make_go_home_action([this](auto&) { m_model->open(get_current_user_home_path()); }); toolbar->add_action(go_home_action); |