From 488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 12 Nov 2018 20:12:53 +0300 Subject: end of ME_OPT_INITIALISE related zoo in another plugins --- plugins/TipperYM/src/options.cpp | 9 --------- plugins/TipperYM/src/options.h | 3 ++- plugins/TipperYM/src/tipper.cpp | 24 ++++++------------------ 3 files changed, 8 insertions(+), 28 deletions(-) (limited to 'plugins/TipperYM/src') diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 8b0c73ba99..888e848fd3 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -2120,17 +2120,8 @@ int OptInit(WPARAM wParam, LPARAM) return 0; } -HANDLE hEventOptInit; - -void InitOptions() -{ - hEventOptInit = HookEvent(ME_OPT_INITIALISE, OptInit); -} - void DeinitOptions() { - UnhookEvent(hEventOptInit); - DIListNode *di_node = opt.diList; while (opt.diList) { di_node = opt.diList; diff --git a/plugins/TipperYM/src/options.h b/plugins/TipperYM/src/options.h index 3161b5e2d4..da77526992 100644 --- a/plugins/TipperYM/src/options.h +++ b/plugins/TipperYM/src/options.h @@ -191,7 +191,8 @@ typedef struct { extern OPTIONS opt; -void InitOptions(); +int OptInit(WPARAM wParam, LPARAM); + void LoadOptions(); void SaveOptions(); void DeinitOptions(); diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index d7fcb2e9a4..3c048e0489 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -28,8 +28,6 @@ HFONT hFontTitle, hFontLabels, hFontValues, hFontTrayTitle; // hooked here so it's in the main thread HANDLE hAvChangeEvent, hShowTipEvent, hHideTipEvent, hAckEvent, hFramesSBShow, hFramesSBHide; -HANDLE hSettingChangedEvent, hEventDeleted; -HANDLE hReloadFonts = nullptr; HANDLE hFolderChanged, hSkinFolder; wchar_t SKIN_FOLDER[256]; @@ -221,7 +219,7 @@ static void InitFonts() g_plugin.addFont(&fontValues); g_plugin.addFont(&fontTrayTitle); - hReloadFonts = HookEvent(ME_FONT_RELOAD, ReloadFont); + HookEvent(ME_FONT_RELOAD, ReloadFont); } static int ModulesLoaded(WPARAM, LPARAM) @@ -271,8 +269,6 @@ int Shutdown(WPARAM, LPARAM) return 0; } -HANDLE hEventPreShutdown, hEventModulesLoaded; - static INT_PTR ReloadSkin(WPARAM wParam, LPARAM lParam) { LoadOptions(); @@ -312,7 +308,6 @@ int CMPlugin::Load() InitTranslations(); InitMessagePump(); - InitOptions(); // for compatibility with mToolTip status tooltips CreateServiceFunction("mToolTip/ShowTip", ShowTip); @@ -320,12 +315,11 @@ int CMPlugin::Load() CreateServiceFunction("mToolTip/HideTip", HideTip); CreateServiceFunction("mToolTip/ReloadSkin", ReloadSkin); - hEventPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, Shutdown); - hEventModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); - - hSettingChangedEvent = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SettingChanged); - hEventDeleted = HookEvent(ME_DB_EVENT_DELETED, EventDeleted); - + HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SettingChanged); + HookEvent(ME_DB_EVENT_DELETED, EventDeleted); + HookEvent(ME_OPT_INITIALISE, OptInit); + HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + HookEvent(ME_SYSTEM_PRESHUTDOWN, Shutdown); return 0; } @@ -333,12 +327,6 @@ int CMPlugin::Load() int CMPlugin::Unload() { - UnhookEvent(hSettingChangedEvent); - UnhookEvent(hEventDeleted); - UnhookEvent(hEventPreShutdown); - UnhookEvent(hEventModulesLoaded); - UnhookEvent(hReloadFonts); - DeinitOptions(); DeleteObject(hFontTitle); DeleteObject(hFontLabels); -- cgit v1.2.3