mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
FileManager: Remember my last position and size.
This commit is contained in:
parent
70a4678d77
commit
aba6e6de6a
2 changed files with 24 additions and 2 deletions
|
@ -45,8 +45,13 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
auto window = GWindow::construct();
|
auto window = GWindow::construct();
|
||||||
window->set_title("File Manager");
|
window->set_title("File Manager");
|
||||||
window->set_rect(20, 200, 640, 480);
|
|
||||||
|
auto left = config->read_num_entry("Window", "Left", 150);
|
||||||
|
auto top = config->read_num_entry("Window", "Top", 75);
|
||||||
|
auto width = config->read_num_entry("Window", "Width", 640);
|
||||||
|
auto heigth = config->read_num_entry("Window", "Heigth", 480);
|
||||||
|
window->set_rect( {left, top, width, heigth} );
|
||||||
|
|
||||||
auto widget = GWidget::construct();
|
auto widget = GWidget::construct();
|
||||||
widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||||
widget->layout()->set_spacing(0);
|
widget->layout()->set_spacing(0);
|
||||||
|
@ -408,5 +413,16 @@ int main(int argc, char** argv)
|
||||||
view_as_icons_action->set_checked(true);
|
view_as_icons_action->set_checked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Write window position to config file on close request.
|
||||||
|
window->on_close_request = [&] {
|
||||||
|
config->write_num_entry("Window", "Left", window->x());
|
||||||
|
config->write_num_entry("Window", "Top", window->y());
|
||||||
|
config->write_num_entry("Window", "Width", window->width());
|
||||||
|
config->write_num_entry("Window", "Heigth", window->height());
|
||||||
|
config->sync();
|
||||||
|
|
||||||
|
return GWindow::CloseRequestDecision::Close;
|
||||||
|
};
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,8 @@
|
||||||
[DirectoryView]
|
[DirectoryView]
|
||||||
ViewMode=Icon
|
ViewMode=Icon
|
||||||
|
|
||||||
|
[Window]
|
||||||
|
Left=150
|
||||||
|
Top=75
|
||||||
|
Width=640
|
||||||
|
Heigth=480
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue