From b665a90f50f09435aef5bc3b5b9da710e4558690 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 5 Apr 2013 16:54:27 +0000 Subject: various menu items quirks, simplifications & optimization git-svn-id: http://svn.miranda-ng.org/main/trunk@4319 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Gadu-Gadu/src/gg.cpp | 8 ++++---- protocols/Gadu-Gadu/src/gg_proto.h | 14 ++++++-------- protocols/Gadu-Gadu/src/links.cpp | 15 +++++---------- 3 files changed, 15 insertions(+), 22 deletions(-) (limited to 'protocols/Gadu-Gadu/src') diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 57dcf2a2da..548aaecce0 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -238,12 +238,12 @@ static int gg_prebuildcontactmenu(WPARAM wParam, LPARAM lParam) CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME | CMIM_FLAGS | CMIF_ICONFROMICOLIB | CMIF_TCHAR; - if ( db_get_dw(hContact, gg->m_szModuleName, GG_KEY_UIN, 0) == db_get_b(NULL, gg->m_szModuleName, GG_KEY_UIN, 0) || - db_get_b(hContact, gg->m_szModuleName, "ChatRoom", 0) || - db_get_b(hContact, "CList", "NotOnList", 0)) + if ( db_get_dw(hContact, gg->m_szModuleName, GG_KEY_UIN, 0) == db_get_b(NULL, gg->m_szModuleName, GG_KEY_UIN, 0) + || db_get_b(hContact, gg->m_szModuleName, "ChatRoom", 0) + || db_get_b(hContact, "CList", "NotOnList", 0)) mi.flags |= CMIF_HIDDEN; mi.ptszName = db_get_b(hContact, gg->m_szModuleName, GG_KEY_BLOCK, 0) ? LPGENT("&Unblock") : LPGENT("&Block"); - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)gg->hBlockMenuItem, (LPARAM)&mi); + Menu_ModifyItem(gg->hBlockMenuItem, &mi); return 0; } diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h index d462f420f3..baf396ad37 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.h +++ b/protocols/Gadu-Gadu/src/gg_proto.h @@ -279,14 +279,12 @@ struct GGPROTO : public PROTO_INTERFACE HANDLE netlib; HGENMENU hMenuRoot; HGENMENU hMainMenu[7]; - HANDLE hPrebuildMenuHook; - HANDLE hBlockMenuItem; - HANDLE hImageMenuItem; - HANDLE hInstanceMenuItem; - HANDLE hAvatarsFolder; - HANDLE hImagesFolder; - HWND hwndSessionsDlg; - HANDLE hPopupNotify, hPopupError; + HGENMENU hBlockMenuItem, hImageMenuItem, hInstanceMenuItem; + HANDLE hPrebuildMenuHook; + HANDLE hAvatarsFolder; + HANDLE hImagesFolder; + HWND hwndSessionsDlg; + HANDLE hPopupNotify, hPopupError; }; typedef struct diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp index 7cc0c37215..0da199062d 100644 --- a/protocols/Gadu-Gadu/src/links.cpp +++ b/protocols/Gadu-Gadu/src/links.cpp @@ -74,12 +74,9 @@ static INT_PTR gg_parselink(WPARAM wParam, LPARAM lParam) mi.flags |= CMIM_ICON; mi.hIcon = LoadSkinnedProtoIcon(gg->m_szModuleName, gg->m_iStatus); } - else { - mi.flags |= CMIF_HIDDEN; - mi.hIcon = NULL; - } + else mi.flags |= CMIF_HIDDEN; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)gginst->hInstanceMenuItem, (LPARAM)&mi); + Menu_ModifyItem(gginst->hInstanceMenuItem, &mi); if (mi.hIcon) Skin_ReleaseIcon(mi.hIcon); } @@ -156,14 +153,12 @@ void gg_links_destroy() void GGPROTO::links_instance_init() { - if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) - { - TMO_MenuItem tmi = {0}; - tmi.cbSize = sizeof(tmi); + if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) { + TMO_MenuItem tmi = { sizeof(tmi) }; tmi.flags = CMIF_TCHAR; tmi.ownerdata = this; tmi.position = list_count(g_Instances); tmi.ptszName = m_tszUserName; - hInstanceMenuItem = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hInstanceMenu, (LPARAM)&tmi); + hInstanceMenuItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hInstanceMenu, (LPARAM)&tmi); } } -- cgit v1.2.3