diff options
author | George Hazan <george.hazan@gmail.com> | 2012-12-02 18:19:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-12-02 18:19:49 +0000 |
commit | c4582dd65b444e5dae29ada7cc3f6c9a9c20edf3 (patch) | |
tree | 17a8627550b202d62df8e1df76d2585d3d0cdeaa /protocols/Twitter/src | |
parent | 5ea5feb7e052ca45af7bc9ed76e4a252bd71950d (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/Twitter/src')
-rw-r--r-- | protocols/Twitter/src/theme.cpp | 65 |
1 files changed, 9 insertions, 56 deletions
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];
|