summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-09-01 10:56:58 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-09-01 10:56:58 +0000
commit95dccf315ba175eaf848fd6d85af6eb306a7482f (patch)
tree0e5d65712a914566cf76370c78ae256bd744218e /src
parent1fba79d0cd33719c33a431b0c6ecd4b169acd4d5 (diff)
duplicate code removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@17235 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/clui.cpp14
-rw-r--r--src/mir_app/src/menu_groups.cpp25
2 files changed, 15 insertions, 24 deletions
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp
index 250287f634..2090775fd5 100644
--- a/src/mir_app/src/clui.cpp
+++ b/src/mir_app/src/clui.cpp
@@ -708,23 +708,15 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
break;
case POPUP_HIDEOFFLINEROOT:
- SendMessage(cli.hwndContactTree, CLM_SETHIDEOFFLINEROOT, !SendMessage(cli.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0), 0);
+ CallService(MS_CLIST_TOGGLEHIDEOFFLINEROOT, 0, 0);
break;
case POPUP_HIDEEMPTYGROUPS:
- {
- int newVal = !(GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS);
- db_set_b(NULL, "CList", "HideEmptyGroups", (BYTE)newVal);
- SendMessage(cli.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, newVal, 0);
- }
+ CallService(MS_CLIST_TOGGLEEMPTYGROUPS);
break;
case POPUP_DISABLEGROUPS:
- {
- int newVal = !(GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_USEGROUPS);
- db_set_b(NULL, "CList", "UseGroups", (BYTE)newVal);
- SendMessage(cli.hwndContactTree, CLM_SETUSEGROUPS, newVal, 0);
- }
+ CallService(MS_CLIST_TOGGLEGROUPS);
break;
case POPUP_HIDEMIRANDA:
diff --git a/src/mir_app/src/menu_groups.cpp b/src/mir_app/src/menu_groups.cpp
index 1eda0aa080..e4a0a1d0af 100644
--- a/src/mir_app/src/menu_groups.cpp
+++ b/src/mir_app/src/menu_groups.cpp
@@ -103,31 +103,30 @@ INT_PTR FreeOwnerDataGroupMenu(WPARAM, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
-INT_PTR HideGroupsHelper(WPARAM, LPARAM)
+static INT_PTR HideGroupsHelper(WPARAM, LPARAM)
{
int newVal = !(GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS);
db_set_b(NULL, "CList", "HideEmptyGroups", (BYTE)newVal);
SendMessage(cli.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, newVal, 0);
- return 0;
+ return newVal;
}
-INT_PTR UseGroupsHelper(WPARAM, LPARAM)
+static INT_PTR UseGroupsHelper(WPARAM, LPARAM)
{
int newVal = !(GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_USEGROUPS);
db_set_b(NULL, "CList", "UseGroups", (BYTE)newVal);
SendMessage(cli.hwndContactTree, CLM_SETUSEGROUPS, newVal,0);
- return 0;
+ return newVal;
}
-INT_PTR HideOfflineRootHelper(WPARAM, LPARAM)
+static INT_PTR HideOfflineRootHelper(WPARAM, LPARAM)
{
- SendMessage(cli.hwndContactTree, CLM_SETHIDEOFFLINEROOT,
- !SendMessage(cli.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0),
- 0);
- return 0;
+ int newVal = !SendMessage(cli.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0);
+ SendMessage(cli.hwndContactTree, CLM_SETHIDEOFFLINEROOT, newVal, 0);
+ return newVal;
}
-INT_PTR CreateGroupHelper(WPARAM, LPARAM)
+static INT_PTR CreateGroupHelper(WPARAM, LPARAM)
{
SendMessage(cli.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, 0, 0);
SendMessage(cli.hwndContactTree, CLM_SETUSEGROUPS, 1, 0);
@@ -301,21 +300,21 @@ void InitGroupMenus(void)
SET_UID(mi, 0xeded7371, 0xf6e6, 0x48c3, 0x8c, 0x9e, 0x62, 0xc1, 0xd5, 0xcb, 0x51, 0xbc);
mi.position = 500002;
- mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper";
+ mi.pszService = MS_CLIST_TOGGLEHIDEOFFLINEROOT;
mi.name.a = LPGEN("Hide &offline users out here");
hHideOfflineUsersOutHereMenuItem = Menu_AddGroupMenuItem(&mi);
CreateServiceFunction(mi.pszService, HideOfflineRootHelper);
SET_UID(mi, 0x4c17b9cf, 0x513a, 0x41d8, 0x8d, 0x2b, 0x89, 0x44, 0x81, 0x14, 0x0, 0x91);
mi.position = 500003;
- mi.pszService = "CLISTMENUSGroup/HideGroupsHelper";
+ mi.pszService = MS_CLIST_TOGGLEEMPTYGROUPS;
mi.name.a = LPGEN("Hide &empty groups");
hHideEmptyGroupsMenuItem = Menu_AddGroupMenuItem(&mi);
CreateServiceFunction(mi.pszService, HideGroupsHelper);
SET_UID(mi, 0xfcbdbbb1, 0xa553, 0x49ac, 0xa5, 0xdf, 0xb4, 0x81, 0x38, 0xf, 0xa0, 0xc7);
mi.position = 500004;
- mi.pszService = "CLISTMENUSGroup/UseGroupsHelper";
+ mi.pszService = MS_CLIST_TOGGLEGROUPS;
mi.name.a = LPGEN("Disable &groups");
hDisableGroupsMenuItem = Menu_AddGroupMenuItem(&mi);
CreateServiceFunction(mi.pszService, UseGroupsHelper);