summaryrefslogtreecommitdiff
path: root/plugins/Popup/src
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 /plugins/Popup/src
parent102a413497df49bd2af8ee0a1770718fa0ecfcc2 (diff)
various TTB initialization issues
git-svn-id: http://svn.miranda-ng.org/main/trunk@3957 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Popup/src')
-rw-r--r--plugins/Popup/src/main.cpp32
1 files changed, 16 insertions, 16 deletions
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);
}