summaryrefslogtreecommitdiff
path: root/plugins/NewsAggregator/Src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/NewsAggregator/Src')
-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