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