summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-12-02 18:19:49 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-12-02 18:19:49 +0000
commitc4582dd65b444e5dae29ada7cc3f6c9a9c20edf3 (patch)
tree17a8627550b202d62df8e1df76d2585d3d0cdeaa /protocols
parent5ea5feb7e052ca45af7bc9ed76e4a252bd71950d (diff)
new easy standard way of registering icons: Icon_Register
git-svn-id: http://svn.miranda-ng.org/main/trunk@2601 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/AimOscar/src/theme.cpp64
-rw-r--r--protocols/FacebookRM/src/theme.cpp76
-rw-r--r--protocols/Gadu-Gadu/src/icolib.cpp31
-rw-r--r--protocols/IRCG/src/irc.h3
-rw-r--r--protocols/IRCG/src/ircproto.cpp1
-rw-r--r--protocols/IRCG/src/main.cpp4
-rw-r--r--protocols/IRCG/src/options.cpp76
-rw-r--r--protocols/JabberG/src/jabber_icolib.cpp212
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp1
-rw-r--r--protocols/JabberG/src/jabber_proto.h2
-rw-r--r--protocols/MSN/src/msn_opts.cpp57
-rw-r--r--protocols/Omegle/src/theme.cpp46
-rw-r--r--protocols/Tlen/src/tlen.cpp67
-rw-r--r--protocols/Twitter/src/theme.cpp65
-rw-r--r--protocols/Xfire/src/main.cpp14
-rw-r--r--protocols/Yahoo/src/icolib.cpp28
16 files changed, 180 insertions, 567 deletions
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp
index 69fbe08a0f..45bb443376 100644
--- a/protocols/AimOscar/src/theme.cpp
+++ b/protocols/AimOscar/src/theme.cpp
@@ -26,15 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/////////////////////////////////////////////////////////////////////////////////////////
// Icons init
-struct _tag_iconList
-{
- const char* szDescr;
- const char* szName;
- int defIconID;
- const char* szSection;
- HANDLE hIcolib;
-}
-static iconList[] =
+static IconItem iconList[] =
{
{ LPGEN("ICQ"), "icq", IDI_ICQ },
{ LPGEN("Add"), "add", IDI_ADD },
@@ -51,48 +43,26 @@ static iconList[] =
{ LPGEN("Idle"), "idle", IDI_IDLE },
{ LPGEN("AOL"), "aol", IDI_AOL },
- { LPGEN("Foreground Color"), "foreclr", IDI_FOREGROUNDCOLOR, LPGEN("Profile Editor") },
- { LPGEN("Background Color"), "backclr", IDI_BACKGROUNDCOLOR, LPGEN("Profile Editor") },
- { LPGEN("Bold"), "bold", IDI_BOLD, LPGEN("Profile Editor") },
- { LPGEN("Not Bold"), "nbold", IDI_NBOLD, LPGEN("Profile Editor") },
- { LPGEN("Italic"), "italic", IDI_ITALIC, LPGEN("Profile Editor") },
- { LPGEN("Not Italic"), "nitalic", IDI_NITALIC, LPGEN("Profile Editor") },
- { LPGEN("Underline"), "undrln", IDI_UNDERLINE, LPGEN("Profile Editor") },
- { LPGEN("Not Underline"), "nundrln", IDI_NUNDERLINE, LPGEN("Profile Editor") },
- { LPGEN("Subscript"), "sub_scrpt", IDI_SUBSCRIPT, LPGEN("Profile Editor") },
- { LPGEN("Not Subscript"), "nsub_scrpt", IDI_NSUBSCRIPT, LPGEN("Profile Editor") },
- { LPGEN("Superscript"), "sup_scrpt", IDI_SUPERSCRIPT, LPGEN("Profile Editor") },
- { LPGEN("Not Superscript"), "nsup_scrpt", IDI_NSUPERSCRIPT, LPGEN("Profile Editor") },
- { LPGEN("Normal Script"), "norm_scrpt", IDI_NORMALSCRIPT, LPGEN("Profile Editor") },
- { LPGEN("Not Normal Script"), "nnorm_scrpt", IDI_NNORMALSCRIPT, LPGEN("Profile Editor") },
+ { LPGEN("Foreground Color"), "foreclr", IDI_FOREGROUNDCOLOR },
+ { LPGEN("Background Color"), "backclr", IDI_BACKGROUNDCOLOR },
+ { LPGEN("Bold"), "bold", IDI_BOLD },
+ { LPGEN("Not Bold"), "nbold", IDI_NBOLD },
+ { LPGEN("Italic"), "italic", IDI_ITALIC },
+ { LPGEN("Not Italic"), "nitalic", IDI_NITALIC },
+ { LPGEN("Underline"), "undrln", IDI_UNDERLINE },
+ { LPGEN("Not Underline"), "nundrln", IDI_NUNDERLINE },
+ { LPGEN("Subscript"), "sub_scrpt", IDI_SUBSCRIPT },
+ { LPGEN("Not Subscript"), "nsub_scrpt", IDI_NSUBSCRIPT },
+ { LPGEN("Superscript"), "sup_scrpt", IDI_SUPERSCRIPT },
+ { LPGEN("Not Superscript"), "nsup_scrpt", IDI_NSUPERSCRIPT },
+ { LPGEN("Normal Script"), "norm_scrpt", IDI_NORMALSCRIPT },
+ { LPGEN("Not Normal Script"), "nnorm_scrpt", IDI_NNORMALSCRIPT }
};
void InitIcons(void)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInstance, szFile, SIZEOF(szFile));
-
- char szSettingName[100];
- char szSectionName[100];
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.pszName = szSettingName;
- sid.pszSection = szSectionName;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i = 0; i < SIZEOF(iconList); i++) {
- mir_snprintf(szSettingName, sizeof(szSettingName), "AIM_%s", iconList[i].szName);
-
- if (iconList[i].szSection)
- mir_snprintf(szSectionName, sizeof(szSectionName), "%s/%s/%s", LPGEN("Protocols"), LPGEN("AIM"), iconList[i].szSection);
- else
- mir_snprintf(szSectionName, sizeof(szSectionName), "%s/%s", LPGEN("Protocols"), LPGEN("AIM"));
-
- sid.pszDescription = (char*)iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- iconList[i].hIcolib = Skin_AddIcon(&sid);
- }
+ Icon_Register(hInstance, "Protocols/AIM", iconList, 14, "AIM");
+ Icon_Register(hInstance, "Protocols/AIM/Profile Editor", iconList+14, 14, "AIM");
}
HICON LoadIconEx(const char* name, bool big)
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp
index 78e21a18f1..e29f5f727d 100644
--- a/protocols/FacebookRM/src/theme.cpp
+++ b/protocols/FacebookRM/src/theme.cpp
@@ -24,85 +24,41 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
extern OBJLIST<FacebookProto> g_Instances;
-struct
+static IconItem icons[] =
{
- const char* name;
- char* descr;
- int defIconID;
- const char* section;
-}
-static const icons[] =
-{
- { "facebook", LPGEN("Facebook Icon"), IDI_FACEBOOK },
- { "mind", LPGEN("Mind"), IDI_MIND },
+ { LPGEN("Facebook Icon"), "facebook", IDI_FACEBOOK },
+ { LPGEN("Mind"), "mind", IDI_MIND },
- { "authRevoke", LPGEN("Cancel friendship"), IDI_AUTH_REVOKE },
- { "authRevokeReq", LPGEN("Cancel friendship request"), IDI_AUTH_REVOKE },
- { "authAsk", LPGEN("Request friendship"), IDI_AUTH_ASK },
- { "authGrant", LPGEN("Approve friendship"), IDI_AUTH_GRANT },
+ { LPGEN("Cancel friendship"), "authRevoke", IDI_AUTH_REVOKE },
+ { LPGEN("Cancel friendship request"), "authRevokeReq", IDI_AUTH_REVOKE },
+ { LPGEN("Request friendship"), "authAsk", IDI_AUTH_ASK },
+ { LPGEN("Approve friendship"), "authGrant", IDI_AUTH_GRANT },
- { "homepage", LPGEN("Visit Profile"), 0, "core_main_2" },
+ { LPGEN("Visit Profile"), "homepage", 0 },
};
-static HANDLE hIconLibItem[SIZEOF(icons)];
-
// TODO: uninit
void InitIcons(void)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInstance, szFile, SIZEOF(szFile));
-
- char setting_name[100];
- char section_name[100];
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.cx = sid.cy = 16;
- sid.pszName = setting_name;
- sid.pszSection = section_name;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i=0; i<SIZEOF(icons); i++)
- {
- if(icons[i].defIconID)
- {
- mir_snprintf(setting_name,sizeof(setting_name),"%s_%s","Facebook",icons[i].name);
-
- if (icons[i].section)
- {
- mir_snprintf(section_name,sizeof(section_name),"%s/%s/%s",LPGEN("Protocols"),
- LPGEN("Facebook"), icons[i].section);
- } else {
- mir_snprintf(section_name,sizeof(section_name),"%s/%s",LPGEN("Protocols"),
- LPGEN("Facebook"));
- }
-
- sid.pszDescription = (char*)icons[i].descr;
- sid.iDefaultIndex = -icons[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- } else { // External icons
- hIconLibItem[i] = Skin_GetIconHandle(icons[i].section);
- }
- }
+ Icon_Register(g_hInstance, "Protocols/Facebook", icons, SIZEOF(icons)-1, "Facebook");
+ icons[ SIZEOF(icons)-1 ].hIcolib = Skin_GetIconHandle("core_main_2");
}
HANDLE GetIconHandle(const char* name)
{
for(size_t i=0; i<SIZEOF(icons); i++)
- {
- if(strcmp(icons[i].name,name) == 0)
- return hIconLibItem[i];
- }
+ if(strcmp(icons[i].szName, name) == 0)
+ return icons[i].hIcolib;
+
return 0;
}
char *GetIconDescription(const char* name)
{
for(size_t i=0; i<SIZEOF(icons); i++)
- {
- if(strcmp(icons[i].name,name) == 0)
- return icons[i].descr;
- }
+ if(strcmp(icons[i].szName, name) == 0)
+ return icons[i].szDescr;
+
return "";
}
diff --git a/protocols/Gadu-Gadu/src/icolib.cpp b/protocols/Gadu-Gadu/src/icolib.cpp
index e353dcdb17..c260942c33 100644
--- a/protocols/Gadu-Gadu/src/icolib.cpp
+++ b/protocols/Gadu-Gadu/src/icolib.cpp
@@ -20,13 +20,7 @@
#include "gg.h"
-struct tagiconList
-{
- char* szDescr;
- char* szName;
- int defIconID;
-}
-static const iconList[] =
+static IconItem iconList[] =
{
{ LPGEN("Protocol icon"), "main", IDI_GG },
{ LPGEN("Import list from server"), "importserver", IDI_IMPORT_SERVER },
@@ -51,25 +45,7 @@ HANDLE hIconLibItem[SIZEOF(iconList)];
void gg_icolib_init()
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInstance, szFile, MAX_PATH);
-
- char szSectionName[100];
- mir_snprintf(szSectionName, sizeof( szSectionName ), "%s/%s", LPGEN("Protocols"), LPGEN(GGDEF_PROTO));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.pszSection = szSectionName;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i = 0; i < SIZEOF(iconList); i++) {
- char szSettingName[100];
- mir_snprintf(szSettingName, sizeof(szSettingName), "%s_%s", GGDEF_PROTO, iconList[i].szName);
- sid.pszName = szSettingName;
- sid.pszDescription = (char*)iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- }
+ Icon_Register(hInstance, "Protocols/" GGDEF_PROTO, iconList, SIZEOF(iconList), GGDEF_PROTO);
}
HICON LoadIconEx(const char* name, BOOL big)
@@ -81,8 +57,7 @@ HICON LoadIconEx(const char* name, BOOL big)
HANDLE GetIconHandle(int iconId)
{
- int i;
- for(i = 0; i < SIZEOF(iconList); i++)
+ for(int i = 0; i < SIZEOF(iconList); i++)
if (iconList[i].defIconID == iconId)
return hIconLibItem[i];
return NULL;
diff --git a/protocols/IRCG/src/irc.h b/protocols/IRCG/src/irc.h
index 9fe6584d87..6928d21dda 100644
--- a/protocols/IRCG/src/irc.h
+++ b/protocols/IRCG/src/irc.h
@@ -697,8 +697,7 @@ void UninitContactMenus(void);
void WindowSetIcon(HWND hWnd, int iconId);
void WindowFreeIcon(HWND hWnd);
-void AddIcons(void);
-void UninitIcons(void);
+void InitIcons(void);
HICON LoadIconEx(int iIndex, bool big = false);
HANDLE GetIconHandle(int iconId);
void ReleaseIconEx(HICON hIcon);
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp
index 3331c9aa93..0c384234c0 100644
--- a/protocols/IRCG/src/ircproto.cpp
+++ b/protocols/IRCG/src/ircproto.cpp
@@ -78,7 +78,6 @@ CIrcProto::CIrcProto( const char* szModuleName, const TCHAR* tszUserName ) :
CallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )text );
CList_SetAllOffline(true);
- AddIcons();
IRC_MAP_ENTRY("PING", PING)
IRC_MAP_ENTRY("JOIN", JOIN)
diff --git a/protocols/IRCG/src/main.cpp b/protocols/IRCG/src/main.cpp
index 0a2a5d70df..f6265a1c2b 100644
--- a/protocols/IRCG/src/main.cpp
+++ b/protocols/IRCG/src/main.cpp
@@ -89,10 +89,9 @@ static int ircProtoUninit( CIrcProto* ppro )
extern "C" int __declspec(dllexport) Load( )
{
-
mir_getLP( &pluginInfo );
- AddIcons();
+ InitIcons();
InitTimers();
InitServers();
InitContactMenus();
@@ -112,7 +111,6 @@ extern "C" int __declspec(dllexport) Load( )
extern "C" int __declspec(dllexport) Unload(void)
{
UninitContactMenus();
- UninitIcons();
UninitTimers();
g_Instances.destroy();
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp
index d7ed8753cc..a01e34822b 100644
--- a/protocols/IRCG/src/options.cpp
+++ b/protocols/IRCG/src/options.cpp
@@ -27,8 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static WNDPROC OldProc;
static WNDPROC OldListViewProc;
-static HANDLE* hIconLibItems;
-
static const CIrcProto* pZero = NULL;
void CIrcProto::ReadSettings( TDbSetting* sets, int count )
@@ -191,66 +189,36 @@ static void removeSpaces( TCHAR* p )
/////////////////////////////////////////////////////////////////////////////////////////
// add icons to the skinning module
-struct
-{
- char* szDescr;
- char* szName;
- int iSize;
- int defIconID;
-}
-static iconList[] =
-{
- { LPGEN("Main"), "main", 0, IDI_MAIN },
- { LPGEN("Add"), "add", 0, IDI_ADD },
- { LPGEN("Apply"), "apply", 0, IDI_APPLY },
- { LPGEN("Rename"), "rename", 0, IDI_RENAME },
- { LPGEN("Edit"), "edit", 0, IDI_EDIT },
- { LPGEN("Cancel"), "delete", 0, IDI_DELETE },
- { LPGEN("Ignore"), "block", 0, IDI_BLOCK },
- { LPGEN("Channel list"), "list", 0, IDI_LIST },
- { LPGEN("Channel manager"), "manager", 0, IDI_MANAGER },
- { LPGEN("Quick connect"), "quick", 0, IDI_QUICK },
- { LPGEN("Server window"), "server", 0, IDI_SERVER },
- { LPGEN("Show channel"), "show", 0, IDI_SHOW },
- { LPGEN("Question"), "question", 0, IDI_IRCQUESTION},
- { LPGEN("WhoIs"), "whois", 0, IDI_WHOIS },
- { LPGEN("Incoming DCC Chat"), "dcc", 0, IDI_DCC },
- { LPGEN("Logo (48x48)"), "logo", 48, IDI_LOGO }
+static IconItem iconList[] =
+{
+ { LPGEN("Main"), "main", IDI_MAIN, 0 },
+ { LPGEN("Add"), "add", IDI_ADD, 0 },
+ { LPGEN("Apply"), "apply", IDI_APPLY, 0 },
+ { LPGEN("Rename"), "rename", IDI_RENAME, 0 },
+ { LPGEN("Edit"), "edit", IDI_EDIT, 0 },
+ { LPGEN("Cancel"), "delete", IDI_DELETE, 0 },
+ { LPGEN("Ignore"), "block", IDI_BLOCK, 0 },
+ { LPGEN("Channel list"), "list", IDI_LIST, 0 },
+ { LPGEN("Channel manager"), "manager", IDI_MANAGER, 0 },
+ { LPGEN("Quick connect"), "quick", IDI_QUICK, 0 },
+ { LPGEN("Server window"), "server", IDI_SERVER, 0 },
+ { LPGEN("Show channel"), "show", IDI_SHOW, 0 },
+ { LPGEN("Question"), "question",IDI_IRCQUESTION, 0 },
+ { LPGEN("WhoIs"), "whois", IDI_WHOIS, 0 },
+ { LPGEN("Incoming DCC Chat"), "dcc", IDI_DCC, 0 },
+ { LPGEN("Logo (48x48)"), "logo", IDI_LOGO, 48 }
};
-void AddIcons(void)
-{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.pszSection = "Protocols/IRC";
- sid.ptszDefaultFile = szFile;
- sid.flags = SIDF_PATH_TCHAR;
- hIconLibItems = new HANDLE[ SIZEOF(iconList) ];
-
- // add them one by one
- for ( int i=0; i < SIZEOF(iconList); i++ ) {
- char szTemp[255];
- mir_snprintf(szTemp, sizeof(szTemp), "IRC_%s", iconList[i].szName );
- sid.pszName = szTemp;
- sid.pszDescription = iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- sid.cx = sid.cy = iconList[i].iSize;
- hIconLibItems[i] = Skin_AddIcon(&sid );
- }
-}
-
-void UninitIcons(void)
+void InitIcons(void)
{
- delete[] hIconLibItems;
+ Icon_Register(hInst, "Protocols/IRC", iconList, SIZEOF(iconList), "IRC");
}
HICON LoadIconEx( int iconId, bool big )
{
for ( int i=0; i < SIZEOF(iconList); i++ )
if ( iconList[i].defIconID == iconId )
- return Skin_GetIconByHandle(hIconLibItems[i], big);
+ return Skin_GetIconByHandle(iconList[i].hIcolib, big);
return NULL;
}
@@ -259,7 +227,7 @@ HANDLE GetIconHandle( int iconId )
{
for ( int i=0; i < SIZEOF(iconList); i++ )
if ( iconList[i].defIconID == iconId )
- return hIconLibItems[i];
+ return iconList[i].hIcolib;
return NULL;
}
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp
index 490a8b1377..d8f08e22ba 100644
--- a/protocols/JabberG/src/jabber_icolib.cpp
+++ b/protocols/JabberG/src/jabber_icolib.cpp
@@ -174,82 +174,29 @@ CIconPool::CPoolItem *CIconPool::FindItemByName(const char *name)
/////////////////////////////////////////////////////////////////////////////////////////
// Icons init
-struct TIconListItem
+static IconItem iconList[] =
{
- char* szDescr;
- char* szName;
- int defIconID;
- char* szSection;
- HANDLE hIcon;
-};
-
-static TIconListItem iconList[] =
-{
- { LPGEN("%s"), "main", IDI_JABBER, NULL },
+ { LPGEN("%s"), "main", IDI_JABBER },
};
void CJabberProto::IconsInit(void)
{
- int i;
-
m_transportProtoTableStartIndex = (int *)mir_alloc(sizeof(int) * SIZEOF(TransportProtoTable));
- for (i = 0; i < SIZEOF(TransportProtoTable); ++i)
+ for (int i = 0; i < SIZEOF(TransportProtoTable); ++i)
m_transportProtoTableStartIndex[i] = -1;
- char szFile[MAX_PATH];
- GetModuleFileNameA(hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.pszDefaultFile = szFile;
- sid.flags = SIDF_TCHAR;
-
- char szSettingName[100];
- TCHAR szSectionName[100];
- TCHAR szDescription[100];
- TCHAR szRootSection[100];
-
- sid.pszName = szSettingName;
- sid.ptszSection = szSectionName;
- sid.ptszDescription = szDescription;
-
- m_phIconLibItems = (HANDLE*)mir_alloc(sizeof(HANDLE)*SIZEOF(iconList));
-
- mir_sntprintf(szRootSection, SIZEOF(szRootSection), _T("%s/%s/%s"), LPGENT("Protocols"), LPGENT("Jabber"), LPGENT("Accounts"));
-
- for (i = 0; i < SIZEOF(iconList); i++) {
- TCHAR tmp[100];
-
- if (iconList[i].szSection) {
- mir_sntprintf(szSectionName, SIZEOF(szSectionName), _T("%s/") _T(TCHAR_STR_PARAM), szRootSection, iconList[i].szSection);
- if (_tcsstr(szSectionName, _T("%s"))) {
- mir_sntprintf(tmp, SIZEOF(tmp), szSectionName, m_tszUserName);
- lstrcpy(szSectionName, tmp);
- }
- }
- else {
- mir_sntprintf(szSectionName, SIZEOF(szSectionName), _T("%s"), szRootSection);
- }
-
- if (strstr(iconList[i].szDescr, "%s")) {
- mir_sntprintf(tmp, SIZEOF(tmp), _T(TCHAR_STR_PARAM), iconList[i].szDescr);
- mir_sntprintf(szDescription, SIZEOF(szDescription), tmp, m_tszUserName);
- }
- else mir_sntprintf(szDescription, SIZEOF(szDescription), _T(TCHAR_STR_PARAM), iconList[i].szDescr);
-
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", m_szModuleName, iconList[i].szName);
-
- sid.iDefaultIndex = -iconList[i].defIconID;
- m_phIconLibItems[i] = Skin_AddIcon(&sid);
-} }
+ IconItemT protoIcon = { m_tszUserName, "main", IDI_JABBER };
+ Icon_RegisterT(hInst, _T("Protocols/Jabber/Accounts"), &protoIcon, 1, m_szModuleName);
+ m_hProtoIcon = protoIcon.hIcolib;
+}
HANDLE CJabberProto::GetIconHandle(int iconId)
{
if (HANDLE result = g_GetIconHandle(iconId))
return result;
- for (int i=0; i < SIZEOF(iconList); i++)
- if (iconList[i].defIconID == iconId)
- return m_phIconLibItems[i];
+ if (iconId == IDI_JABBER)
+ return m_hProtoIcon;
return NULL;
}
@@ -550,91 +497,68 @@ void CJabberProto::CheckAllContactsAreTransported()
/////////////////////////////////////////////////////////////////////////////////////////
// Cross-instance shared icons
-static TIconListItem sharedIconList[] =
-{
- { LPGEN("Privacy Lists"), "privacylists", IDI_PRIVACY_LISTS, NULL },
- { LPGEN("Bookmarks"), "bookmarks", IDI_BOOKMARKS, NULL },
- { LPGEN("Notes"), "notes", IDI_NOTES, NULL },
- { LPGEN("Multi-User Conference"), "group", IDI_GROUP, NULL },
- { LPGEN("Agents list"), "Agents", IDI_AGENTS, NULL },
-
- { LPGEN("Transports"), "transport", IDI_TRANSPORT, NULL },
- { LPGEN("Registered transports"), "transport_loc", IDI_TRANSPORTL, NULL },
- { LPGEN("Change password"), "key", IDI_KEYS, NULL },
- { LPGEN("Personal vCard"), "vcard", IDI_VCARD, NULL },
- { LPGEN("Request authorization"), "Request", IDI_REQUEST, NULL },
- { LPGEN("Grant authorization"), "Grant", IDI_GRANT, NULL },
- { LPGEN("Revoke authorization"), "Revoke", IDI_AUTHREVOKE, NULL },
- { LPGEN("Convert to room"), "convert", IDI_USER2ROOM, NULL },
- { LPGEN("Add to roster"), "addroster", IDI_ADDROSTER, NULL },
- { LPGEN("Login/logout"), "trlogonoff", IDI_LOGIN, NULL },
- { LPGEN("Resolve nicks"), "trresolve", IDI_REFRESH, NULL },
- { LPGEN("Send note"), "sendnote", IDI_SEND_NOTE, NULL },
- { LPGEN("Service Discovery"), "servicediscovery", IDI_SERVICE_DISCOVERY, NULL },
- { LPGEN("AdHoc Command"), "adhoc", IDI_COMMAND, NULL },
- { LPGEN("XML Console"), "xmlconsole", IDI_CONSOLE, NULL },
- { LPGEN("OpenID Request"), "openid", IDI_HTTP_AUTH, NULL },
-
- { LPGEN("Discovery succeeded"), "disco_ok", IDI_DISCO_OK, LPGEN("Dialogs") },
- { LPGEN("Discovery failed"), "disco_fail", IDI_DISCO_FAIL, LPGEN("Dialogs") },
- { LPGEN("Discovery in progress"), "disco_progress", IDI_DISCO_PROGRESS, LPGEN("Dialogs") },
- { LPGEN("View as tree"), "sd_view_tree", IDI_VIEW_TREE, LPGEN("Dialogs") },
- { LPGEN("View as list"), "sd_view_list", IDI_VIEW_LIST, LPGEN("Dialogs") },
- { LPGEN("Apply filter"), "sd_filter_apply", IDI_FILTER_APPLY, LPGEN("Dialogs") },
- { LPGEN("Reset filter"), "sd_filter_reset", IDI_FILTER_RESET, LPGEN("Dialogs") },
-
- { LPGEN("Navigate home"), "sd_nav_home", IDI_NAV_HOME, LPGEN("Dialogs/Discovery") },
- { LPGEN("Refresh node"), "sd_nav_refresh", IDI_NAV_REFRESH, LPGEN("Dialogs/Discovery") },
- { LPGEN("Browse node"), "sd_browse", IDI_BROWSE, LPGEN("Dialogs/Discovery") },
- { LPGEN("RSS service"), "node_rss", IDI_NODE_RSS, LPGEN("Dialogs/Discovery") },
- { LPGEN("Server"), "node_server", IDI_NODE_SERVER, LPGEN("Dialogs/Discovery") },
- { LPGEN("Storage service"), "node_store", IDI_NODE_STORE, LPGEN("Dialogs/Discovery") },
- { LPGEN("Weather service"), "node_weather", IDI_NODE_WEATHER, LPGEN("Dialogs/Discovery") },
-
- { LPGEN("Generic privacy list"), "pl_list_any", IDI_PL_LIST_ANY, LPGEN("Dialogs/Privacy") },
- { LPGEN("Active privacy list"), "pl_list_active", IDI_PL_LIST_ACTIVE, LPGEN("Dialogs/Privacy") },
- { LPGEN("Default privacy list"), "pl_list_default", IDI_PL_LIST_DEFAULT, LPGEN("Dialogs/Privacy") },
- { LPGEN("Move up"), "arrow_up", IDI_ARROW_UP, LPGEN("Dialogs/Privacy") },
- { LPGEN("Move down"), "arrow_down", IDI_ARROW_DOWN, LPGEN("Dialogs/Privacy") },
- { LPGEN("Allow Messages"), "pl_msg_allow", IDI_PL_MSG_ALLOW, LPGEN("Dialogs/Privacy") },
- { LPGEN("Allow Presences (in)"), "pl_prin_allow", IDI_PL_PRIN_ALLOW, LPGEN("Dialogs/Privacy") },
- { LPGEN("Allow Presences (out)"), "pl_prout_allow", IDI_PL_PROUT_ALLOW, LPGEN("Dialogs/Privacy") },
- { LPGEN("Allow Queries"), "pl_iq_allow", IDI_PL_QUERY_ALLOW, LPGEN("Dialogs/Privacy") },
- { LPGEN("Deny Messages"), "pl_msg_deny", IDI_PL_MSG_DENY, LPGEN("Dialogs/Privacy") },
- { LPGEN("Deny Presences (in)"), "pl_prin_deny", IDI_PL_PRIN_DENY, LPGEN("Dialogs/Privacy") },
- { LPGEN("Deny Presences (out)"), "pl_prout_deny", IDI_PL_PROUT_DENY, LPGEN("Dialogs/Privacy") },
- { LPGEN("Deny Queries"), "pl_iq_deny", IDI_PL_QUERY_DENY, LPGEN("Dialogs/Privacy") },
+static IconItem sharedIconList[] =
+{
+ { LPGEN("Privacy Lists"), "privacylists", IDI_PRIVACY_LISTS },
+ { LPGEN("Bookmarks"), "bookmarks", IDI_BOOKMARKS },
+ { LPGEN("Notes"), "notes", IDI_NOTES },
+ { LPGEN("Multi-User Conference"), "group", IDI_GROUP },
+ { LPGEN("Agents list"), "Agents", IDI_AGENTS },
+ { LPGEN("Transports"), "transport", IDI_TRANSPORT },
+ { LPGEN("Registered transports"), "transport_loc", IDI_TRANSPORTL },
+ { LPGEN("Change password"), "key", IDI_KEYS, },
+ { LPGEN("Personal vCard"), "vcard", IDI_VCARD, },
+ { LPGEN("Request authorization"), "Request", IDI_REQUEST, },
+ { LPGEN("Grant authorization"), "Grant", IDI_GRANT, },
+ { LPGEN("Revoke authorization"), "Revoke", IDI_AUTHREVOKE, },
+ { LPGEN("Convert to room"), "convert", IDI_USER2ROOM, },
+ { LPGEN("Add to roster"), "addroster", IDI_ADDROSTER, },
+ { LPGEN("Login/logout"), "trlogonoff", IDI_LOGIN, },
+ { LPGEN("Resolve nicks"), "trresolve", IDI_REFRESH, },
+ { LPGEN("Send note"), "sendnote", IDI_SEND_NOTE, },
+ { LPGEN("Service Discovery"), "servicediscovery", IDI_SERVICE_DISCOVERY, },
+ { LPGEN("AdHoc Command"), "adhoc", IDI_COMMAND, },
+ { LPGEN("XML Console"), "xmlconsole", IDI_CONSOLE, },
+ { LPGEN("OpenID Request"), "openid", IDI_HTTP_AUTH, },
+
+ { LPGEN("Discovery succeeded"), "disco_ok", IDI_DISCO_OK, },
+ { LPGEN("Discovery failed"), "disco_fail", IDI_DISCO_FAIL, },
+ { LPGEN("Discovery in progress"), "disco_progress", IDI_DISCO_PROGRESS, },
+ { LPGEN("View as tree"), "sd_view_tree", IDI_VIEW_TREE, },
+ { LPGEN("View as list"), "sd_view_list", IDI_VIEW_LIST, },
+ { LPGEN("Apply filter"), "sd_filter_apply", IDI_FILTER_APPLY, },
+ { LPGEN("Reset filter"), "sd_filter_reset", IDI_FILTER_RESET, },
+
+ { LPGEN("Navigate home"), "sd_nav_home", IDI_NAV_HOME, },
+ { LPGEN("Refresh node"), "sd_nav_refresh", IDI_NAV_REFRESH, },
+ { LPGEN("Browse node"), "sd_browse", IDI_BROWSE, },
+ { LPGEN("RSS service"), "node_rss", IDI_NODE_RSS, },
+ { LPGEN("Server"), "node_server", IDI_NODE_SERVER, },
+ { LPGEN("Storage service"), "node_store", IDI_NODE_STORE, },
+ { LPGEN("Weather service"), "node_weather", IDI_NODE_WEATHER, },
+
+ { LPGEN("Generic privacy list"), "pl_list_any", IDI_PL_LIST_ANY, },
+ { LPGEN("Active privacy list"), "pl_list_active", IDI_PL_LIST_ACTIVE, },
+ { LPGEN("Default privacy list"), "pl_list_default", IDI_PL_LIST_DEFAULT, },
+ { LPGEN("Move up"), "arrow_up", IDI_ARROW_UP, },
+ { LPGEN("Move down"), "arrow_down", IDI_ARROW_DOWN, },
+ { LPGEN("Allow Messages"), "pl_msg_allow", IDI_PL_MSG_ALLOW, },
+ { LPGEN("Allow Presences (in)"), "pl_prin_allow", IDI_PL_PRIN_ALLOW, },
+ { LPGEN("Allow Presences (out)"), "pl_prout_allow", IDI_PL_PROUT_ALLOW, },
+ { LPGEN("Allow Queries"), "pl_iq_allow", IDI_PL_QUERY_ALLOW, },
+ { LPGEN("Deny Messages"), "pl_msg_deny", IDI_PL_MSG_DENY, },
+ { LPGEN("Deny Presences (in)"), "pl_prin_deny", IDI_PL_PRIN_DENY, },
+ { LPGEN("Deny Presences (out)"), "pl_prout_deny", IDI_PL_PROUT_DENY, },
+ { LPGEN("Deny Queries"), "pl_iq_deny", IDI_PL_QUERY_DENY, },
};
static void sttProcessIcons(int iAmount)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.flags = SIDF_PATH_TCHAR;
-
- char szRootSection[100];
- mir_snprintf(szRootSection, SIZEOF(szRootSection), "%s/%s", LPGEN("Protocols"), LPGEN("Jabber"));
-
- for (int i = 0; i < iAmount; i++) {
- char szSettingName[100], szSectionName[100];
-
- mir_snprintf(szSettingName, sizeof(szSettingName), "%s_%s",
- GLOBAL_SETTING_PREFIX, sharedIconList[i].szName);
-
- if (sharedIconList[i].szSection) {
- mir_snprintf(szSectionName, sizeof(szSectionName), "%s/%s", szRootSection, sharedIconList[i].szSection);
- sid.pszSection = szSectionName;
- }
- else sid.pszSection = szRootSection;
-
- sid.pszName = szSettingName;
- sid.pszDescription = sharedIconList[i].szDescr;
- sid.iDefaultIndex = -sharedIconList[i].defIconID;
- sharedIconList[i].hIcon = Skin_AddIcon(&sid);
-} }
+ Icon_Register(hInst, "Protocols/Jabber", iconList, 21, GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, "Protocols/Jabber/Dialogs", iconList+21, 7, GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, "Protocols/Dialogs/Discovery", iconList+28, 7, GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, "Protocols/Dialogs/Privacy", iconList+35, 13, GLOBAL_SETTING_PREFIX);
+}
void g_IconsInit()
{
@@ -645,7 +569,7 @@ HANDLE g_GetIconHandle(int iconId)
{
for (int i=0; i < SIZEOF(sharedIconList); i++)
if (sharedIconList[i].defIconID == iconId)
- return sharedIconList[i].hIcon;
+ return sharedIconList[i].hIcolib;
return NULL;
}
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index fbb88dde49..4aaa085b52 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -232,7 +232,6 @@ CJabberProto::~CJabberProto()
DeleteCriticalSection(&m_csLists);
mir_free(m_tszSelectedLang);
- mir_free(m_phIconLibItems);
mir_free(m_AuthMechs.m_gssapiHostName);
DeleteCriticalSection(&m_filterInfo.csPatternLock);
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 9ab3c99164..048e0370de 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -993,7 +993,7 @@ private:
int m_nMenuResourceItems;
HANDLE* m_phMenuResourceItems;
- HANDLE* m_phIconLibItems;
+ HANDLE m_hProtoIcon;
};
extern LIST<CJabberProto> g_Instances;
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp
index bac6553e8f..30e74d4d36 100644
--- a/protocols/MSN/src/msn_opts.cpp
+++ b/protocols/MSN/src/msn_opts.cpp
@@ -27,52 +27,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/////////////////////////////////////////////////////////////////////////////////////////
// Icons init
-struct _tag_iconList
+static IconItem iconList[] =
{
- const char* szDescr;
- const char* szName;
- int defIconID;
-}
-static const iconList[] =
-{
- { LPGEN("Protocol icon"), "main", IDI_MSN },
- { LPGEN("Hotmail Inbox"), "inbox", IDI_INBOX },
- { LPGEN("Profile"), "profile", IDI_PROFILE },
- { LPGEN("MSN Services"), "services", IDI_SERVICES },
- { LPGEN("Block user"), "block", IDI_MSNBLOCK },
- { LPGEN("Invite to chat"), "invite", IDI_INVITE },
- { LPGEN("Start Netmeeting"), "netmeeting", IDI_NETMEETING },
- { LPGEN("Contact list"), "list_fl", IDI_LIST_FL },
- { LPGEN("Allowed list"), "list_al", IDI_LIST_AL },
- { LPGEN("Blocked list"), "list_bl", IDI_LIST_BL },
- { LPGEN("Relative list"), "list_rl", IDI_LIST_RL },
- { LPGEN("Local list"), "list_lc", IDI_LIST_LC },
+ { LPGEN("Protocol icon"), "main", IDI_MSN },
+ { LPGEN("Hotmail Inbox"), "inbox", IDI_INBOX },
+ { LPGEN("Profile"), "profile", IDI_PROFILE },
+ { LPGEN("MSN Services"), "services", IDI_SERVICES },
+ { LPGEN("Block user"), "block", IDI_MSNBLOCK },
+ { LPGEN("Invite to chat"), "invite", IDI_INVITE },
+ { LPGEN("Start Netmeeting"), "netmeeting", IDI_NETMEETING },
+ { LPGEN("Contact list"), "list_fl", IDI_LIST_FL },
+ { LPGEN("Allowed list"), "list_al", IDI_LIST_AL },
+ { LPGEN("Blocked list"), "list_bl", IDI_LIST_BL },
+ { LPGEN("Relative list"), "list_rl", IDI_LIST_RL },
+ { LPGEN("Local list"), "list_lc", IDI_LIST_LC },
};
-HANDLE hIconLibItem[SIZEOF(iconList)];
-
-
void MsnInitIcons(void)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, SIZEOF(szFile));
-
- char szSectionName[100];
- mir_snprintf(szSectionName, sizeof(szSectionName), "%s/%s", LPGEN("Protocols"), LPGEN("MSN"));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.pszSection = szSectionName;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i = 0; i < SIZEOF(iconList); i++) {
- char szSettingName[100];
- mir_snprintf(szSettingName, sizeof(szSettingName), "MSN_%s", iconList[i].szName);
- sid.pszName = szSettingName;
- sid.pszDescription = (char*)iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- }
+ Icon_Register(hInst, "Protocols/MSN", iconList, SIZEOF(iconList), "MSN");
}
HICON LoadIconEx(const char* name, bool big)
@@ -86,7 +59,7 @@ HANDLE GetIconHandle(int iconId)
{
for (unsigned i=0; i < SIZEOF(iconList); i++)
if (iconList[i].defIconID == iconId)
- return hIconLibItem[i];
+ return iconList[i].hIcolib;
return NULL;
}
diff --git a/protocols/Omegle/src/theme.cpp b/protocols/Omegle/src/theme.cpp
index 04ab200f66..202d58791e 100644
--- a/protocols/Omegle/src/theme.cpp
+++ b/protocols/Omegle/src/theme.cpp
@@ -24,63 +24,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
extern OBJLIST<OmegleProto> g_Instances;
-struct
-{
- const char* name;
- const char* descr;
- int defIconID;
- const char* section;
-}
-static const icons[] =
+static IconItem icons[] =
{
{ "omegle", LPGEN("Omegle Icon"), IDI_OMEGLE },
-// { "homepage", LPGEN("Visit Profile"), 0, "core_main_2" },
};
static HANDLE hIconLibItem[SIZEOF(icons)];
-// TODO: uninit
void InitIcons(void)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInstance, szFile, SIZEOF(szFile));
-
- char setting_name[100];
- char section_name[100];
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.cx = sid.cy = 16;
- sid.pszName = setting_name;
- sid.pszSection = section_name;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i=0; i<SIZEOF(icons); i++) {
- if(icons[i].defIconID) {
- mir_snprintf(setting_name,sizeof(setting_name),"%s_%s","Omegle",icons[i].name);
-
- if (icons[i].section) {
- mir_snprintf(section_name,sizeof(section_name),"%s/%s/%s",LPGEN("Protocols"),
- LPGEN("Omegle"), icons[i].section);
- } else {
- mir_snprintf(section_name,sizeof(section_name),"%s/%s",LPGEN("Protocols"),
- LPGEN("Omegle"));
- }
-
- sid.pszDescription = (char*)icons[i].descr;
- sid.iDefaultIndex = -icons[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- } else { // External icons
- hIconLibItem[i] = Skin_GetIconHandle(icons[i].section);
- }
- }
+ Icon_Register(g_hInstance, "Protocols/Omegle", icons, SIZEOF(icons), "Omegle");
}
HANDLE GetIconHandle(const char* name)
{
for(size_t i=0; i<SIZEOF(icons); i++)
{
- if(strcmp(icons[i].name,name) == 0)
+ if(strcmp(icons[i].szName, name) == 0)
return hIconLibItem[i];
}
return 0;
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp
index 8d6e8a5b0d..8fa54107fd 100644
--- a/protocols/Tlen/src/tlen.cpp
+++ b/protocols/Tlen/src/tlen.cpp
@@ -80,36 +80,31 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
return interfaces;
}
-struct
+static IconItem iconList[] =
{
- TCHAR* szDescr;
- char* szName;
- int defIconID;
- HANDLE hIconLibItem;
-}
-static iconList[] =
-{
- { LPGENT("Protocol icon"), "PROTO", IDI_TLEN },
- { LPGENT("Tlen inbox"), "MAIL", IDI_MAIL },
- { LPGENT("Group chats"), "MUC", IDI_MUC },
- { LPGENT("Tlen chats"), "CHATS", IDI_CHATS },
- { LPGENT("Grant authorization"), "GRANT", IDI_GRANT },
- { LPGENT("Request authorization"), "REQUEST", IDI_REQUEST },
- { LPGENT("Voice chat"), "VOICE", IDI_VOICE },
- { LPGENT("Microphone"), "MICROPHONE", IDI_MICROPHONE },
- { LPGENT("Speaker"), "SPEAKER", IDI_SPEAKER },
- { LPGENT("Send image"), "IMAGE", IDI_IMAGE }
+ { LPGEN("Protocol icon"), "PROTO", IDI_TLEN },
+ { LPGEN("Tlen inbox"), "MAIL", IDI_MAIL },
+ { LPGEN("Group chats"), "MUC", IDI_MUC },
+ { LPGEN("Tlen chats"), "CHATS", IDI_CHATS },
+ { LPGEN("Grant authorization"), "GRANT", IDI_GRANT },
+ { LPGEN("Request authorization"), "REQUEST", IDI_REQUEST },
+ { LPGEN("Voice chat"), "VOICE", IDI_VOICE },
+ { LPGEN("Microphone"), "MICROPHONE", IDI_MICROPHONE },
+ { LPGEN("Speaker"), "SPEAKER", IDI_SPEAKER },
+ { LPGEN("Send image"), "IMAGE", IDI_IMAGE }
};
-static HANDLE GetIconHandle(int iconId) {
- int i;
- for (i = 0; i < SIZEOF(iconList); i++)
+static HANDLE GetIconHandle(int iconId)
+{
+ for (int i = 0; i < SIZEOF(iconList); i++)
if (iconList[i].defIconID == iconId)
- return iconList[i].hIconLibItem;
+ return iconList[i].hIcolib;
+
return NULL;
}
-HICON GetIcolibIcon(int iconId) {
+HICON GetIcolibIcon(int iconId)
+{
HANDLE handle = GetIconHandle(iconId);
if (handle != NULL)
return Skin_GetIconByHandle(handle);
@@ -121,33 +116,9 @@ void ReleaseIcolibIcon(HICON hIcon) {
Skin_ReleaseIcon(hIcon);
}
-/*
-static int TlenIconsChanged(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- return 0;
-}
-*/
-
static void TlenRegisterIcons()
{
- TCHAR path[MAX_PATH], szSectionName[100];
- mir_sntprintf(szSectionName, SIZEOF( szSectionName ), _T("%s/%s"), _T("Protocols"), _T("Tlen"));
- GetModuleFileName(hInst, path, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.cx = sid.cy = 16;
- sid.ptszSection = szSectionName;
- sid.ptszDefaultFile = path;
- sid.flags = SIDF_ALL_TCHAR;
-
- for (int i = 0; i < SIZEOF(iconList); i++ ) {
- char szSettingName[100];
- mir_snprintf( szSettingName, sizeof( szSettingName ), "TLEN_%s", iconList[i].szName );
- sid.pszName = szSettingName;
- sid.pszDescription = (char*)iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- iconList[i].hIconLibItem = Skin_AddIcon(&sid);;
- }
+ Icon_Register(hInst, "Protocols/Tlen", iconList, SIZEOF(iconList), "TLEN");
}
int TlenPrebuildContactMenu(void *ptr, WPARAM wParam, LPARAM lParam)
diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp
index 3014c4523b..cb9dd71e9d 100644
--- a/protocols/Twitter/src/theme.cpp
+++ b/protocols/Twitter/src/theme.cpp
@@ -20,20 +20,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
extern OBJLIST<TwitterProto> g_Instances;
-struct
+static IconItem icons[] =
{
- const char* name;
- const char* descr;
- int defIconID;
- const char* section;
-}
-static const icons[] =
-{
- { "twitter", "Twitter Icon", IDI_TWITTER },
- { "tweet", "Tweet", IDI_TWITTER },
- { "reply", "Reply to Tweet", IDI_TWITTER },
+ { LPGEN("Twitter Icon"), "twitter", IDI_TWITTER },
+ { LPGEN("Tweet"), "tweet", IDI_TWITTER },
+ { LPGEN("Reply to Tweet"), "reply", IDI_TWITTER },
- { "homepage", "Visit Homepage", 0, "core_main_2" },
+ { LPGEN("Visit Homepage"), "homepage", 0 },
};
static HANDLE hIconLibItem[SIZEOF(icons)];
@@ -41,59 +34,19 @@ static HANDLE hIconLibItem[SIZEOF(icons)];
// TODO: uninit
void InitIcons(void)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInstance, szFile, SIZEOF(szFile));
-
- char setting_name[100];
- char section_name[100];
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.cx = sid.cy = 16;
- sid.pszName = setting_name;
- sid.pszSection = section_name;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i=0; i<SIZEOF(icons); i++)
- {
- if(icons[i].defIconID)
- {
- mir_snprintf(setting_name,sizeof(setting_name),"%s_%s","Twitter",icons[i].name);
-
- if (icons[i].section)
- {
- mir_snprintf(section_name,sizeof(section_name),"%s/%s/%s",LPGEN("Protocols"),
- LPGEN("Twitter"), icons[i].section);
- }
- else
- {
- mir_snprintf(section_name,sizeof(section_name),"%s/%s",LPGEN("Protocols"),
- LPGEN("Twitter"));
- }
-
- sid.pszDescription = (char*)icons[i].descr;
- sid.iDefaultIndex = -icons[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- }
- else // External icons
- {
- hIconLibItem[i] = Skin_GetIconHandle(icons[i].section);
- }
- }
+ Icon_Register(g_hInstance, "Protocols/Twitter", icons, SIZEOF(icons), "Twitter");
+ icons[ SIZEOF(icons)-1 ].hIcolib = Skin_GetIconHandle("core_main_2");
}
HANDLE GetIconHandle(const char* name)
{
for(size_t i=0; i<SIZEOF(icons); i++)
- {
- if(strcmp(icons[i].name,name) == 0)
+ if(strcmp(icons[i].szName, name) == 0)
return hIconLibItem[i];
- }
+
return 0;
}
-
-
// Contact List menu stuff
static HANDLE g_hMenuItems[2];
static HANDLE g_hMenuEvts[3];
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp
index 8bb1fe3397..808bc7dabc 100644
--- a/protocols/Xfire/src/main.cpp
+++ b/protocols/Xfire/src/main.cpp
@@ -142,6 +142,8 @@ PLUGININFOEX pluginInfoEx={
{ 0x9b8e1735, 0x970d, 0x4ce0, { 0x93, 0xc, 0xa5, 0x61, 0x95, 0x6b, 0xdc, 0xa2 } }
};
+static IconItem icon = { LPGEN("Protocol icon"), "XFIRE_main", IDI_TM };
+
INT_PTR RecvMessage(WPARAM wParam, LPARAM lParam);
INT_PTR SendMessage(WPARAM wParam, LPARAM lParam);
@@ -1361,17 +1363,7 @@ extern "C" __declspec(dllexport) int Load(void)
XFireLog("Wasn't able to get GetExtendedUdpTable function");
}
- char szFile[MAX_PATH];
- GetModuleFileNameA(hinstance, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.pszDefaultFile = szFile;
- sid.cx = sid.cy = 16;
- sid.ptszSection = LPGENT( "Protocols/XFire" );
- sid.pszName = "XFIRE_main";
- sid.ptszDescription = TranslateT("Protocol icon");
- sid.iDefaultIndex = -IDI_TM;
- Skin_AddIcon(&sid);
+ Icon_Register(hinstance, LPGENT("Protocols/XFire"), &icon, 1);
hExtraIcon1 = ExtraIcon_Register("xfire_game", "XFire game icon", "", ExtraListRebuild, ExtraImageApply);
hExtraIcon2 = ExtraIcon_Register("xfire_voice", "XFire voice icon", "", ExtraListRebuild, ExtraImageApply);
diff --git a/protocols/Yahoo/src/icolib.cpp b/protocols/Yahoo/src/icolib.cpp
index 40ca82da25..eace62ab11 100644
--- a/protocols/Yahoo/src/icolib.cpp
+++ b/protocols/Yahoo/src/icolib.cpp
@@ -17,13 +17,8 @@
#include "resource.h"
-struct
+static IconItem iconList[] =
{
- const char* szDescr;
- const char* szName;
- int defIconID;
-}
-static iconList[] = {
{ LPGEN("Main"), "yahoo", IDI_YAHOO },
{ LPGEN("Mail"), "mail", IDI_INBOX },
{ LPGEN("Profile"), "profile", IDI_PROFILE },
@@ -37,26 +32,7 @@ HANDLE hIconLibItem[SIZEOF(iconList)];
void CYahooProto::IconsInit( void )
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInstance, szFile, SIZEOF(szFile));
-
- char szSectionName[100];
- mir_snprintf(szSectionName, sizeof(szSectionName), "%s/%s", LPGEN("Protocols"), LPGEN("YAHOO"));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.pszSection = szSectionName;
- sid.flags = SIDF_PATH_TCHAR;
-
- for ( int i = 0; i < SIZEOF(iconList); i++ ) {
- char szSettingName[100];
- mir_snprintf( szSettingName, sizeof( szSettingName ), "YAHOO_%s", iconList[i].szName );
-
- sid.pszName = szSettingName;
- sid.pszDescription = (char* )iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- }
+ Icon_Register(hInstance, "Protocols/YAHOO", iconList, SIZEOF(iconList), "YAHOO");
}
HICON CYahooProto::LoadIconEx( const char* name, bool big )