diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-01-06 18:32:12 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-01-06 18:32:12 +0000 |
commit | 97b13834eec468cfceeb43cbe1eeef944f2de7bc (patch) | |
tree | c20e17b364aefb95f20f41889b16b3db46a1b0e0 /plugins/NewsAggregator/Src/Services.cpp | |
parent | f416a25cafc951228dd12b22af0ac53b4fb7d68f (diff) |
added main menu item for disabling auto update (needs to add icons)
git-svn-id: http://svn.miranda-ng.org/main/trunk@2999 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewsAggregator/Src/Services.cpp')
-rw-r--r-- | plugins/NewsAggregator/Src/Services.cpp | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp index 72f666fa98..cecba97960 100644 --- a/plugins/NewsAggregator/Src/Services.cpp +++ b/plugins/NewsAggregator/Src/Services.cpp @@ -19,13 +19,13 @@ Boston, MA 02111-1307, USA. #include "common.h"
-int g_nStatus = ID_STATUS_OFFLINE;
+int g_nStatus = ID_STATUS_ONLINE;
UINT_PTR timerId = 0;
-void SetContactStatus(HANDLE hContact,int nNewStatus)
+void SetContactStatus(HANDLE hContact, int nNewStatus)
{
- if(DBGetContactSettingWord(hContact,MODULE,"Status",ID_STATUS_OFFLINE) != nNewStatus)
- DBWriteContactSettingWord(hContact,MODULE,"Status",nNewStatus);
+ if(DBGetContactSettingWord(hContact, MODULE, "Status", ID_STATUS_ONLINE) != nNewStatus)
+ DBWriteContactSettingWord(hContact, MODULE, "Status", nNewStatus);
}
static void __cdecl WorkingThread(void* param)
@@ -43,14 +43,14 @@ static void __cdecl WorkingThread(void* param) }
}
-int NewsAggrInit(WPARAM wParam,LPARAM lParam)
+int NewsAggrInit(WPARAM wParam, LPARAM lParam)
{
- HANDLE hContact= db_find_first();
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
if(IsMyContact(hContact))
{
- SetContactStatus(hContact, ID_STATUS_OFFLINE);
+ SetContactStatus(hContact, ID_STATUS_ONLINE);
}
hContact = db_find_next(hContact);
}
@@ -72,7 +72,6 @@ int NewsAggrPreShutdown(WPARAM wParam,LPARAM lParam) }
WindowList_Broadcast(hChangeFeedDlgList, WM_CLOSE, 0, 0);
- mir_forkthread(WorkingThread, (void*)ID_STATUS_OFFLINE);
KillTimer(NULL, timerId);
NetlibUnInit();
@@ -112,7 +111,7 @@ INT_PTR NewsAggrGetCaps(WPARAM wp,LPARAM lp) }
}
-INT_PTR NewsAggrSetStatus(WPARAM wp,LPARAM /*lp*/)
+INT_PTR NewsAggrSetStatus(WPARAM wp, LPARAM /*lp*/)
{
int nStatus = wp;
if ((ID_STATUS_ONLINE == nStatus) || (ID_STATUS_OFFLINE == nStatus))
@@ -242,4 +241,29 @@ INT_PTR NewsAggrRecvMessage(WPARAM wParam, LPARAM lParam) {
CallService(MS_PROTO_RECVMSG, 0, lParam);
return 0;
-}
\ No newline at end of file +}
+
+void UpdateMenu(BOOL State)
+{
+ CLISTMENUITEM mi = { sizeof(mi) };
+
+ if (!State) { // to enable auto-update
+ mi.ptszName = LPGENT("Auto Update Enabled");
+ mi.icolibItem = GetIconHandle("enabled");
+ }
+ else { // to disable auto-update
+ mi.ptszName = LPGENT("Auto Update Disabled");
+ mi.icolibItem = GetIconHandle("disabled");
+ }
+
+ mi.flags = CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hService2[0], (LPARAM)&mi);
+ db_set_b(NULL, MODULE, "AutoUpdate", !State);
+}
+
+// update the newsaggregator auto-update menu item when click on it
+INT_PTR EnableDisable(WPARAM wParam, LPARAM lParam)
+{
+ UpdateMenu(db_get_b(NULL, MODULE, "AutoUpdate", 1));
+ return 0;
+}
|