From 4895fb61e1e1538ca039fcf803f2829cdf3371c2 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Thu, 5 Mar 2015 19:25:49 +0000 Subject: Tox: more correct way to register folders git-svn-id: http://svn.miranda-ng.org/main/trunk@12332 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/Tox_12.vcxproj | 1 - protocols/Tox/Tox_12.vcxproj.filters | 3 --- protocols/Tox/src/main.cpp | 3 ++- protocols/Tox/src/tox_events.cpp | 7 +++++++ protocols/Tox/src/tox_folders.cpp | 8 -------- protocols/Tox/src/tox_profile.cpp | 2 ++ protocols/Tox/src/tox_proto.h | 9 ++++----- 7 files changed, 15 insertions(+), 18 deletions(-) delete mode 100644 protocols/Tox/src/tox_folders.cpp (limited to 'protocols') diff --git a/protocols/Tox/Tox_12.vcxproj b/protocols/Tox/Tox_12.vcxproj index 31c52283a9..9afe2be779 100644 --- a/protocols/Tox/Tox_12.vcxproj +++ b/protocols/Tox/Tox_12.vcxproj @@ -232,7 +232,6 @@ copy docs\tox.ini "$(SolutionDir)$(Configuration)64\Plugins" /y - diff --git a/protocols/Tox/Tox_12.vcxproj.filters b/protocols/Tox/Tox_12.vcxproj.filters index 526b86f4ff..d04033b672 100644 --- a/protocols/Tox/Tox_12.vcxproj.filters +++ b/protocols/Tox/Tox_12.vcxproj.filters @@ -143,9 +143,6 @@ Source Files - - Source Files - diff --git a/protocols/Tox/src/main.cpp b/protocols/Tox/src/main.cpp index fedd47ccc0..ffc0e5aafb 100644 --- a/protocols/Tox/src/main.cpp +++ b/protocols/Tox/src/main.cpp @@ -52,7 +52,8 @@ extern "C" int __declspec(dllexport) Load(void) CToxProto::InitIcons(); CToxProto::InitMenus(); - CToxProto::InitFolders(); + + HookEvent(ME_SYSTEM_MODULESLOADED, &CToxProto::OnModulesLoaded); return 0; } diff --git a/protocols/Tox/src/tox_events.cpp b/protocols/Tox/src/tox_events.cpp index 87c688c593..fb1ce6ba43 100644 --- a/protocols/Tox/src/tox_events.cpp +++ b/protocols/Tox/src/tox_events.cpp @@ -1,5 +1,12 @@ #include "common.h" +int CToxProto::OnModulesLoaded(WPARAM, LPARAM) +{ + hProfileFolderPath = FoldersRegisterCustomPathT("Tox", Translate("Profiles folder"), MIRANDA_USERDATAT); + + return 0; +} + int CToxProto::OnContactDeleted(MCONTACT hContact, LPARAM) { if (!IsOnline()) diff --git a/protocols/Tox/src/tox_folders.cpp b/protocols/Tox/src/tox_folders.cpp deleted file mode 100644 index a082aeb1b4..0000000000 --- a/protocols/Tox/src/tox_folders.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "common.h" - -HANDLE CToxProto::hProfileFolderPath = NULL; - -void CToxProto::InitFolders() -{ - hProfileFolderPath = FoldersRegisterCustomPathT("Tox", Translate("Profiles folder"), MIRANDA_USERDATAT); -} diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 9d1d446099..7ac4516cde 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -1,5 +1,7 @@ #include "common.h" +HANDLE CToxProto::hProfileFolderPath; + std::tstring CToxProto::GetToxProfilePath() { return GetToxProfilePath(m_tszUserName); diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 9932a74aca..fc6e089f84 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -71,8 +71,8 @@ public: static void InitMenus(); static void UninitMenus(); - // folders - static void InitFolders(); + // events + static int OnModulesLoaded(WPARAM, LPARAM); private: Tox *tox; @@ -83,6 +83,8 @@ private: bool isTerminated, isConnected; CTransferList transfers; + static HANDLE hProfileFolderPath; + // tox profile std::tstring GetToxProfilePath(); static std::tstring CToxProto::GetToxProfilePath(const TCHAR *accountName); @@ -141,9 +143,6 @@ private: int OnInitStatusMenu(); - // folders - static HANDLE hProfileFolderPath; - //services INT_PTR __cdecl CToxProto::SetMyNickname(WPARAM wParam, LPARAM lParam); -- cgit v1.2.3