summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-10 12:45:32 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-10 12:45:32 +0000
commit6ac63284a8f93f977db66673727d4995a86764c4 (patch)
tree79d7e0b6744e1de21e6c01c0b0869be8927621a1
parent102a413497df49bd2af8ee0a1770718fa0ecfcc2 (diff)
various TTB initialization issues
git-svn-id: http://svn.miranda-ng.org/main/trunk@3957 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Alarms/src/alarms.cpp5
-rw-r--r--plugins/AutoShutdown/src/common.h2
-rw-r--r--plugins/AutoShutdown/src/main.cpp7
-rw-r--r--plugins/AutoShutdown/src/settingsdlg.cpp31
-rw-r--r--plugins/BasicHistory/src/BasicHistory.cpp21
-rw-r--r--plugins/BossKeyPlus/src/BossKey.cpp13
-rw-r--r--plugins/Console/src/Console.cpp3
-rw-r--r--plugins/FavContacts/src/main.cpp13
-rw-r--r--plugins/NewXstatusNotify/src/main.cpp3
-rw-r--r--plugins/Popup/src/main.cpp32
-rw-r--r--plugins/Sessions/Src/Main.cpp44
-rw-r--r--plugins/StatusPlugins/StartupStatus/profiles.cpp3
-rw-r--r--plugins/StatusPlugins/StartupStatus/startupstatus.h1
-rw-r--r--plugins/StatusPlugins/StartupStatus/toolbars.cpp10
-rw-r--r--plugins/UserInfoEx/src/dlg_anniversarylist.cpp3
-rw-r--r--plugins/UserInfoEx/src/init.cpp23
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.cpp4
-rw-r--r--plugins/WhenWasIt/src/hooked_events.cpp3
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp29
19 files changed, 104 insertions, 146 deletions
diff --git a/plugins/Alarms/src/alarms.cpp b/plugins/Alarms/src/alarms.cpp
index 0935a0527c..c447730f7b 100644
--- a/plugins/Alarms/src/alarms.cpp
+++ b/plugins/Alarms/src/alarms.cpp
@@ -165,15 +165,14 @@ HBITMAP LoadBmpFromIcon(int IdRes)
static int InitTopToolbarButton(WPARAM wParam, LPARAM lParam)
{
- TTBButton ttb = {0};
- ttb.cbSize = sizeof(ttb);
+ TTBButton ttb = { sizeof(ttb) };
ttb.hIconUp = LoadIcon(hInst, MAKEINTRESOURCE(IDI_TBUP));
ttb.hIconDn = LoadIcon(hInst, MAKEINTRESOURCE(IDI_TBDN));
ttb.pszService = MODULE "/NewAlarm";
ttb.dwFlags = TTBBF_VISIBLE;
ttb.name = ttb.pszTooltipUp = LPGEN("Set Alarm");
-
hTopToolbarButton = TopToolbar_AddButton(&ttb);
+
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTopToolbarButton, (LPARAM)TTBST_RELEASED);
return 0;
}
diff --git a/plugins/AutoShutdown/src/common.h b/plugins/AutoShutdown/src/common.h
index 1fb595186d..4c117f02ee 100644
--- a/plugins/AutoShutdown/src/common.h
+++ b/plugins/AutoShutdown/src/common.h
@@ -72,3 +72,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "watcher.h"
#include "resource.h"
#include "version.h"
+
+extern IconItem iconList[]; \ No newline at end of file
diff --git a/plugins/AutoShutdown/src/main.cpp b/plugins/AutoShutdown/src/main.cpp
index b65d990d7a..da5450c630 100644
--- a/plugins/AutoShutdown/src/main.cpp
+++ b/plugins/AutoShutdown/src/main.cpp
@@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "common.h"
HINSTANCE hInst;
-static HANDLE hHookModulesLoaded;
int hLangpack;
PLUGININFOEX pluginInfo = {
@@ -53,7 +52,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, VOID *pReserved)
static int ShutdownModulesLoaded(WPARAM wParam,LPARAM lParam)
{
- if(ServiceExists("DBEditorpp/RegisterSingleModule"))
+ if ( ServiceExists("DBEditorpp/RegisterSingleModule"))
CallService("DBEditorpp/RegisterSingleModule",(WPARAM)"AutoShutdown",0);
return 0;
@@ -82,14 +81,12 @@ extern "C" __declspec(dllexport) int Load(void)
InitSettingsDlg();
InitOptions();
- hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ShutdownModulesLoaded);
+ HookEvent(ME_SYSTEM_MODULESLOADED, ShutdownModulesLoaded);
return 0;
}
extern "C" __declspec(dllexport) int Unload(void)
{
- UnhookEvent(hHookModulesLoaded);
-
UninitOptions();
UninitSettingsDlg(); /* before UninitWatcher() */
UninitWatcher(); /* before UninitFrame() */
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp
index f528822c31..84fa86b5e4 100644
--- a/plugins/AutoShutdown/src/settingsdlg.cpp
+++ b/plugins/AutoShutdown/src/settingsdlg.cpp
@@ -23,8 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* Menu Item */
static HANDLE hServiceMenuCommand;
-/* Toolbar Button */
-static HANDLE hHookToolbarLoaded;
/* Services */
static HANDLE hServiceShowDlg;
static HWND hwndSettingsDlg;
@@ -407,20 +405,15 @@ static HANDLE hToolbarButton;
static int ToolbarLoaded(WPARAM wParam,LPARAM lParam)
{
- TTBButton ttbb = {0};
- ttbb.cbSize = sizeof(ttbb);
- /* toptoolbar offers icolib support */
- ttbb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_ACTIVE), IMAGE_ICON, 0, 0, 0);
- ttbb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_INACTIVE), IMAGE_ICON, 0, 0, 0);
- ttbb.pszService = "AutoShutdown/MenuCommand";
- ttbb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
- ttbb.name = LPGEN("Start/Stop automatic shutdown");
- ttbb.pszTooltipUp = LPGEN("Stop automatic shutdown");
- ttbb.pszTooltipDn = LPGEN("Start automatic shutdown");
-
- hToolbarButton = TopToolbar_AddButton(&ttbb);
- if(ttbb.hIconUp != NULL) DestroyIcon(ttbb.hIconUp);
- if(ttbb.hIconDn != NULL) DestroyIcon(ttbb.hIconDn);
+ TTBButton ttb = { sizeof(ttb) };
+ ttb.hIconHandleUp = iconList[1].hIcolib;
+ ttb.hIconHandleDn = iconList[2].hIcolib;
+ ttb.pszService = "AutoShutdown/MenuCommand";
+ ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
+ ttb.name = LPGEN("Start/Stop automatic shutdown");
+ ttb.pszTooltipUp = LPGEN("Stop automatic shutdown");
+ ttb.pszTooltipDn = LPGEN("Start automatic shutdown");
+ hToolbarButton = TopToolbar_AddButton(&ttb);
return 0;
}
@@ -435,7 +428,6 @@ void SetShutdownToolbarButton(BOOL fActive)
/************************* Menu Item **********************************/
static HANDLE hMainMenuItem,hTrayMenuItem;
-extern IconItem iconList[];
void SetShutdownMenuItem(BOOL fActive)
{
@@ -482,8 +474,7 @@ void InitSettingsDlg(void)
hMainMenuItem=hTrayMenuItem=NULL;
SetShutdownMenuItem(FALSE);
/* Toolbar Item */
- hToolbarButton=0;
- hHookToolbarLoaded=HookEvent(ME_TTB_MODULELOADED,ToolbarLoaded); /* no service to check for */
+ HookEvent(ME_TTB_MODULELOADED,ToolbarLoaded); /* no service to check for */
/* Hotkey */
AddHotkey();
/* Services */
@@ -493,8 +484,6 @@ void InitSettingsDlg(void)
void UninitSettingsDlg(void)
{
- /* Toolbar Item */
- UnhookEvent(hHookToolbarLoaded);
/* Menu Item */
DestroyServiceFunction(hServiceMenuCommand);
/* Services */
diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp
index c9b6920d67..7083ac7e4a 100644
--- a/plugins/BasicHistory/src/BasicHistory.cpp
+++ b/plugins/BasicHistory/src/BasicHistory.cpp
@@ -96,15 +96,12 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam)
int ToolbarModuleLoaded(WPARAM wParam,LPARAM lParam)
{
- if(ServiceExists(MS_TTB_REMOVEBUTTON)) {
- TTBButton tbb = {0};
- tbb.cbSize = sizeof(tbb);
- tbb.pszService = MS_HISTORY_SHOWCONTACTHISTORY;
- tbb.name = tbb.pszTooltipUp = LPGEN("Open History");
- tbb.dwFlags = TTBBF_SHOWTOOLTIP;
- tbb.hIconHandleUp = LoadSkinnedIconHandle(SKINICON_OTHER_HISTORY);
- hToolbarButton = TopToolbar_AddButton(&tbb);
- }
+ TTBButton ttb = { sizeof(ttb) };
+ ttb.pszService = MS_HISTORY_SHOWCONTACTHISTORY;
+ ttb.name = ttb.pszTooltipUp = LPGEN("Open History");
+ ttb.dwFlags = TTBBF_SHOWTOOLTIP;
+ ttb.hIconHandleUp = LoadSkinnedIconHandle(SKINICON_OTHER_HISTORY);
+ hToolbarButton = TopToolbar_AddButton(&ttb);
return 0;
}
@@ -269,9 +266,9 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
Options::instance->Load();
InitTaskMenuItems();
- HookEvent(ME_TTB_MODULELOADED,ToolbarModuleLoaded);
- HookEvent(ME_SYSTEM_PRESHUTDOWN,PreShutdownHistoryModule);
- HookEvent(ME_DB_CONTACT_DELETED,HistoryContactDelete);
+ HookEvent(ME_TTB_MODULELOADED, ToolbarModuleLoaded);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdownHistoryModule);
+ HookEvent(ME_DB_CONTACT_DELETED, HistoryContactDelete);
HookEvent(ME_FONT_RELOAD, HistoryWindow::FontsChanged);
HookEvent(ME_SYSTEM_OKTOEXIT, DoLastTask);
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp
index 7331e958c7..4802db7834 100644
--- a/plugins/BossKeyPlus/src/BossKey.cpp
+++ b/plugins/BossKeyPlus/src/BossKey.cpp
@@ -652,13 +652,12 @@ void RegisterCoreHotKeys (void)
static int ModernToolbarInit(WPARAM, LPARAM) // Modern toolbar support
{
- TTBButton button = {0};
- button.cbSize = sizeof(button);
- button.pszService = MS_BOSSKEY_HIDE;
- button.pszTooltipUp = button.name = LPGEN("Hide Miranda NG");
- button.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
- button.hIconHandleUp = iconList[0].hIcolib;
- TopToolbar_AddButton(&button);
+ TTBButton ttb = { sizeof(ttb) };
+ ttb.pszService = MS_BOSSKEY_HIDE;
+ ttb.pszTooltipUp = ttb.name = LPGEN("Hide Miranda NG");
+ ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
+ ttb.hIconHandleUp = iconList[0].hIcolib;
+ TopToolbar_AddButton(&ttb);
return 0;
}
diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp
index e0a12e53c3..b3096178e6 100644
--- a/plugins/Console/src/Console.cpp
+++ b/plugins/Console/src/Console.cpp
@@ -122,9 +122,6 @@ static IconItem iconList[] =
static int OnTTBLoaded(WPARAM wParam,LPARAM lParam)
{
- if ( !IsWindow(hwndConsole))
- return 0;
-
int state = IsWindowVisible(hwndConsole);
Icon_Register(hInst, "Console", iconList, SIZEOF(iconList));
diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp
index 6271074da6..394a167166 100644
--- a/plugins/FavContacts/src/main.cpp
+++ b/plugins/FavContacts/src/main.cpp
@@ -94,13 +94,12 @@ static __forceinline COLORREF sttShadeColor(COLORREF clLine1, COLORREF clBack)
int ProcessTBLoaded(WPARAM wParam, LPARAM lParam)
{
- TTBButton button = {0};
- button.cbSize = sizeof(button);
- button.pszTooltipUp = button.name = LPGEN("Favourite Contacts");
- button.pszService = MS_FAVCONTACTS_SHOWMENU;
- button.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE;
- button.hIconHandleUp = iconList[0].hIcolib;
- TopToolbar_AddButton(&button);
+ TTBButton ttb = { sizeof(ttb) };
+ ttb.pszTooltipUp = ttb.name = LPGEN("Favourite Contacts");
+ ttb.pszService = MS_FAVCONTACTS_SHOWMENU;
+ ttb.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE;
+ ttb.hIconHandleUp = iconList[0].hIcolib;
+ TopToolbar_AddButton(&ttb);
return 0;
}
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp
index fcd3287d23..ac70bbbef3 100644
--- a/plugins/NewXstatusNotify/src/main.cpp
+++ b/plugins/NewXstatusNotify/src/main.cpp
@@ -1093,8 +1093,7 @@ void InitSound()
int InitTopToolbar(WPARAM, LPARAM)
{
- TTBButton tbb = {0};
- tbb.cbSize = sizeof(TTBButton);
+ TTBButton tbb = { sizeof(tbb) };
tbb.pszService = MS_STATUSCHANGE_MENUCOMMAND;
tbb.dwFlags = (opt.TempDisabled ? 0 : TTBBF_PUSHED) | TTBBF_ASPUSHBUTTON;
tbb.name = LPGEN("Toggle status notification");
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp
index 88cf04ceb4..7a3638ddf3 100644
--- a/plugins/Popup/src/main.cpp
+++ b/plugins/Popup/src/main.cpp
@@ -142,21 +142,18 @@ static int IconsChanged(WPARAM wParam,LPARAM lParam)
static int TTBLoaded(WPARAM wParam,LPARAM lParam)
{
- if ( !hTTButton) {
- TTBButton btn = {0};
- btn.cbSize = sizeof(btn);
- btn.pszService = MENUCOMMAND_SVC;
- btn.lParamUp = 1;
- btn.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ASPUSHBUTTON;
- btn.name = LPGEN("Toggle Popups");
- btn.hIconHandleUp = Skin_GetIconHandle(ICO_TB_POPUP_OFF);
- btn.hIconHandleDn = Skin_GetIconHandle(ICO_TB_POPUP_ON);
- btn.pszTooltipUp = LPGEN("Enable popups");
- btn.pszTooltipDn = LPGEN("Disable popups");
- hTTButton = TopToolbar_AddButton(&btn);
- }
-
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, (PopUpOptions.ModuleIsEnabled) ? TTBST_PUSHED : TTBST_RELEASED);
+ TTBButton ttb = { sizeof(ttb) };
+ ttb.pszService = MENUCOMMAND_SVC;
+ ttb.lParamUp = 1;
+ ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ASPUSHBUTTON;
+ if (PopUpOptions.ModuleIsEnabled)
+ ttb.dwFlags |= TTBBF_PUSHED;
+ ttb.name = LPGEN("Toggle Popups");
+ ttb.hIconHandleUp = Skin_GetIconHandle(ICO_TB_POPUP_OFF);
+ ttb.hIconHandleDn = Skin_GetIconHandle(ICO_TB_POPUP_ON);
+ ttb.pszTooltipUp = LPGEN("Enable popups");
+ ttb.pszTooltipDn = LPGEN("Disable popups");
+ hTTButton = TopToolbar_AddButton(&ttb);
return 0;
}
@@ -187,7 +184,10 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM wp, LPARAM lp)
iResult = CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hMenuItem,(LPARAM)&mi);
mi.flags = CMIM_ICON;
iResultRoot = CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hMenuRoot,(LPARAM)&mi);
- TTBLoaded(0,0);
+
+ if (hTTButton)
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, (PopUpOptions.ModuleIsEnabled) ? TTBST_PUSHED : TTBST_RELEASED);
+
return (iResult != 0 && iResultRoot != 0);
}
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp
index ae81054d33..89ef6e1266 100644
--- a/plugins/Sessions/Src/Main.cpp
+++ b/plugins/Sessions/Src/Main.cpp
@@ -851,28 +851,28 @@ INT_PTR BuildFavMenu(WPARAM wparam,LPARAM lparam)
static int CreateButtons(WPARAM wparam,LPARAM lparam)
{
- TTBButton button = {0};
- button.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE;
-
- button.pszService = MS_SESSIONS_OPENMANAGER;
- button.pszTooltipUp = button.name = LPGEN("Open Sessions Manager");
- button.hIconHandleUp = iconList[3].hIcolib;
- TopToolbar_AddButton(&button);
-
- button.pszService = MS_SESSIONS_SAVEUSERSESSION;
- button.pszTooltipUp = button.name = LPGEN("Save Session");
- button.hIconHandleUp = iconList[4].hIcolib;
- TopToolbar_AddButton(&button);
-
- button.pszService = MS_SESSIONS_RESTORELASTSESSION;
- button.pszTooltipUp = button.name = LPGEN("Restore Last Session");
- button.hIconHandleUp = iconList[5].hIcolib;
- TopToolbar_AddButton(&button);
-
- button.pszService = MS_SESSIONS_SHOWFAVORITESMENU;
- button.pszTooltipUp = button.name = LPGEN("Show Favorite Sessions Menu");
- button.hIconHandleUp = iconList[1].hIcolib;
- TopToolbar_AddButton(&button);
+ TTBButton ttb = { sizeof(ttb) };
+ ttb.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE;
+
+ ttb.pszService = MS_SESSIONS_OPENMANAGER;
+ ttb.pszTooltipUp = ttb.name = LPGEN("Open Sessions Manager");
+ ttb.hIconHandleUp = iconList[3].hIcolib;
+ TopToolbar_AddButton(&ttb);
+
+ ttb.pszService = MS_SESSIONS_SAVEUSERSESSION;
+ ttb.pszTooltipUp = ttb.name = LPGEN("Save Session");
+ ttb.hIconHandleUp = iconList[4].hIcolib;
+ TopToolbar_AddButton(&ttb);
+
+ ttb.pszService = MS_SESSIONS_RESTORELASTSESSION;
+ ttb.pszTooltipUp = ttb.name = LPGEN("Restore Last Session");
+ ttb.hIconHandleUp = iconList[5].hIcolib;
+ TopToolbar_AddButton(&ttb);
+
+ ttb.pszService = MS_SESSIONS_SHOWFAVORITESMENU;
+ ttb.pszTooltipUp = ttb.name = LPGEN("Show Favorite Sessions Menu");
+ ttb.hIconHandleUp = iconList[1].hIcolib;
+ TopToolbar_AddButton(&ttb);
return 0;
}
diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp
index aa417e7672..c38364fd8d 100644
--- a/plugins/StatusPlugins/StartupStatus/profiles.cpp
+++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp
@@ -377,8 +377,7 @@ int LoadProfileModule()
int InitProfileModule()
{
- if ((hTTBModuleLoadedHook = HookEvent(ME_TTB_MODULELOADED, CreateTopToolbarButtons)) != NULL)
- RegisterButtons();
+ hTTBModuleLoadedHook = HookEvent(ME_TTB_MODULELOADED, CreateTopToolbarButtons);
HookEvent( ME_CLIST_PREBUILDSTATUSMENU, CreateMainMenuItems);
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.h b/plugins/StatusPlugins/StartupStatus/startupstatus.h
index f76f1a468a..a54be8f70c 100644
--- a/plugins/StatusPlugins/StartupStatus/startupstatus.h
+++ b/plugins/StatusPlugins/StartupStatus/startupstatus.h
@@ -156,7 +156,6 @@ INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam);
extern HANDLE hTTBModuleLoadedHook;
void RemoveTopToolbarButtons();
int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam);
-void RegisterButtons();
int LoadProfileModule();
int InitProfileModule();
diff --git a/plugins/StatusPlugins/StartupStatus/toolbars.cpp b/plugins/StatusPlugins/StartupStatus/toolbars.cpp
index 6d9c62ea1d..ffabfcd152 100644
--- a/plugins/StatusPlugins/StartupStatus/toolbars.cpp
+++ b/plugins/StatusPlugins/StartupStatus/toolbars.cpp
@@ -44,6 +44,9 @@ void RemoveTopToolbarButtons()
int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam)
{
+ if (iconList[0].hIcolib == NULL)
+ Icon_Register(hInst, "Toolbar/StartupStatus", iconList, SIZEOF(iconList));
+
int profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0);
TTBButton ttb = { 0 };
@@ -72,10 +75,3 @@ int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam)
}
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-void RegisterButtons()
-{
- Icon_Register(hInst, "Toolbar/StartupStatus", iconList, SIZEOF(iconList));
-}
diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
index 5db440fb3e..ba8414a843 100644
--- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
+++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp
@@ -1080,8 +1080,7 @@ INT_PTR DlgAnniversaryListShow(WPARAM wParam, LPARAM lParam)
VOID DlgAnniversaryListOnTopToolBarLoaded()
{
- TTBButton ttb = {0};
- ttb.cbSize = sizeof(ttb);
+ TTBButton ttb = { sizeof(ttb) };
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
ttb.pszService = MS_USERINFO_REMINDER_LIST;
ttb.hIconHandleUp = Skin_GetIconHandle(ICO_COMMON_ANNIVERSARY);
diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp
index 8890c9bd51..879d7df5b5 100644
--- a/plugins/UserInfoEx/src/init.cpp
+++ b/plugins/UserInfoEx/src/init.cpp
@@ -57,11 +57,6 @@ static PLUGININFOEX pluginInfo = {
{0x9c23a24b, 0xe6aa, 0x43c6, {0xb0, 0xb8, 0xd6, 0xc3, 0x6d, 0x2f, 0x7b, 0x57}}
};
-static HANDLE ghModulesLoadedHook = NULL;
-static HANDLE ghTopToolBarLoaded = NULL;
-static HANDLE ghModernToolBarLoaded = NULL;
-static HANDLE ghShutdownHook = NULL;
-static HANDLE ghPrebuildStatusMenu = NULL;
int hLangpack;
/*
@@ -122,7 +117,7 @@ static INT OnModulesLoaded(WPARAM wParam, LPARAM lParam)
// build contact's menuitems
RebuildMenu();
- ghPrebuildStatusMenu = HookEvent( ME_CLIST_PREBUILDSTATUSMENU, (MIRANDAHOOK)RebuildAccount);
+ HookEvent( ME_CLIST_PREBUILDSTATUSMENU, (MIRANDAHOOK)RebuildAccount);
// install known modules strings to database
DB::Setting::WriteAString(NULL, "KnownModules", MODULELONGNAME, USERINFO","MODNAME","MOD_MBIRTHDAY","MODNAMEFLAGS);
@@ -132,7 +127,6 @@ static INT OnModulesLoaded(WPARAM wParam, LPARAM lParam)
static INT OnShutdown(WPARAM wParam, LPARAM lParam)
{
- UnhookEvent(ghShutdownHook);
DlgContactInfoUnLoadModule();
SvcReminderUnloadModule();
@@ -141,7 +135,6 @@ static INT OnShutdown(WPARAM wParam, LPARAM lParam)
CtrlButtonUnloadModule();
SvcConstantsUnloadModule();
- UnhookEvent(ghPrebuildStatusMenu);
SvcEMailUnloadModule();
SvcFlagsUnloadModule();
SvcGenderUnloadModule();
@@ -256,9 +249,9 @@ extern "C" INT __declspec(dllexport) Load(void)
SvcReminderLoadModule();
// Now the module is loaded! Start initializing certain things
- ghModulesLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- ghTopToolBarLoaded = HookEvent(ME_TTB_MODULELOADED, OnTopToolBarLoaded);
- ghShutdownHook = HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ HookEvent(ME_TTB_MODULELOADED, OnTopToolBarLoaded);
+ HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
return 0;
}
@@ -269,10 +262,8 @@ extern "C" INT __declspec(dllexport) Load(void)
**/
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID lpvReserved)
{
- switch (fdwReason) {
- case DLL_PROCESS_ATTACH:
- ghInst = hinst;
- break;
- }
+ if (fdwReason == DLL_PROCESS_ATTACH)
+ ghInst = hinst;
+
return TRUE;
}
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp
index 79dccee665..3bfc5b6084 100644
--- a/plugins/UserInfoEx/src/svc_reminder.cpp
+++ b/plugins/UserInfoEx/src/svc_reminder.cpp
@@ -782,9 +782,7 @@ static INT OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcw
VOID SvcReminderOnTopToolBarLoaded()
{
- TTBButton ttb = {0};
- ttb.cbSize = sizeof(ttb);
-
+ TTBButton ttb = { sizeof(ttb) };
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
ttb.pszService = MS_USERINFO_REMINDER_CHECK;
ttb.name = ttb.pszTooltipUp = LPGEN("Check anniversaries");
diff --git a/plugins/WhenWasIt/src/hooked_events.cpp b/plugins/WhenWasIt/src/hooked_events.cpp
index 758b4f4bea..2f646eaf6a 100644
--- a/plugins/WhenWasIt/src/hooked_events.cpp
+++ b/plugins/WhenWasIt/src/hooked_events.cpp
@@ -120,8 +120,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
int OnTopToolBarModuleLoaded(WPARAM wParam, LPARAM lParam)
{
- TTBButton ttb = {0};
- ttb.cbSize = sizeof(ttb);
+ TTBButton ttb = { sizeof(ttb) };
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
ttb.pszService = MS_WWI_CHECK_BIRTHDAYS;
ttb.hIconHandleUp = hCheckMenu;
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index 6341669e62..833753eb2b 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -948,27 +948,26 @@ int g_OnToolbarInit(WPARAM, LPARAM)
if (g_Instances.getCount() == 0)
return 0;
- TTBButton button = {0};
- button.cbSize = sizeof(button);
- button.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE;
+ TTBButton ttb = { sizeof(ttb) };
+ ttb.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE;
CreateServiceFunction("JABBER/*/Groupchat", g_ToolbarHandleJoinGroupchat);
- button.pszService = "JABBER/*/Groupchat";
- button.pszTooltipUp = button.name = LPGEN("Join conference");
- button.hIconHandleUp = g_GetIconHandle(IDI_GROUP);
- TopToolbar_AddButton(&button);
+ ttb.pszService = "JABBER/*/Groupchat";
+ ttb.pszTooltipUp = ttb.name = LPGEN("Join conference");
+ ttb.hIconHandleUp = g_GetIconHandle(IDI_GROUP);
+ TopToolbar_AddButton(&ttb);
CreateServiceFunction("JABBER/*/Bookmarks", g_ToolbarHandleBookmarks);
- button.pszService = "JABBER/*/Bookmarks";
- button.pszTooltipUp = button.name = LPGEN("Open bookmarks");
- button.hIconHandleUp = g_GetIconHandle(IDI_BOOKMARKS);
- TopToolbar_AddButton(&button);
+ ttb.pszService = "JABBER/*/Bookmarks";
+ ttb.pszTooltipUp = ttb.name = LPGEN("Open bookmarks");
+ ttb.hIconHandleUp = g_GetIconHandle(IDI_BOOKMARKS);
+ TopToolbar_AddButton(&ttb);
CreateServiceFunction("JABBER/*/ServiceDiscovery", g_ToolbarHandleServiceDiscovery);
- button.pszService = "JABBER/*/ServiceDiscovery";
- button.pszTooltipUp = button.name = LPGEN("Service discovery");
- button.hIconHandleUp = g_GetIconHandle(IDI_SERVICE_DISCOVERY);
- TopToolbar_AddButton(&button);
+ ttb.pszService = "JABBER/*/ServiceDiscovery";
+ ttb.pszTooltipUp = ttb.name = LPGEN("Service discovery");
+ ttb.hIconHandleUp = g_GetIconHandle(IDI_SERVICE_DISCOVERY);
+ TopToolbar_AddButton(&ttb);
return 0;
}