diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2016-03-27 10:24:54 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2016-03-27 10:24:54 +0000 |
commit | 6e9ace645b7d24ed0fe60f4b7714d3bb11739dfc (patch) | |
tree | 10c6c2c8666a7421744910f9ab58630dc88dd47c /protocols/GTalkExt | |
parent | 61efc6be20aa4315e9e524dffeb9b5c812ab19cc (diff) |
GTalkExt: icon added to icolib
git-svn-id: http://svn.miranda-ng.org/main/trunk@16553 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/GTalkExt')
-rw-r--r-- | protocols/GTalkExt/src/GTalkExt.cpp | 8 | ||||
-rw-r--r-- | protocols/GTalkExt/src/inbox.cpp | 13 | ||||
-rw-r--r-- | protocols/GTalkExt/src/menu.cpp | 4 | ||||
-rw-r--r-- | protocols/GTalkExt/src/notifications.cpp | 3 | ||||
-rw-r--r-- | protocols/GTalkExt/src/options.cpp | 17 | ||||
-rw-r--r-- | protocols/GTalkExt/src/stdafx.h | 2 |
6 files changed, 17 insertions, 30 deletions
diff --git a/protocols/GTalkExt/src/GTalkExt.cpp b/protocols/GTalkExt/src/GTalkExt.cpp index 506e59af32..391ebfa405 100644 --- a/protocols/GTalkExt/src/GTalkExt.cpp +++ b/protocols/GTalkExt/src/GTalkExt.cpp @@ -30,10 +30,14 @@ CLIST_INTERFACE *pcli;
int hLangpack;
-HICON g_hPopupIcon = 0;
LIST<GoogleTalkAcc> g_accs(1, HandleKeySortT);
+IconItem iconList[] =
+{
+ { LPGEN("Popup icon"), "gtalk_popup_icon", IDI_POPUP }
+};
+
PLUGININFOEX pluginInfo =
{
sizeof(PLUGININFOEX),
@@ -87,7 +91,7 @@ extern "C" int __declspec(dllexport) Load(void) cls.lpszClassName = TEMP_WINDOW_CLASS_NAME;
RegisterClass(&cls);
- g_hPopupIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_POPUP));
+ Icon_Register(g_hInst, LPGEN("Protocols") "/GTalkExt", iconList, _countof(iconList));
InitAvaUnit(TRUE);
diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index c58533f122..e97e6a02c0 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -62,17 +62,8 @@ LPSTR HttpPost(HANDLE hUser, LPSTR reqUrl, LPSTR reqParams) nlhr.pData = reqParams;
nlhr.dataLength = (int)mir_strlen(reqParams);
- NETLIBHTTPREQUEST *pResp = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hUser, (LPARAM)&nlhr);
- if (!pResp) return NULL;
- __try {
- if (HTTP_OK == pResp->resultCode)
- return mir_strdup(pResp->pData);
- else
- return NULL;
- }
- __finally {
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)pResp);
- }
+ NLHR_PTR pResp((NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hUser, (LPARAM)&nlhr));
+ return ((pResp && pResp->resultCode == HTTP_OK) ? mir_strdup(pResp->pData) : nullptr);
}
LPSTR MakeRequest(HANDLE hUser, LPSTR reqUrl, LPSTR reqParamsFormat, LPSTR p1, LPSTR p2)
diff --git a/protocols/GTalkExt/src/menu.cpp b/protocols/GTalkExt/src/menu.cpp index a35854bfd6..6fdb8f9b63 100644 --- a/protocols/GTalkExt/src/menu.cpp +++ b/protocols/GTalkExt/src/menu.cpp @@ -27,8 +27,6 @@ #define MS_GTALKEXT_OPENMAILBOX SHORT_PLUGIN_NAME "/OpenMailbox"
-extern HICON g_hPopupIcon;
-
INT_PTR OpenMailboxMenuHandler(WPARAM, LPARAM, LPARAM param)
{
OpenContactInbox((LPCSTR)param);
@@ -46,7 +44,7 @@ int InitMenus(WPARAM wParam, LPARAM lParam) CMenuItem mi;
mi.root = HGENMENU(wParam);
- mi.hIcolibItem = g_hPopupIcon;
+ mi.hIcolibItem = iconList[0].hIcolib;
mi.position = 200101;
mi.name.a = LPGEN("Open mailbox");
mi.pszService = szServiceName;
diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index 9c0d1e409c..b1277de614 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -220,8 +220,7 @@ void ShowNotification(LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LP if (!UsePopups())
return;
- extern HICON g_hPopupIcon;
- data->lchIcon = g_hPopupIcon;
+ data->lchIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib);
data->iSeconds = (int)db_get_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0);
data->colorBack = (COLORREF)db_get_dw(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, 0);
data->colorText = (COLORREF)db_get_dw(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, 0);
diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp index d82087963b..30987c66b6 100644 --- a/protocols/GTalkExt/src/options.cpp +++ b/protocols/GTalkExt/src/options.cpp @@ -36,8 +36,6 @@ #define TEST_LETTER_SENDER LPGENT(" bems\n")
#define TEST_LETTER_SNIP LPGENT("* Primitive type system\n* No overloading\n* Limited possibility of data abstraction, polymorphism, subtyping and code reuse\n* No metaprogramming except preprocessor macros\n* No exceptions")
-extern HINSTANCE g_hInst;
-
void CheckControlsEnabled(HWND wnd)
{
BOOL PopupsEnabled = (SendDlgItemMessage(wnd, IDC_POPUPSENABLED, BM_GETSTATE, 0, 0) & BST_CHECKED) == BST_CHECKED;
@@ -161,17 +159,12 @@ void ShowTestPopup(HWND wnd) mir_sntprintf(data.lptzText, TranslateTS(FULL_NOTIFICATION_FORMAT), TranslateTS(TEST_LETTER_SUBJECT), TranslateTS(TEST_LETTER_SENDER), TranslateTS(TEST_LETTER_SNIP));
int len = SendDlgItemMessage(wnd, IDC_TIMEOUTEDIT, WM_GETTEXTLENGTH, 0, 0) + 1;
- LPTSTR timeout = (LPTSTR)malloc(len * sizeof(TCHAR));
- __try {
- GetDlgItemText(wnd, IDC_TIMEOUTEDIT, timeout, len);
- data.iSeconds = _ttoi(timeout);
- }
- __finally {
- free(timeout);
- }
+ LPTSTR timeout = (LPTSTR)_alloca(len * sizeof(TCHAR));
+
+ GetDlgItemText(wnd, IDC_TIMEOUTEDIT, timeout, len);
+ data.iSeconds = _ttoi(timeout);
- extern HICON g_hPopupIcon;
- data.lchIcon = g_hPopupIcon;
+ data.lchIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib);
data.colorBack = (COLORREF)SendDlgItemMessage(wnd, IDC_BACKCOLORPICKER, CPM_GETCOLOUR, 0, 0);
data.colorText = (COLORREF)SendDlgItemMessage(wnd, IDC_TEXTCOLORPICKER, CPM_GETCOLOUR, 0, 0);
if (data.colorBack == data.colorText) {
diff --git a/protocols/GTalkExt/src/stdafx.h b/protocols/GTalkExt/src/stdafx.h index 86f1fdb01b..6df16f3fee 100644 --- a/protocols/GTalkExt/src/stdafx.h +++ b/protocols/GTalkExt/src/stdafx.h @@ -60,6 +60,7 @@ #include <m_clist.h>
#include <m_avatars.h>
#include <m_netlib.h>
+#include <m_icolib.h>
#include <win2k.h>
#pragma warning(pop)
@@ -67,6 +68,7 @@ extern HINSTANCE g_hInst;
extern LIST<GoogleTalkAcc> g_accs;
+extern IconItem iconList[];
void SetAvatar(MCONTACT hContact);
BOOL InitAvaUnit(BOOL init);
|