mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-03 05:57:40 -05:00
impr: Handle provider opening more centrally, switch to existing provider if same file is being opened again
(cherry picked from commit 89004574d3)
This commit is contained in:
@@ -48,9 +48,9 @@ namespace hex::plugin::builtin {
|
||||
m_provider->save();
|
||||
}
|
||||
|
||||
[[nodiscard]] bool ViewProvider::open() {
|
||||
[[nodiscard]] prv::Provider::OpenResult ViewProvider::open() {
|
||||
if (m_provider == this)
|
||||
return false;
|
||||
return OpenResult::failure("hex.builtin.provider.view.error.no_provider"_lang);
|
||||
|
||||
EventProviderClosing::subscribe(this, [this](const prv::Provider *provider, bool*) {
|
||||
if (m_provider == provider) {
|
||||
@@ -59,7 +59,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
return {};
|
||||
}
|
||||
void ViewProvider::close() {
|
||||
EventProviderClosing::unsubscribe(this);
|
||||
|
||||
Reference in New Issue
Block a user