mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +00:00
Spreadsheet: Show the opened filename in the window title
Prior to this commit, there was a set_filename() function that could set the window title, but actually it never did that. It was called only in one place -- by the 'Save as...' action, but it always failed to change anything, because there was a check that tried to reassign the same filename. :/ This patch: 1. removes that check, and therefore 2. renames the function to simply `update_window_title()`, 3. starts calling the function from more places (at startup and after loading a file), 4. changes the window title order (`{app_name} - {filename}` -> `{filename} - {app_name}`) to match the other applications style on the system. :^)
This commit is contained in:
parent
b59773de17
commit
dc65543fa9
3 changed files with 13 additions and 12 deletions
|
@ -54,13 +54,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto app_icon = GUI::Icon::default_icon("app-spreadsheet");
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title("Spreadsheet");
|
||||
window->resize(640, 480);
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
|
||||
auto& spreadsheet_widget = window->set_main_widget<Spreadsheet::SpreadsheetWidget>(*window, NonnullRefPtrVector<Spreadsheet::Sheet> {}, filename == nullptr);
|
||||
|
||||
spreadsheet_widget.initialize_menubar(*window);
|
||||
spreadsheet_widget.update_window_title();
|
||||
|
||||
window->on_close_request = [&]() -> GUI::Window::CloseRequestDecision {
|
||||
if (spreadsheet_widget.request_close())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue