fix: Window header always displaying (Read Only) after opening a provider
This commit is contained in:
parent
c0a5e2012f
commit
dacb64ae66
@ -114,7 +114,7 @@ namespace hex {
|
||||
|
||||
if (ImHexApi::Provider::isValid()) {
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
if (!windowTitle.empty())
|
||||
if (!windowTitle.empty() && provider != nullptr) {
|
||||
title += " - " + windowTitle;
|
||||
|
||||
if (provider->isDirty())
|
||||
@ -123,6 +123,7 @@ namespace hex {
|
||||
if (!provider->isWritable())
|
||||
title += " (Read Only)";
|
||||
}
|
||||
}
|
||||
|
||||
this->m_windowTitle = title;
|
||||
glfwSetWindowTitle(this->m_window, title.c_str());
|
||||
|
@ -44,13 +44,18 @@ namespace hex::plugin::builtin {
|
||||
EventManager::subscribe<EventProviderChanged>([](hex::prv::Provider *oldProvider, hex::prv::Provider *newProvider) {
|
||||
hex::unused(oldProvider);
|
||||
|
||||
if (newProvider != nullptr) {
|
||||
if (newProvider != nullptr && newProvider->isAvailable()) {
|
||||
EventManager::post<RequestChangeWindowTitle>(newProvider->getName());
|
||||
} else {
|
||||
EventManager::post<RequestChangeWindowTitle>("");
|
||||
}
|
||||
});
|
||||
|
||||
EventManager::subscribe<EventProviderOpened>([](hex::prv::Provider *provider) {
|
||||
if (provider != nullptr && ImHexApi::Provider::get() == provider)
|
||||
EventManager::post<RequestChangeWindowTitle>(provider->getName());
|
||||
});
|
||||
|
||||
EventManager::subscribe<RequestOpenFile>(openFile);
|
||||
|
||||
EventManager::subscribe<RequestOpenWindow>([](const std::string &name) {
|
||||
|
Loading…
Reference in New Issue
Block a user