1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:38:10 +00:00

LibGUI+Userland: Use action text as a fallback in Action::status_tip()

Many applications already do this in their code. This change will simply
move the logic to a single function to stop repeating ourselves!
This commit is contained in:
Karol Kosek 2023-06-04 12:10:25 +02:00 committed by Sam Atkins
parent 2029750519
commit 4b169cf25f
13 changed files with 21 additions and 48 deletions

View file

@ -16,7 +16,6 @@
#include <LibGUI/MessageBox.h>
#include <LibGUI/Statusbar.h>
#include <LibGUI/Window.h>
#include <LibGfx/Painter.h>
#include <LibMain/Main.h>
ErrorOr<int> serenity_main(Main::Arguments arguments)
@ -61,10 +60,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto& statusbar = *main_widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar");
app->on_action_enter = [&statusbar](GUI::Action& action) {
auto text = action.status_tip();
if (text.is_empty())
text = Gfx::parse_ampersand_string(action.text());
statusbar.set_override_text(move(text));
statusbar.set_override_text(action.status_tip());
};
app->on_action_leave = [&statusbar](GUI::Action&) {