mirror of
https://github.com/RGBCube/serenity
synced 2025-05-24 01:15:07 +00:00
LibGUI: Don't create GMessageBox and GInputBox on the stack
We need to get rid of all instances of widgets-on-the-stack since that will no longer work in the ref-counting world.
This commit is contained in:
parent
defafd72bc
commit
31b38ed88f
7 changed files with 30 additions and 33 deletions
|
@ -92,12 +92,12 @@ int main(int argc, char** argv)
|
|||
});
|
||||
|
||||
auto mkdir_action = GAction::create("New directory...", GraphicsBitmap::load_from_file("/res/icons/16x16/mkdir.png"), [&](const GAction&) {
|
||||
GInputBox input_box("Enter name:", "New directory", window);
|
||||
if (input_box.exec() == GInputBox::ExecOK && !input_box.text_value().is_empty()) {
|
||||
auto input_box = GInputBox::construct("Enter name:", "New directory", window);
|
||||
if (input_box->exec() == GInputBox::ExecOK && !input_box->text_value().is_empty()) {
|
||||
auto new_dir_path = canonicalized_path(
|
||||
String::format("%s/%s",
|
||||
directory_view->path().characters(),
|
||||
input_box.text_value().characters()));
|
||||
input_box->text_value().characters()));
|
||||
int rc = mkdir(new_dir_path.characters(), 0777);
|
||||
if (rc < 0) {
|
||||
GMessageBox::show(String::format("mkdir(\"%s\") failed: %s", new_dir_path.characters(), strerror(errno)), "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, window);
|
||||
|
@ -216,13 +216,12 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
if (confirm == ConfirmBeforeDelete::Yes) {
|
||||
GMessageBox box(
|
||||
auto result = GMessageBox::show(
|
||||
message,
|
||||
"Confirm deletion",
|
||||
GMessageBox::Type::Warning,
|
||||
GMessageBox::InputType::OKCancel,
|
||||
window);
|
||||
auto result = box.exec();
|
||||
if (result == GMessageBox::ExecCancel)
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue