win32-name-event-objects-20040228
[openafs.git] / src / WINNT / afssvrmgr / set_general.cpp
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
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  */
9
10 extern "C" {
11 #include <afs/param.h>
12 #include <afs/stds.h>
13 }
14
15 #include "svrmgr.h"
16 #include "set_general.h"
17
18
19 /*
20  * FILESET PREFERENCES ________________________________________________________
21  *
22  */
23
24 PVOID Filesets_LoadPreferences (LPIDENT lpiFileset)
25 {
26    LPFILESET_PREF pfp = New (FILESET_PREF);
27
28    if (!RestorePreferences (lpiFileset, pfp, sizeof(FILESET_PREF)))
29       {
30       pfp->perWarnSetFull = -1; // use the server's default value
31
32       Alert_SetDefaults (&pfp->oa);
33       }
34
35    Alert_Initialize (&pfp->oa);
36    return pfp;
37 }
38
39
40 BOOL Filesets_SavePreferences (LPIDENT lpiFileset)
41 {
42    BOOL rc = FALSE;
43
44    PVOID pfp = lpiFileset->GetUserParam();
45    if (pfp != NULL)
46       {
47       rc = StorePreferences (lpiFileset, pfp, sizeof(FILESET_PREF));
48       }
49
50    return rc;
51 }
52
53
54 /*
55  * ROUTINES ___________________________________________________________________
56  *
57  */
58
59 LPIDENT Filesets_GetSelected (HWND hDlg)
60 {
61    return (LPIDENT)FL_GetSelectedData (GetDlgItem (hDlg, IDC_SET_LIST));
62 }
63
64
65 LPIDENT Filesets_GetFocused (HWND hDlg, POINT *pptHitTest)
66 {
67    HWND hList = GetDlgItem (hDlg, IDC_SET_LIST);
68
69    if (pptHitTest == NULL)
70       {
71       return (LPIDENT)FL_GetFocusedData (hList);
72       }
73
74    HLISTITEM hItem;
75    if ((hItem = FastList_ItemFromPoint (hList, pptHitTest, TRUE)) != NULL)
76       {
77       return (LPIDENT)FL_GetData (hList, hItem);
78       }
79
80    return NULL;
81 }
82
83
84 BOOL Filesets_fIsLocked (LPFILESETSTATUS pfs)
85 {
86    return (pfs->State & fsLOCKED) ? TRUE : FALSE;
87 }
88