LINUX: afs_create infinite fetchStatus loop
[pkg-k5-afs_openafs.git] / src / WINNT / afsusrmgr / grp_delete.cpp
blobe4208c82c071399642a2ab48a6dc5a065785b03e
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
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
8 */
10 extern "C" {
11 #include <afs/param.h>
12 #include <afs/stds.h>
15 #include "TaAfsUsrMgr.h"
16 #include "grp_delete.h"
20 * DEFINITIONS ________________________________________________________________
26 * PROTOTYPES _________________________________________________________________
30 BOOL CALLBACK Group_Delete_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
31 void Group_Delete_OnInitDialog (HWND hDlg);
32 void Group_Delete_OnDestroy (HWND hDlg);
33 void Group_Delete_OnOK (HWND hDlg);
37 * ROUTINES ___________________________________________________________________
41 void Group_ShowDelete (LPASIDLIST pGroupList)
43 ModalDialogParam (IDD_GROUP_DELETE, g.hMain, (DLGPROC)Group_Delete_DlgProc, (LPARAM)pGroupList);
47 BOOL CALLBACK Group_Delete_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
49 if (AfsAppLib_HandleHelp (IDD_GROUP_DELETE, hDlg, msg, wp, lp))
50 return TRUE;
52 switch (msg)
54 case WM_INITDIALOG:
55 SetWindowLongPtr (hDlg, DWLP_USER, lp);
56 Group_Delete_OnInitDialog (hDlg);
57 break;
59 case WM_DESTROY:
60 Group_Delete_OnDestroy (hDlg);
61 break;
63 case WM_COMMAND:
64 switch (LOWORD(wp))
66 case IDOK:
67 Group_Delete_OnOK (hDlg);
68 EndDialog (hDlg, IDOK);
69 break;
71 case IDCANCEL:
72 EndDialog (hDlg, IDCANCEL);
73 break;
75 break;
78 return FALSE;
82 void Group_Delete_OnInitDialog (HWND hDlg)
84 LPASIDLIST pGroupList = (LPASIDLIST)GetWindowLongPtr (hDlg, DWLP_USER);
86 // Fix the title of the dialog
88 if (pGroupList->cEntries == 1)
90 ULONG status;
91 TCHAR szName[ cchNAME ];
92 asc_ObjectNameGet_Fast (g.idClient, g.idCell, pGroupList->aEntries[0].idObject, szName, &status);
94 TCHAR szText[ cchRESOURCE ];
95 GetDlgItemText (hDlg, IDC_DELETE_TITLE, szText, cchRESOURCE);
97 LPTSTR pszText = FormatString (szText, TEXT("%s"), szName);
98 SetDlgItemText (hDlg, IDC_DELETE_TITLE, pszText);
99 FreeString (pszText);
101 else
103 LPTSTR pszNames = CreateNameList (pGroupList);
105 LPTSTR pszText = FormatString (IDS_GROUP_DELETE_MULTIPLE, TEXT("%s"), pszNames);
106 SetDlgItemText (hDlg, IDC_DELETE_TITLE, pszText);
107 FreeString (pszText);
109 FreeString (pszNames);
114 void Group_Delete_OnDestroy (HWND hDlg)
116 LPASIDLIST pGroupList = (LPASIDLIST)GetWindowLongPtr (hDlg, DWLP_USER);
117 asc_AsidListFree (&pGroupList);
121 void Group_Delete_OnOK (HWND hDlg)
123 LPASIDLIST pGroupList = (LPASIDLIST)GetWindowLongPtr (hDlg, DWLP_USER);
125 // Start a background task to do all the work.
127 LPASIDLIST pTask;
128 asc_AsidListCopy (&pTask, &pGroupList);
129 StartTask (taskGROUP_DELETE, NULL, pTask);