summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-10-05 12:25:49 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-10-05 12:25:49 +0000
commit487334a1c683b965503ea16d3e26c775251deadc (patch)
tree774fd382665378d45c65e3f804022d9cb2031cf1 /src
parentb74ad9c524bb75b7cd971ada0c93b26379d46abe (diff)
fix for translation issue in Options -> Customize -> Icons -> Menus
git-svn-id: http://svn.miranda-ng.org/main/trunk@1787 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/modules/clist/genmenu.cpp49
1 files changed, 22 insertions, 27 deletions
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp
index 92da9dba13..1a42b7af57 100644
--- a/src/modules/clist/genmenu.cpp
+++ b/src/modules/clist/genmenu.cpp
@@ -1047,43 +1047,40 @@ int OnIconLibChanges(WPARAM, LPARAM)
static int MO_RegisterIcon(PMO_IntMenuItem pmi, void*)
{
- char *uname, *descr;
- uname = pmi->UniqName;
- if (uname == NULL)
- uname = mir_u2a(pmi->CustomName);
- descr = mir_u2a(pmi->mi.ptszName);
+ TCHAR *uname = (pmi->UniqName) ? mir_a2t(pmi->UniqName) : mir_tstrdup(pmi->CustomName),
+ *descr = GetMenuItemText(pmi);
if ( !uname && !descr)
return FALSE;
if ( !pmi->hIcolibItem) {
HICON hIcon = ImageList_GetIcon(pmi->parent->m_hMenuIcons, pmi->iconId, 0);
- char* buf = NEWSTR_ALLOCA(descr);
- char sectionName[256], iconame[256];
- mir_snprintf(sectionName, sizeof(sectionName), "Menu Icons/%s", pmi->parent->Name);
+ TCHAR sectionName[256];
+ mir_sntprintf(sectionName, SIZEOF(sectionName), _T("Menu Icons/%s"), (TCHAR*)_A2T(pmi->parent->Name));
+
+ char iconame[256];
+ mir_snprintf(iconame, sizeof(iconame), "genmenu_%s_%s", pmi->parent->Name, uname && *uname ? uname : descr);
// remove '&'
- char* start = buf;
- while (start) {
- if ((start = strchr(start, '&')) == NULL)
- break;
+ if (descr) {
+ descr = NEWTSTR_ALLOCA(descr);
+
+ for (TCHAR *p = descr; *p; p++) {
+ if ((p = _tcschr(p, '&')) == NULL)
+ break;
- memmove(start, start+1, strlen(start+1)+1);
- if (*start != '\0') start++;
- else break;
+ memmove(p, p+1, sizeof(TCHAR)*(_tcslen(p+1)+1));
+ if (*p == '\0')
+ p++;
+ }
}
- mir_snprintf(iconame, sizeof(iconame), "genmenu_%s_%s", pmi->parent->Name, uname && *uname ? uname : descr);
-
- SKINICONDESC sid = { 0 };
- sid.cbSize = sizeof(sid);
- sid.cx = 16;
- sid.cy = 16;
- sid.pszSection = sectionName;
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.flags = SIDF_TCHAR;
+ sid.ptszSection = sectionName;
sid.pszName = iconame;
- sid.pszDefaultFile = NULL;
- sid.pszDescription = buf;
+ sid.ptszDescription = descr;
sid.hDefaultIcon = hIcon;
pmi->hIcolibItem = IcoLib_AddNewIcon(0, &sid);
@@ -1094,9 +1091,7 @@ static int MO_RegisterIcon(PMO_IntMenuItem pmi, void*)
}
}
- if ( !pmi->UniqName)
- mir_free(uname);
- mir_free(descr);
+ mir_free(uname);
return FALSE;
}