diff options
author | saturneric <[email protected]> | 2023-10-25 14:28:25 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2023-10-25 14:28:25 +0000 |
commit | b7ceed0b87752077fe19fefe9b0df8ec27ce0531 (patch) | |
tree | 51cb5f2a9210dabaa585b65d085f336cc5f0f844 /src/core/GpgCoreInit.cpp | |
parent | fix: solve some code tidy issues (diff) | |
download | GpgFrontend-b7ceed0b87752077fe19fefe9b0df8ec27ce0531.tar.gz GpgFrontend-b7ceed0b87752077fe19fefe9b0df8ec27ce0531.zip |
feat: moving gnupg info gathering logic to a new module
Diffstat (limited to 'src/core/GpgCoreInit.cpp')
-rw-r--r-- | src/core/GpgCoreInit.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp index 78f3ed7a..728bc93d 100644 --- a/src/core/GpgCoreInit.cpp +++ b/src/core/GpgCoreInit.cpp @@ -38,6 +38,7 @@ #include "core/GpgContext.h" #include "core/function/GlobalSettingStation.h" #include "core/function/gpg/GpgAdvancedOperator.h" +#include "core/module/ModuleManager.h" #include "core/thread/Task.h" #include "core/thread/TaskRunner.h" #include "core/thread/TaskRunnerGetter.h" @@ -101,7 +102,7 @@ void ShutdownCoreLoggingSystem() { void ResetGpgFrontendCore() { reset_gpgfrontend_core(); } -void init_gpgfrontend_core() { +void InitGpgFrontendCore() { /* Initialize the locale environment. */ SPDLOG_DEBUG("locale: {}", setlocale(LC_CTYPE, nullptr)); // init gpgme subsystem @@ -241,8 +242,19 @@ void init_gpgfrontend_core() { }, "default_channel_ctx_init")); - // try to restart all components - GpgFrontend::GpgAdvancedOperator::GetInstance().RestartGpgComponents(); + 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::GetInstance().RestartGpgComponents(); + }); + Module::TriggerEvent("GPGFRONTEND_CORE_INITLIZED"); } void reset_gpgfrontend_core() { SingletonStorageCollection::GetInstance(true); } |