mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Welcome: Move tips.txt to /usr/share/Welcome because it's system wide
This commit is contained in:
parent
813c66403d
commit
f4d5ff9ed9
Notes:
sideshowbarker
2024-07-17 17:06:59 +09:00
Author: https://github.com/bplaat Commit: https://github.com/SerenityOS/serenity/commit/f4d5ff9ed9 Pull-request: https://github.com/SerenityOS/serenity/pull/22995 Reviewed-by: https://github.com/gmta ✅
3 changed files with 7 additions and 4 deletions
|
@ -19,6 +19,9 @@
|
|||
#include <LibGfx/Palette.h>
|
||||
|
||||
namespace Welcome {
|
||||
|
||||
static String tips_file_path = "/usr/share/Welcome/tips.txt"_string;
|
||||
|
||||
ErrorOr<NonnullRefPtr<WelcomeWidget>> WelcomeWidget::create()
|
||||
{
|
||||
auto welcome_widget = TRY(WelcomeWidget::try_create());
|
||||
|
@ -79,8 +82,7 @@ ErrorOr<void> WelcomeWidget::create_widgets()
|
|||
};
|
||||
|
||||
if (auto result = open_and_parse_tips_file(); result.is_error()) {
|
||||
auto path = TRY(String::formatted("{}/tips.txt", Core::StandardPaths::documents_directory()));
|
||||
auto error = TRY(String::formatted("Opening \"{}\" failed: {}", path, result.error()));
|
||||
auto error = TRY(String::formatted("Opening \"{}\" failed: {}", tips_file_path, result.error()));
|
||||
m_tip_label->set_text(error);
|
||||
warnln(error);
|
||||
}
|
||||
|
@ -92,8 +94,7 @@ ErrorOr<void> WelcomeWidget::create_widgets()
|
|||
|
||||
ErrorOr<void> WelcomeWidget::open_and_parse_tips_file()
|
||||
{
|
||||
auto path = TRY(String::formatted("{}/tips.txt", Core::StandardPaths::documents_directory()));
|
||||
auto file = TRY(Core::File::open(path, Core::File::OpenMode::Read));
|
||||
auto file = TRY(Core::File::open(tips_file_path, Core::File::OpenMode::Read));
|
||||
auto buffered_file = TRY(Core::InputBufferedFile::create(move(file)));
|
||||
Array<u8, PAGE_SIZE> buffer;
|
||||
|
||||
|
@ -128,4 +129,5 @@ void WelcomeWidget::paint_event(GUI::PaintEvent& event)
|
|||
rect.set_x(rect.x() + static_cast<int>(ceilf(m_banner_font->bold_variant().width("Serenity"sv))));
|
||||
painter.draw_text(rect, "OS"sv, m_banner_font->bold_variant(), Gfx::TextAlignment::CenterLeft, palette().tray_text());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil("/tmp/session/%sid/portal/filesystemaccess", "rw"));
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
TRY(Core::System::unveil("/home", "r"));
|
||||
TRY(Core::System::unveil("/usr/share/Welcome", "r"));
|
||||
TRY(Core::System::unveil("/bin/Help", "x"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-welcome"sv));
|
||||
|
|
Loading…
Reference in a new issue