summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-28 21:45:37 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-28 21:45:37 +0000
commit30707c980d1560b358dbf2671a4d2a26a1e8173c (patch)
tree74aee5adaaac976e1398274ca64c5461a60f1feb /protocols/Gadu-Gadu
parent335ec43a4bfdcbbd0b2257037f1f3e0553d89076 (diff)
various menu initialization quirks
git-svn-id: http://svn.miranda-ng.org/main/trunk@2552 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu')
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp24
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp3
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp6
-rw-r--r--protocols/Gadu-Gadu/src/image.cpp10
-rw-r--r--protocols/Gadu-Gadu/src/import.cpp14
-rw-r--r--protocols/Gadu-Gadu/src/links.cpp14
-rw-r--r--protocols/Gadu-Gadu/src/sessions.cpp13
7 files changed, 32 insertions, 52 deletions
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index a27b781590..2019872ee3 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -232,13 +232,11 @@ static GGPROTO* gg_getprotoinstance(HANDLE hContact)
static int gg_prebuildcontactmenu(WPARAM wParam, LPARAM lParam)
{
const HANDLE hContact = (HANDLE)wParam;
- CLISTMENUITEM mi = {0};
GGPROTO* gg = gg_getprotoinstance(hContact);
-
if (gg == NULL)
return 0;
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_NAME | CMIM_FLAGS | CMIF_ICONFROMICOLIB;
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) ||
@@ -246,7 +244,6 @@ static int gg_prebuildcontactmenu(WPARAM wParam, LPARAM lParam)
mi.flags |= CMIF_HIDDEN;
mi.pszName = db_get_b(hContact, gg->m_szModuleName, GG_KEY_BLOCK, 0) ? LPGEN("&Unblock") : LPGEN("&Block");
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)gg->hBlockMenuItem, (LPARAM)&mi);
-
return 0;
}
@@ -267,14 +264,12 @@ INT_PTR GGPROTO::blockuser(WPARAM wParam, LPARAM lParam)
#define GGS_BLOCKUSER "%s/BlockUser"
void GGPROTO::block_init()
{
- CLISTMENUITEM mi = {0};
char service[64];
-
- mi.cbSize = sizeof(mi);
- mi.flags = CMIF_ICONFROMICOLIB;
-
mir_snprintf(service, sizeof(service), GGS_BLOCKUSER, m_szModuleName);
createObjService(service, &GGPROTO::blockuser);
+
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIF_ICONFROMICOLIB;
mi.position = -500050000;
mi.icolibItem = GetIconHandle(IDI_BLOCK);
mi.pszName = LPGEN("&Block");
@@ -298,12 +293,10 @@ void GGPROTO::block_uninit()
// Menus initialization
void GGPROTO::menus_init()
{
- HGENMENU hGCRoot, hCLRoot, hRoot = MO_GetProtoRootMenu(m_szModuleName);
- CLISTMENUITEM mi = {0};
+ CLISTMENUITEM mi = { sizeof(mi) };
- mi.cbSize = sizeof(mi);
- if (hRoot == NULL)
- {
+ HGENMENU hGCRoot, hCLRoot, hRoot = MO_GetProtoRootMenu(m_szModuleName);
+ if (hRoot == NULL) {
mi.ptszName = m_tszUserName;
mi.position = 500090000;
mi.hParentMenu = HGENMENU_ROOT;
@@ -311,8 +304,7 @@ void GGPROTO::menus_init()
mi.icolibItem = GetIconHandle(IDI_GG);
hGCRoot = hCLRoot = hRoot = hMenuRoot = Menu_AddProtoMenuItem(&mi);
}
- else
- {
+ else {
mi.hParentMenu = hRoot;
mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE | CMIF_TCHAR;
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp
index 541b4832a6..8911110ccf 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.cpp
+++ b/protocols/Gadu-Gadu/src/gg_proto.cpp
@@ -841,8 +841,7 @@ int GGPROTO::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam)
case EV_PROTO_ONRENAME:
if (hMenuRoot) {
- CLISTMENUITEM mi = {0};
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
mi.ptszName = m_tszUserName;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuRoot, (LPARAM)&mi);
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index 118a674439..c9e56fc777 100644
--- a/protocols/Gadu-Gadu/src/groupchat.cpp
+++ b/protocols/Gadu-Gadu/src/groupchat.cpp
@@ -61,12 +61,10 @@ int GGPROTO::gc_init()
void GGPROTO::gc_menus_init(HGENMENU hRoot)
{
- if (gc_enabled)
- {
- CLISTMENUITEM mi = {0};
+ if (gc_enabled) {
char service[64];
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE;
mi.hParentMenu = hRoot;
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp
index 22d1f7fe14..0400891ba7 100644
--- a/protocols/Gadu-Gadu/src/image.cpp
+++ b/protocols/Gadu-Gadu/src/image.cpp
@@ -68,15 +68,13 @@ int gg_img_remove(GGIMAGEDLGDATA *dat);
int GGPROTO::img_init()
{
- CLISTMENUITEM mi = {0};
char service[64];
-
- mi.cbSize = sizeof(mi);
- mi.flags = CMIF_ICONFROMICOLIB;
-
- // Send image contact menu item
mir_snprintf(service, sizeof(service), GGS_SENDIMAGE, m_szModuleName);
createObjService(service, &GGPROTO::img_sendimg);
+
+ // Send image contact menu item
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIF_ICONFROMICOLIB;
mi.position = -2000010000;
mi.icolibItem = GetIconHandle(IDI_IMAGE);
mi.pszName = LPGEN("&Image");
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp
index 1bb5725222..7fd3d73b59 100644
--- a/protocols/Gadu-Gadu/src/import.cpp
+++ b/protocols/Gadu-Gadu/src/import.cpp
@@ -597,16 +597,14 @@ INT_PTR GGPROTO::export_server(WPARAM wParam, LPARAM lParam)
void GGPROTO::import_init(HGENMENU hRoot)
{
- CLISTMENUITEM mi = {0};
+ // Import from server item
char service[64];
+ mir_snprintf(service, sizeof(service), GGS_IMPORT_SERVER, m_szModuleName);
+ createObjService(service, &GGPROTO::import_server);
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE;
mi.hParentMenu = hRoot;
-
- // Import from server item
- mir_snprintf(service, sizeof(service), GGS_IMPORT_SERVER, m_szModuleName);
- createObjService(service, &GGPROTO::import_server);
mi.position = 2000500001;
mi.icolibItem = GetIconHandle(IDI_IMPORT_SERVER);
mi.pszName = LPGEN("Import List From &Server");
@@ -616,6 +614,7 @@ void GGPROTO::import_init(HGENMENU hRoot)
// Import from textfile
mir_snprintf(service, sizeof(service), GGS_IMPORT_TEXT, m_szModuleName);
createObjService(service, &GGPROTO::import_text);
+
mi.position = 2000500002;
mi.icolibItem = GetIconHandle(IDI_IMPORT_TEXT);
mi.pszName = LPGEN("Import List From &Text File...");
@@ -625,6 +624,7 @@ void GGPROTO::import_init(HGENMENU hRoot)
// Remove from server
mir_snprintf(service, sizeof(service), GGS_REMOVE_SERVER, m_szModuleName);
createObjService(service, &GGPROTO::remove_server);
+
mi.position = 2000500003;
mi.icolibItem = GetIconHandle(IDI_REMOVE_SERVER);
mi.pszName = LPGEN("&Remove List From Server");
@@ -634,6 +634,7 @@ void GGPROTO::import_init(HGENMENU hRoot)
// Export to server
mir_snprintf(service, sizeof(service), GGS_EXPORT_SERVER, m_szModuleName);
createObjService(service, &GGPROTO::export_server);
+
mi.position = 2005000001;
mi.icolibItem = GetIconHandle(IDI_EXPORT_SERVER);
mi.pszName = LPGEN("Export List To &Server");
@@ -643,6 +644,7 @@ void GGPROTO::import_init(HGENMENU hRoot)
// Export to textfile
mir_snprintf(service, sizeof(service), GGS_EXPORT_TEXT, m_szModuleName);
createObjService(service, &GGPROTO::export_text);
+
mi.position = 2005000002;
mi.icolibItem = GetIconHandle(IDI_EXPORT_TEXT);
mi.pszName = LPGEN("Export List To &Text File...");
diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp
index 50a8a6ac54..7cc0c37215 100644
--- a/protocols/Gadu-Gadu/src/links.cpp
+++ b/protocols/Gadu-Gadu/src/links.cpp
@@ -44,7 +44,6 @@ static INT_PTR gg_parselink(WPARAM wParam, LPARAM lParam)
list_t l = g_Instances;
GGPROTO *gg = NULL;
uin_t uin;
- CLISTMENUITEM mi = {0};
int items = 0;
if (list_count(l) == 0)
@@ -64,20 +63,18 @@ static INT_PTR gg_parselink(WPARAM wParam, LPARAM lParam)
if (!uin)
return 1;
- for (mi.cbSize = sizeof(mi); l; l = l->next)
- {
+ for (; l; l = l->next) {
GGPROTO *gginst = (GGPROTO*)l->data;
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS;
- if (gginst->m_iStatus > ID_STATUS_OFFLINE)
- {
+ if (gginst->m_iStatus > ID_STATUS_OFFLINE) {
++items;
gg = (GGPROTO*)l->data;
mi.flags |= CMIM_ICON;
mi.hIcon = LoadSkinnedProtoIcon(gg->m_szModuleName, gg->m_iStatus);
}
- else
- {
+ else {
mi.flags |= CMIF_HIDDEN;
mi.hIcon = NULL;
}
@@ -87,8 +84,7 @@ static INT_PTR gg_parselink(WPARAM wParam, LPARAM lParam)
Skin_ReleaseIcon(mi.hIcon);
}
- if (items > 1)
- {
+ if (items > 1) {
ListParam param = {0};
HMENU hMenu = CreatePopupMenu();
POINT pt;
diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp
index 2888b5136f..48c460e432 100644
--- a/protocols/Gadu-Gadu/src/sessions.cpp
+++ b/protocols/Gadu-Gadu/src/sessions.cpp
@@ -425,19 +425,14 @@ BOOL GGPROTO::sessions_closedlg()
void GGPROTO::sessions_menus_init(HGENMENU hRoot)
{
- CLISTMENUITEM mi = {0};
char service[64];
+ mir_snprintf(service, sizeof(service), GGS_CONCUR_SESS, m_szModuleName);
+ createObjService(service, &GGPROTO::sessions_view);
- mi.cbSize = sizeof(mi);
+ CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTHANDLE | CMIF_TCHAR;
mi.hParentMenu = hRoot;
-
- mir_snprintf(service, sizeof(service), GGS_CONCUR_SESS, m_szModuleName);
- createObjService(service, &GGPROTO::sessions_view);
- if (hMenuRoot)
- mi.position = 2050000001;
- else
- mi.position = 200003;
+ mi.position = (hMenuRoot) ? 2050000001 : 200003;
mi.icolibItem = GetIconHandle(IDI_SESSIONS);
mi.ptszName = LPGENT("Concurrent &sessions");
mi.pszService = service;