diff options
author | saturneric <[email protected]> | 2023-11-02 01:59:40 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2023-11-02 01:59:40 +0000 |
commit | b219d1c9d0f6e9542b0b4f3f62c4dd368413ddec (patch) | |
tree | 5fea5953addaa157d644dc07faec76363bec0f00 /src/core/GpgCoreInit.cpp | |
parent | style: improve code style of core (diff) | |
download | GpgFrontend-b219d1c9d0f6e9542b0b4f3f62c4dd368413ddec.tar.gz GpgFrontend-b219d1c9d0f6e9542b0b4f3f62c4dd368413ddec.zip |
feat: add callback function to event
Diffstat (limited to 'src/core/GpgCoreInit.cpp')
-rw-r--r-- | src/core/GpgCoreInit.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp index e9696041..c1db2d9d 100644 --- a/src/core/GpgCoreInit.cpp +++ b/src/core/GpgCoreInit.cpp @@ -241,19 +241,20 @@ void InitGpgFrontendCore() { }, "default_channel_ctx_init")); - Module::ListenRTPublishEvent( - &default_ctx, - Module::GetRealModuleIdentifier( - "com.bktus.gpgfrontend.module.integrated.gnupginfogathering"), - "gnupg.gathering_done", - [=](Module::Namespace, Module::Key, int, std::any) { - SPDLOG_DEBUG( - "gnupginfogathering gnupg.gathering_done changed, restarting gpg " - "components"); - // try to restart all components - GpgFrontend::GpgAdvancedOperator::RestartGpgComponents(); + Module::TriggerEvent( + "GPGFRONTEND_CORE_INITLIZED", + [](const Module::EventIdentifier& /*e*/, + const Module::Event::ListenerIdentifier& l_id, DataObjectPtr o) { + if (l_id == Module::GetRealModuleIdentifier( + "com.bktus.gpgfrontend.module.integrated." + "gnupginfogathering")) { + SPDLOG_DEBUG( + "gnupginfogathering gnupg.gathering_done changed, restarting gpg " + "components"); + // try to restart all components + GpgFrontend::GpgAdvancedOperator::RestartGpgComponents(); + } }); - Module::TriggerEvent("GPGFRONTEND_CORE_INITLIZED"); } void reset_gpgfrontend_core() { SingletonStorageCollection::GetInstance(true); } |