diff options
author | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2010-11-15 00:28:54 +0000 |
---|---|---|
committer | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2010-11-15 00:28:54 +0000 |
commit | bcd2e033563fdfd886335953bb0473c30a818d5c (patch) | |
tree | 56559209e903deb7beebebc4d059bb9f8ea349d9 | |
parent | e7c1a8dc1fb9820fe25481e39dc739b64df6a217 (diff) |
TopToolbar support (patch by FREAK_THEMIGHTY)
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@574 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r-- | updater/options.cpp | 2 | ||||
-rw-r--r-- | updater/updater.cpp | 86 |
2 files changed, 51 insertions, 37 deletions
diff --git a/updater/options.cpp b/updater/options.cpp index 4b6115e..7315ca2 100644 --- a/updater/options.cpp +++ b/updater/options.cpp @@ -435,7 +435,7 @@ void LoadOptions(void) options.backup = (DBGetContactSettingByte(0, MODULE, "Backup", 1) == 1);
//options.use_xml_backend = (DBGetContactSettingByte(0, MODULE, "UseXML", 1) == 1);
options.use_xml_backend = true;
- options.start_offline = (DBGetContactSettingByte(0, MODULE, "StartOffline", 1) == 1);
+ options.start_offline = (DBGetContactSettingByte(0, MODULE, "StartOffline", 0) == 1);
options.popup_notify = (DBGetContactSettingByte(0, MODULE, "PopupNotify", 0) == 1);
options.restart_menu_item = (DBGetContactSettingByte(0, MODULE, "RestartMenuItem", 0) == 1);
options.update_and_exit_menu_item = (DBGetContactSettingByte(0, MODULE, "UpdateAndExitMenuItem", 0) == 1);
diff --git a/updater/updater.cpp b/updater/updater.cpp index 417dfdb..fa3a71f 100644 --- a/updater/updater.cpp +++ b/updater/updater.cpp @@ -1,12 +1,14 @@ #include "common.h"
#include "updater.h"
+
#include <m_hotkeys.h>
+#include "m_toolbar.h"
HINSTANCE hInst;
PLUGINLINK *pluginLink;
HANDLE hNetlibUser, hNetlibHttp;
-HANDLE hEventOptInit, hEventModulesLoaded, hEventIdleChanged;
+HANDLE hEventOptInit, hEventModulesLoaded, hEventIdleChanged, hToolBarLoaded;
MM_INTERFACE mmi;
UTF8_INTERFACE utfi;
@@ -74,29 +76,10 @@ void InitNetlib() { hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nl_user);
}
-void DeinitNetlib() {
- Netlib_CloseHandle(hNetlibUser);
-}
-
int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
LoadOptions();
- /*
- // done by DoStartupProcess in second 'services' modules loaded hook...i hope :)
- if(!options.check_on_startup) {
- RestoreStatus();
- }
- */
-
- /*{
- char buff[265];
- sprintf(buff, "sizeof(Update) == %d", sizeof(Update));
- PUShowMessage(buff, SM_NOTIFY);
- }*/
-
- InitIcons();
-
InitOptionsMenuItems();
InitNetlib();
@@ -235,37 +218,66 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) { return 0;
}
+
+static int ToolbarModulesLoaded(WPARAM, LPARAM)
+{
+ TBButton tbb = {0};
+ tbb.cbSize = sizeof(TBButton);
+ tbb.tbbFlags = TBBF_SHOWTOOLTIP;
+
+ tbb.pszButtonID = "updater_checkforupdates";
+ tbb.pszButtonName = LPGEN("Check for Updates");
+ tbb.pszServiceName = MS_UPDATE_CHECKFORUPDATES;
+ tbb.pszTooltipUp = LPGEN("Check for Updates of Plugins");
+ tbb.hPrimaryIconHandle = GetIconHandle(I_CHKUPD);
+ tbb.defPos = 1000;
+ CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&tbb);
+
+ tbb.pszButtonID = "updater_restart";
+ tbb.pszButtonName = LPGEN("Restart");
+ tbb.pszServiceName = MS_UPDATE_MENURESTART;
+ tbb.pszTooltipUp = LPGEN("Restart Miranda IM");
+ tbb.hPrimaryIconHandle = GetIconHandle(I_RSTRT);
+ tbb.defPos = 1001;
+ CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&tbb);
+
+ tbb.pszButtonID = "updater_updateandexit";
+ tbb.pszButtonName = LPGEN("Update and Exit");
+ tbb.pszServiceName = MS_UPDATE_MENUUPDATEANDEXIT;
+ tbb.pszTooltipUp = LPGEN("Update and Exit Miranda IM");
+ tbb.hPrimaryIconHandle = GetIconHandle(I_CHKUPDEXT);
+ tbb.defPos = 1002;
+ CallService(MS_TB_ADDBUTTON,0, (LPARAM)&tbb);
+
+ return 0;
+}
+
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
{
pluginLink = link;
- mir_getLI( &li );
- mir_getMMI( &mmi );
- mir_getUTFI( &utfi );
+ mir_getLI(&li);
+ mir_getMMI(&mmi);
+ mir_getUTFI(&utfi);
// save global status from clist - will be restored after update check if that option is enabled, or in modules loaded if not
- options.start_offline = (DBGetContactSettingByte(0, MODULE, "StartOffline", 1) == 1); // load option here - rest loading in modulesloaded
- if(options.start_offline) {
+ options.start_offline = (DBGetContactSettingByte(0, MODULE, "StartOffline", 0) == 1); // load option here - rest loading in modulesloaded
+ if (options.start_offline)
+ {
WORD saved_status = DBGetContactSettingWord(0, "CList", "Status", ID_STATUS_OFFLINE);
- if(saved_status != ID_STATUS_OFFLINE) {
+ if (saved_status != ID_STATUS_OFFLINE)
+ {
DBWriteContactSettingWord(0, MODULE, "SavedGlobalStatus", saved_status);
DBWriteContactSettingWord(0, "CList", "Status", ID_STATUS_OFFLINE);
}
}
- INITCOMMONCONTROLSEX icex;
-
- // Ensure that the common control DLL is loaded (for listview)
- icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
- icex.dwICC = ICC_LISTVIEW_CLASSES;
- InitCommonControlsEx(&icex);
-
hEventOptInit = HookEvent(ME_OPT_INITIALISE, OptInit);
-
- // do this before init services, so that InitPopups is called before startup update
hEventModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ hToolBarLoaded = HookEvent(ME_TB_MODULELOADED, ToolbarModulesLoaded);
InitServices();
+ InitIcons();
return 0;
}
@@ -275,10 +287,12 @@ extern "C" int __declspec(dllexport) Unload(void) UnhookEvent(hEventIdleChanged);
UnhookEvent(hEventOptInit);
UnhookEvent(hEventModulesLoaded);
+ UnhookEvent(hToolBarLoaded);
DeinitServices();
DeinitPopups();
- DeinitNetlib();
+ Netlib_CloseHandle(hNetlibUser);
+
return 0;
}
|