summaryrefslogtreecommitdiff
path: root/src/modules/metacontacts/meta_menu.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-20 14:47:13 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-20 14:47:13 +0000
commit5289388e941bbdeca3d380c2f1044228e3397bc0 (patch)
tree47c9611377af3f3f41ecd65eaa1df5ff6bc9b97b /src/modules/metacontacts/meta_menu.cpp
parent80578cde52fbd2e201ddc6717d689c6d71bf19a0 (diff)
db_mc_enable, db_mc_isEnabled - new functions to detect whether MC are used
git-svn-id: http://svn.miranda-ng.org/main/trunk@8666 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/metacontacts/meta_menu.cpp')
-rw-r--r--src/modules/metacontacts/meta_menu.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/modules/metacontacts/meta_menu.cpp b/src/modules/metacontacts/meta_menu.cpp
index f6116a03ea..0717647f88 100644
--- a/src/modules/metacontacts/meta_menu.cpp
+++ b/src/modules/metacontacts/meta_menu.cpp
@@ -76,7 +76,7 @@ INT_PTR Meta_Convert(WPARAM wParam, LPARAM lParam)
}
// hide the contact if clist groups disabled (shouldn't create one anyway since menus disabled)
- if (!options.bEnabled)
+ if (!db_mc_isEnabled())
db_set_b(hMetaContact, "CList", "Hidden", 1);
return hMetaContact;
@@ -318,7 +318,7 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM lParam)
}
PROTOACCOUNT *pa = Proto_GetAccount(cc->szProto);
- if (!options.bEnabled || pa->bIsVirtual) {
+ if (!db_mc_isEnabled() || pa->bIsVirtual) {
// groups disabled - all meta menu options hidden
Menu_ShowItem(hMenuDefault, false);
Menu_ShowItem(hMenuDelete, false);
@@ -360,20 +360,21 @@ INT_PTR Meta_OnOff(WPARAM wParam, LPARAM lParam)
{
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_NAME | CMIM_ICON;
- // just write to db - the rest is handled in the Meta_SettingChanged function
- if (db_get_b(0, META_PROTO, "Enabled", 1)) {
- db_set_b(0, META_PROTO, "Enabled", 0);
- // modify main mi item
+
+ bool bToggled = !db_mc_isEnabled();
+ db_set_b(0, META_PROTO, "Enabled", bToggled);
+ if (bToggled) {
mi.icolibItem = GetIconHandle(I_MENU);
mi.pszName = LPGEN("Toggle MetaContacts On");
}
else {
- db_set_b(0, META_PROTO, "Enabled", 1);
- // modify main mi item
mi.icolibItem = GetIconHandle(I_MENUOFF);
mi.pszName = LPGEN("Toggle MetaContacts Off");
}
Menu_ModifyItem(hMenuOnOff, &mi);
+
+ db_mc_enable(bToggled);
+ Meta_HideMetaContacts(bToggled);
return 0;
}
@@ -442,7 +443,7 @@ void InitMenus()
Meta_HideLinkedContacts();
- if (!options.bEnabled) {
+ if (!db_mc_isEnabled()) {
// modify main menu item
mi.flags = CMIM_NAME | CMIM_ICON;
mi.icolibItem = GetIconHandle(I_MENU);