summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-01-08 17:20:59 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-01-08 17:20:59 +0000
commitfefdc28f87152a94fc7397ebb00242b3ba15a286 (patch)
treefdc2252fe464dd635c74371e9a95c9624ed9cbdf /plugins
parent78f6d722ee8157e6d7ae01bc89e2b470a4d96bf2 (diff)
added toptoolbar support
git-svn-id: http://svn.miranda-ng.org/main/trunk@3018 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/NewsAggregator/Src/Common.h2
-rw-r--r--plugins/NewsAggregator/Src/NewsAggregator.cpp12
-rw-r--r--plugins/NewsAggregator/Src/Services.cpp19
3 files changed, 25 insertions, 8 deletions
diff --git a/plugins/NewsAggregator/Src/Common.h b/plugins/NewsAggregator/Src/Common.h
index cb4f99e5a2..9eaa4adafd 100644
--- a/plugins/NewsAggregator/Src/Common.h
+++ b/plugins/NewsAggregator/Src/Common.h
@@ -41,6 +41,7 @@ Boston, MA 02111-1307, USA.
#include <m_avatars.h>
#include <m_folders.h>
+#include <m_toptoolbar.h>
#include "version.h"
#include "resource.h"
@@ -109,6 +110,7 @@ INT_PTR ImportFeeds(WPARAM wParam, LPARAM lParam);
INT_PTR ExportFeeds(WPARAM wParam, LPARAM lParam);
INT_PTR CheckFeed(WPARAM wParam, LPARAM lParam);
INT_PTR EnableDisable(WPARAM wParam, LPARAM lParam);
+INT_PTR OnToolbarLoaded(WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
diff --git a/plugins/NewsAggregator/Src/NewsAggregator.cpp b/plugins/NewsAggregator/Src/NewsAggregator.cpp
index 141052d60d..e5eb15e66f 100644
--- a/plugins/NewsAggregator/Src/NewsAggregator.cpp
+++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp
@@ -22,7 +22,7 @@ Boston, MA 02111-1307, USA.
HINSTANCE hInst = NULL;
int hLangpack;
-HANDLE hOptHook = NULL, hLoadHook = NULL, hOnPreShutdown = NULL, hPrebuildMenuHook = NULL, hPackUpdaterFolder = NULL;
+HANDLE hPrebuildMenuHook = NULL, hPackUpdaterFolder = NULL;
HANDLE hProtoService[8];
HWND hAddFeedDlg;
HANDLE hChangeFeedDlgList = NULL;
@@ -78,9 +78,9 @@ extern "C" __declspec(dllexport) int Load(void)
}
// Add options hook
- hOptHook = HookEvent(ME_OPT_INITIALISE, OptInit);
- hLoadHook = HookEvent(ME_SYSTEM_MODULESLOADED, NewsAggrInit);
- hOnPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, NewsAggrPreShutdown);
+ HookEvent(ME_OPT_INITIALISE, OptInit);
+ HookEvent(ME_SYSTEM_MODULESLOADED, NewsAggrInit);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, NewsAggrPreShutdown);
hUpdateMutex = CreateMutex(NULL, FALSE, NULL);
hChangeFeedDlgList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST,0,0);
@@ -116,10 +116,6 @@ extern "C" __declspec(dllexport) int Unload(void)
for (int i = 0;i<NUM_SERVICES;i++)
DestroyServiceFunction(hService[i]);
- UnhookEvent(hOptHook);
- UnhookEvent(hLoadHook);
- UnhookEvent(hOnPreShutdown);
-
DestroyUpdateList();
CloseHandle(hUpdateMutex);
diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp
index cecba97960..c16222014a 100644
--- a/plugins/NewsAggregator/Src/Services.cpp
+++ b/plugins/NewsAggregator/Src/Services.cpp
@@ -21,6 +21,7 @@ Boston, MA 02111-1307, USA.
int g_nStatus = ID_STATUS_ONLINE;
UINT_PTR timerId = 0;
+HANDLE hTBButton = NULL;
void SetContactStatus(HANDLE hContact, int nNewStatus)
{
@@ -58,6 +59,8 @@ int NewsAggrInit(WPARAM wParam, LPARAM lParam)
InitIcons();
InitMenu();
+ HookEvent(ME_TTB_MODULELOADED, OnToolbarLoaded);
+
// timer for the first update
timerId = SetTimer(NULL, 0, 5000, timerProc2); // first update is 5 sec after load
@@ -258,6 +261,7 @@ void UpdateMenu(BOOL State)
mi.flags = CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hService2[0], (LPARAM)&mi);
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTBButton, State ? TTBST_PUSHED : TTBST_RELEASED);
db_set_b(NULL, MODULE, "AutoUpdate", !State);
}
@@ -267,3 +271,18 @@ INT_PTR EnableDisable(WPARAM wParam, LPARAM lParam)
UpdateMenu(db_get_b(NULL, MODULE, "AutoUpdate", 1));
return 0;
}
+
+INT_PTR OnToolbarLoaded(WPARAM wParam, LPARAM lParam)
+{
+ TTBButton tbb = {0};
+ tbb.cbSize = sizeof(TTBButton);
+ tbb.name = LPGEN("Enable/disable auto update");
+ tbb.pszService = MS_NEWSAGGREGATOR_ENABLED;
+ tbb.pszTooltipUp = LPGEN("Auto Update Enabled");
+ tbb.pszTooltipDn = LPGEN("Auto Update Disabled");
+ tbb.hIconHandleUp = GetIconHandle("enabled");
+ tbb.hIconHandleDn = GetIconHandle("disabled");
+ tbb.dwFlags = (db_get_b(NULL, MODULE, "AutoUpdate", 1) ? 0 : TTBBF_PUSHED) | TTBBF_ASPUSHBUTTON | TTBBF_VISIBLE;
+ hTBButton = TopToolbar_AddButton(&tbb);
+ return 0;
+} \ No newline at end of file