Centralize retained dialog destroy callbacks
This commit is contained in:
@@ -263,7 +263,7 @@ void App::dialog_browse()
|
||||
if (dialog->is_selected())
|
||||
{
|
||||
open_document(dialog->selected_path);
|
||||
dialog->destroy();
|
||||
pp::panopainter::close_legacy_dialog_node(*dialog);
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -418,13 +418,13 @@ void App::dialog_resize()
|
||||
dialog->combo ? dialog->combo->m_current_index : 0);
|
||||
if (!plan)
|
||||
{
|
||||
dialog->destroy();
|
||||
pp::panopainter::close_legacy_dialog_node(*dialog);
|
||||
return;
|
||||
}
|
||||
const auto status = pp::panopainter::execute_legacy_document_resize_plan(*this, plan.value());
|
||||
if (!status.ok())
|
||||
LOG("Document resize failed: %s", status.message);
|
||||
dialog->destroy();
|
||||
pp::panopainter::close_legacy_dialog_node(*dialog);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -639,12 +639,12 @@ void App::dialog_whatsnew(bool force_show)
|
||||
whatsnew->add_button("Read Later", 120, [this, whatsnew](Node*) {
|
||||
Settings::unset("whatsnew-id");
|
||||
Settings::save();
|
||||
whatsnew->destroy();
|
||||
pp::panopainter::close_legacy_dialog_node(*whatsnew);
|
||||
});
|
||||
whatsnew->add_button("Close", 100, [this, whatsnew](Node*) {
|
||||
Settings::set<Serializer::Integer>("whatsnew-id", whatsnew->m_page_id);
|
||||
Settings::save();
|
||||
whatsnew->destroy();
|
||||
pp::panopainter::close_legacy_dialog_node(*whatsnew);
|
||||
});
|
||||
if (force_show)
|
||||
(void)pp::panopainter::attach_legacy_overlay_node(*this, whatsnew);
|
||||
|
||||
@@ -15,6 +15,11 @@ void initialize_legacy_overlay_node(App& app, Node& node)
|
||||
node.loaded();
|
||||
}
|
||||
|
||||
void close_legacy_dialog_node(Node& node)
|
||||
{
|
||||
node.destroy();
|
||||
}
|
||||
|
||||
void configure_legacy_popup_overlay(Node& node) noexcept
|
||||
{
|
||||
node.m_mouse_ignore = false;
|
||||
@@ -36,7 +41,7 @@ void close_legacy_popup_overlay(Node& node) noexcept
|
||||
|
||||
void close_legacy_dialog_and_hide_keyboard(App& app, Node& node)
|
||||
{
|
||||
node.destroy();
|
||||
close_legacy_dialog_node(node);
|
||||
app.hideKeyboard();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace pp::panopainter {
|
||||
|
||||
void initialize_legacy_overlay_node(App& app, Node& node);
|
||||
|
||||
void close_legacy_dialog_node(Node& node);
|
||||
void configure_legacy_popup_overlay(Node& node) noexcept;
|
||||
void activate_legacy_popup_overlay(Node& node) noexcept;
|
||||
void close_legacy_popup_overlay(Node& node) noexcept;
|
||||
@@ -86,7 +87,7 @@ void bind_legacy_click_destroys_node(ButtonT& button, Node& target) noexcept
|
||||
inline std::function<void(Node*)> legacy_destroy_node_callback(Node& target)
|
||||
{
|
||||
return [&target](Node*) {
|
||||
target.destroy();
|
||||
close_legacy_dialog_node(target);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user