From 7b40d91a4f81cbba63ae7cabc263af69539bd22b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Fri, 30 May 2014 11:37:54 +0000 Subject: Unify Popup's and YAPP's value to check if they are enabled; YAPP's version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@9369 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Popup/src/main.cpp | 4 ++-- plugins/Popup/src/opt_gen.cpp | 2 +- plugins/YAPP/src/services.cpp | 26 +++++++++++++------------- plugins/YAPP/src/version.h | 2 +- plugins/YAPP/src/yapp.cpp | 6 +++--- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index eba19300b5..144b7cc9e5 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -164,7 +164,7 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM) //The module is enabled. //The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item. PopupOptions.ModuleIsEnabled = FALSE; - db_set_b(NULL, MODULNAME, "ModuleIsEnabled", FALSE); + db_set_b(NULL, "Popup", "ModuleIsEnabled", FALSE); mi.ptszName = LPGENT("Enable Popups"); mi.hIcon = IcoLib_GetIcon(ICO_POPUP_OFF,0); } @@ -172,7 +172,7 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM) //The module is disabled. //The action to do is enable popups (show enabled), then write "disable popup" in the new item. PopupOptions.ModuleIsEnabled = TRUE; - db_set_b(NULL, MODULNAME, "ModuleIsEnabled", TRUE); + db_set_b(NULL, "Popup", "ModuleIsEnabled", TRUE); mi.ptszName = LPGENT("Disable Popups"); mi.hIcon = IcoLib_GetIcon(ICO_POPUP_ON,0); } diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index b5e471b5bf..781b009795 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -121,7 +121,7 @@ void LoadOption_General() PopupOptions.ReorderPopupsWarning = db_get_b(NULL, MODULNAME, "ReorderPopupsWarning", TRUE); //disable When - PopupOptions.ModuleIsEnabled = db_get_b(NULL, MODULNAME, "ModuleIsEnabled", TRUE); + PopupOptions.ModuleIsEnabled = db_get_b(NULL, "Popup", "ModuleIsEnabled", TRUE); PopupOptions.DisableWhenFullscreen = db_get_b(NULL, MODULNAME, "DisableWhenFullscreen", TRUE); } diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp index aec7da79f6..772b7aaff3 100644 --- a/plugins/YAPP/src/services.cpp +++ b/plugins/YAPP/src/services.cpp @@ -70,7 +70,7 @@ static INT_PTR CreatePopup(WPARAM wParam, LPARAM lParam) pd_out->timeout = pd_in->iSeconds; lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0)); - if (!db_get_b(0, MODULE, "Enabled", 1)) { + if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { mir_free(pd_out->pwzTitle); mir_free(pd_out->pwzText); mir_free(pd_out); @@ -111,7 +111,7 @@ static INT_PTR CreatePopupW(WPARAM wParam, LPARAM lParam) pd_out->timeout = pd_in->iSeconds; lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0)); - if (!db_get_b(0, MODULE, "Enabled", 1)) { + if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { mir_free(pd_out->pwzTitle); mir_free(pd_out->pwzText); mir_free(pd_out); @@ -151,7 +151,7 @@ void ShowPopup(PopupData &pd_in) lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0)); - if (!db_get_b(0, MODULE, "Enabled", 1)) { + if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { mir_free(pd_out->pwzTitle); mir_free(pd_out->pwzText); mir_free(pd_out); @@ -193,7 +193,7 @@ static INT_PTR GetOpaque(WPARAM wParam, LPARAM lParam) void UpdateMenu() { - bool isEnabled = db_get_b(0, MODULE, "Enabled", 1) == 1; + bool isEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 1; CLISTMENUITEM mi = { sizeof(mi) }; mi.ptszName = (isEnabled ? LPGENT("Disable Popups") : LPGENT("Enable Popups")); @@ -213,21 +213,21 @@ INT_PTR PopupQuery(WPARAM wParam, LPARAM lParam) switch(wParam) { case PUQS_ENABLEPOPUPS: { - bool enabled = db_get_b(0, MODULE, "Enabled", 1) != 0; - if (!enabled) db_set_b(0, MODULE, "Enabled", 1); + bool enabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) != 0; + if (!enabled) db_set_b(0, "Popup", "ModuleIsEnabled", 1); return !enabled; } break; case PUQS_DISABLEPOPUPS: { - bool enabled = db_get_b(0, MODULE, "Enabled", 1) != 0; - if (enabled) db_set_b(0, MODULE, "Enabled", 0); + bool enabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) != 0; + if (enabled) db_set_b(0, "Popup", "ModuleIsEnabled", 0); return enabled; } break; case PUQS_GETSTATUS: - return db_get_b(0, MODULE, "Enabled", 1); + return db_get_b(0, "Popup", "ModuleIsEnabled", 1); default: return 1; @@ -238,8 +238,8 @@ INT_PTR PopupQuery(WPARAM wParam, LPARAM lParam) static INT_PTR TogglePopups(WPARAM wParam, LPARAM lParam) { - BYTE val = db_get_b(0, MODULE, "Enabled", 1); - db_set_b(0, MODULE, "Enabled", !val); + BYTE val = db_get_b(0, "Popup", "ModuleIsEnabled", 1); + db_set_b(0, "Popup", "ModuleIsEnabled", !val); UpdateMenu(); return 0; } @@ -288,7 +288,7 @@ static INT_PTR ShowMessage(WPARAM wParam, LPARAM lParam) if (bShutdown) return -1; - if (db_get_b(0, MODULE, "Enabled", 1)) { + if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { POPUPDATAT pd = {0}; _tcscpy(pd.lptzContactName, lParam == SM_WARNING ? _T("Warning") : _T("Notification")); pd.lchIcon = LoadIcon(0, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION); @@ -303,7 +303,7 @@ static INT_PTR ShowMessageW(WPARAM wParam, LPARAM lParam) if (bShutdown) return -1; - if (db_get_b(0, MODULE, "Enabled", 1)) { + if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { POPUPDATAW pd = {0}; wcscpy(pd.lpwzContactName, lParam == SM_WARNING ? L"Warning" : L"Notification"); pd.lchIcon = LoadIcon(0, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION); diff --git a/plugins/YAPP/src/version.h b/plugins/YAPP/src/version.h index fec1095952..ed7802f102 100644 --- a/plugins/YAPP/src/version.h +++ b/plugins/YAPP/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 5 #define __RELEASE_NUM 0 -#define __BUILD_NUM 11 +#define __BUILD_NUM 12 #include diff --git a/plugins/YAPP/src/yapp.cpp b/plugins/YAPP/src/yapp.cpp index 4b8ffe32f8..9f7bb8ee2f 100644 --- a/plugins/YAPP/src/yapp.cpp +++ b/plugins/YAPP/src/yapp.cpp @@ -75,7 +75,7 @@ int IconsChanged(WPARAM, LPARAM) { CLISTMENUITEM mi = { sizeof(mi) }; - mi.hIcon = IcoLib_GetIcon(db_get_b(0, MODULE, "Enabled", 1) ? ICO_POPUP_ON : ICO_POPUP_OFF, 0); + mi.hIcon = IcoLib_GetIcon(db_get_b(0, "Popup", "ModuleIsEnabled", 1) ? ICO_POPUP_ON : ICO_POPUP_OFF, 0); mi.flags = CMIM_ICON; Menu_ModifyItem(hMenuItem, &mi); Menu_ModifyItem(hMenuRoot, &mi); @@ -93,7 +93,7 @@ int TTBLoaded(WPARAM, LPARAM) ttb.pszService = "Popup/ToggleEnabled"; ttb.lParamUp = 1; ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ASPUSHBUTTON; - if (db_get_b(0, MODULE, "Enabled", 1)) + if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) ttb.dwFlags |= TTBBF_PUSHED; ttb.name = LPGEN("Toggle Popups"); ttb.hIconHandleUp = Skin_GetIconHandle(ICO_TB_POPUP_OFF); @@ -180,7 +180,7 @@ static void InitFonts() void InitMenuItems(void) { - bool isEnabled = db_get_b(0, MODULE, "Enabled", 1) == 1; + bool isEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 1; CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ROOTHANDLE|CMIF_TCHAR; -- cgit v1.2.3