From b2eb0ef7a0f7f2b2bae0a48966038a673701df21 Mon Sep 17 00:00:00 2001 From: aunsane Date: Sat, 24 Feb 2018 01:22:45 +0300 Subject: Db_autobackups: Reworking settings of DB Autobackup (#1144) --- plugins/Db_autobackups/src/main.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'plugins/Db_autobackups/src/main.cpp') diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index 9aa48d8c6d..561e31dfeb 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -2,7 +2,6 @@ int hLangpack; HINSTANCE g_hInstance; -wchar_t *profilePath; HANDLE hFolder; char g_szMirVer[100]; @@ -80,13 +79,18 @@ static int ModulesLoad(WPARAM, LPARAM) mi.position = 500100001; Menu_AddMainMenuItem(&mi); - profilePath = Utils_ReplaceVarsW(L"%miranda_userdata%"); - if (hFolder = FoldersRegisterCustomPathT(LPGEN("Database backups"), LPGEN("Backup folder"), DIR SUB_DIR)) { HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersGetBackupPath); FoldersGetBackupPath(0, 0); } - options.use_dropbox = (BOOL)(db_get_b(0, "AutoBackups", "UseDropbox", 0) && ServiceExists(MS_DROPBOX_UPLOAD)); + else { + DBVARIANT dbv; + if (!db_get_ws(0, MODULE, "Folder", &dbv)) { + wcsncpy_s(options.folder, dbv.ptszVal, _TRUNCATE); + db_free(&dbv); + } + else mir_snwprintf(options.folder, L"%s%s", DIR, SUB_DIR); + } if (options.backup_types & BT_START) BackupStart(nullptr); @@ -124,7 +128,8 @@ extern "C" __declspec(dllexport) int Load(void) CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs); HookEvent(ME_OPT_INITIALISE, OptionsInit); - LoadOptions(); + + SetBackupTimer(); return 0; } -- cgit v1.2.3