diff options
Diffstat (limited to 'plugins/NewsAggregator/Src/Services.cpp')
-rw-r--r-- | plugins/NewsAggregator/Src/Services.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
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 |