2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 #include <afs/param.h>
16 #include "svr_prune.h"
17 #include "propcache.h"
20 * PROTOTYPES _________________________________________________________________
24 BOOL WINAPI Server_Prune_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
26 void Server_Prune_OnInitDialog (HWND hDlg, LPSVR_PRUNE_PARAMS lpp);
27 void Server_Prune_OnEndTask_InitDialog (HWND hDlg, LPTASKPACKET ptp, LPSVR_PRUNE_PARAMS lpp);
28 void Server_Prune_EnableOK (HWND hDlg);
29 void Server_Prune_OnOK (HWND hDlg);
33 * ROUTINES ___________________________________________________________________
37 void Server_Prune (LPIDENT lpiServer, BOOL fBAK, BOOL fOLD, BOOL fCore)
41 if ((hCurrent = PropCache_Search (pcSVR_PRUNE, NULL)) != NULL)
47 LPSVR_PRUNE_PARAMS lpp = New (SVR_PRUNE_PARAMS);
48 lpp->lpiServer = lpiServer;
53 HWND hDlg = ModelessDialogParam (IDD_SVR_PRUNE, NULL, (DLGPROC)Server_Prune_DlgProc, (LPARAM)lpp);
54 ShowWindow (hDlg, SW_SHOW);
59 BOOL WINAPI Server_Prune_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
61 if (AfsAppLib_HandleHelp (IDD_SVR_PRUNE, hDlg, msg, wp, lp))
64 LPSVR_PRUNE_PARAMS lpp;
66 if (msg == WM_INITDIALOG)
67 SetWindowLong (hDlg, DWL_USER, lp);
69 if ((lpp = (LPSVR_PRUNE_PARAMS)GetWindowLong(hDlg,DWL_USER)) != NULL)
74 PropCache_Add (pcSVR_PRUNE, NULL, hDlg);
75 Server_Prune_OnInitDialog (hDlg, lpp);
80 if ((ptp = (LPTASKPACKET)lp) != NULL)
82 if (ptp->idTask == taskSVR_ENUM_TO_COMBOBOX)
83 Server_Prune_OnEndTask_InitDialog (hDlg, ptp, lpp);
92 Server_Prune_OnOK (hDlg);
99 case IDC_OP_DELETE_BAK:
100 case IDC_OP_DELETE_OLD:
101 case IDC_OP_DELETE_CORE:
102 Server_Prune_EnableOK (hDlg);
108 SetWindowLong (hDlg, DWL_USER, 0);
109 PropCache_Delete (pcSVR_PRUNE, NULL);
119 void Server_Prune_OnInitDialog (HWND hDlg, LPSVR_PRUNE_PARAMS lpp)
121 CheckDlgButton (hDlg, IDC_OP_DELETE_BAK, lpp->fBAK);
122 CheckDlgButton (hDlg, IDC_OP_DELETE_OLD, lpp->fOLD);
123 CheckDlgButton (hDlg, IDC_OP_DELETE_CORE, lpp->fCore);
125 LPSVR_ENUM_TO_COMBOBOX_PACKET lppEnum = New (SVR_ENUM_TO_COMBOBOX_PACKET);
126 lppEnum->hCombo = GetDlgItem (hDlg, IDC_SERVER);
127 lppEnum->lpiSelect = lpp->lpiServer;
128 StartTask (taskSVR_ENUM_TO_COMBOBOX, hDlg, lppEnum);
130 EnableWindow (GetDlgItem (hDlg, IDC_SERVER), FALSE);
131 EnableWindow (GetDlgItem (hDlg, IDOK), FALSE);
135 void Server_Prune_OnEndTask_InitDialog (HWND hDlg, LPTASKPACKET ptp, LPSVR_PRUNE_PARAMS lpp)
137 EnableWindow (GetDlgItem (hDlg, IDC_SERVER), TRUE);
139 Server_Prune_EnableOK (hDlg);
143 void Server_Prune_EnableOK (HWND hDlg)
145 LPIDENT lpiServer = NULL;
147 if (IsWindowEnabled (GetDlgItem (hDlg, IDC_SERVER)))
149 lpiServer = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_SERVER));
152 BOOL fEnable = (lpiServer != NULL) ? TRUE : FALSE;
154 if ( !IsDlgButtonChecked (hDlg, IDC_OP_DELETE_BAK) &&
155 !IsDlgButtonChecked (hDlg, IDC_OP_DELETE_OLD) &&
156 !IsDlgButtonChecked (hDlg, IDC_OP_DELETE_CORE) )
161 EnableWindow (GetDlgItem (hDlg, IDOK), fEnable);
165 void Server_Prune_OnOK (HWND hDlg)
167 LPSVR_PRUNE_PARAMS lpp = New (SVR_PRUNE_PARAMS);
168 lpp->lpiServer = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_SERVER));
169 lpp->fBAK = IsDlgButtonChecked (hDlg, IDC_OP_DELETE_BAK);
170 lpp->fOLD = IsDlgButtonChecked (hDlg, IDC_OP_DELETE_OLD);
171 lpp->fCore = IsDlgButtonChecked (hDlg, IDC_OP_DELETE_CORE);
173 StartTask (taskSVR_PRUNE, NULL, lpp);