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
14 #include <afsconfig.h>
15 #include <afs/param.h>
20 #include "svr_general.h"
21 #include "propcache.h"
26 * SERVER PREFERENCES _________________________________________________________
30 PVOID Server_LoadPreferences (LPIDENT lpiServer)
32 LPSERVER_PREF psp = New (SERVER_PREF);
34 if (!RestorePreferences (lpiServer, psp, sizeof(SERVER_PREF)))
36 Alert_SetDefaults (&psp->oa);
38 psp->perWarnAggFull = perDEFAULT_AGGFULL_WARNING;
39 psp->perWarnSetFull = perDEFAULT_SETFULL_WARNING;
40 psp->fWarnSvcStop = fDEFAULT_SVCSTOP_WARNING;
41 psp->fWarnSvrTimeout = TRUE;
42 psp->fWarnSetNoVLDB = TRUE;
43 psp->fWarnSetNoServ = TRUE;
44 psp->fWarnAggNoServ = TRUE;
45 psp->fWarnAggAlloc = FALSE;
49 psp->fExpandTree = TRUE;
52 psp->fIsMonitored = TRUE; // until dispatch.cpp sets it otherwise
54 Alert_Initialize (&psp->oa);
59 BOOL Server_SavePreferences (LPIDENT lpiServer)
63 PVOID psp = lpiServer->GetUserParam();
66 rc = StorePreferences (lpiServer, psp, sizeof(SERVER_PREF));
74 * ROUTINES ___________________________________________________________________
78 void Server_ShowPopupMenu (HWND hList, POINT ptList, POINT ptScreen)
80 if (!ptScreen.x && !ptScreen.y)
83 GetWindowRect (hList, &rWindow);
84 ptScreen.x = rWindow.left + (rWindow.right -rWindow.left)/2;
85 ptScreen.y = rWindow.top + (rWindow.bottom -rWindow.top)/2;
86 Server_ShowParticularPopupMenu (hList, ptScreen, NULL);
88 else if (FL_HitTestForHeaderBar (hList, ptList))
90 HMENU hm = TaLocale_LoadMenu (MENU_COLUMNS);
91 DisplayContextMenu (hm, ptScreen, hList);
95 LPIDENT lpiServer = NULL;
98 if ((hItem = FastList_ItemFromPoint (hList, &ptList, TRUE)) != NULL)
99 lpiServer = (LPIDENT)FL_GetData (hList, hItem);
101 if (lpiServer && (lpiServer != (LPIDENT)FL_GetSelectedData (hList)))
104 Server_ShowParticularPopupMenu (hList, ptScreen, lpiServer);
109 void Server_ShowParticularPopupMenu (HWND hParent, POINT ptScreen, LPIDENT lpiServer)
113 if (lpiServer == NULL)
114 hm = TaLocale_LoadMenu (MENU_SVR_NONE);
116 hm = TaLocale_LoadMenu (MENU_SVR);
120 if (lpiServer == NULL)
122 int lvs = (gr.fPreview && !gr.fVert) ? gr.diHorz.viewSvr.lvsView : gr.diVert.viewSvr.lvsView;
123 HMENU hmView = GetSubMenu (hm, 0);
125 CheckMenuRadioItem (hmView,
126 M_SVR_VIEW_LARGE, M_SVR_VIEW_REPORT,
127 ( (lvs == FLS_VIEW_SMALL) ? M_SVR_VIEW_SMALL :
128 (lvs == FLS_VIEW_LIST) ? M_SVR_VIEW_REPORT :
132 ICONVIEW ivSvr = Display_GetServerIconView();
134 CheckMenuRadioItem (hmView,
135 M_SVR_VIEW_ONEICON, M_SVR_VIEW_STATUS,
136 (ivSvr == ivTWOICONS) ? M_SVR_VIEW_TWOICONS :
137 (ivSvr == ivONEICON) ? M_SVR_VIEW_ONEICON : M_SVR_VIEW_STATUS,
140 if (lvs != FLS_VIEW_LIST)
142 EnableMenu (hmView, M_SVR_VIEW_ONEICON, FALSE);
143 EnableMenu (hmView, M_SVR_VIEW_TWOICONS, FALSE);
144 EnableMenu (hmView, M_SVR_VIEW_STATUS, FALSE);
147 if (!PropCache_Search (pcSERVER, ANYVALUE))
148 EnableMenu (hmView, M_SVR_CLOSEALL, FALSE);
152 BOOL fOpenNow = (BOOL)!!(PropCache_Search (pcSERVER, lpiServer));
155 if ( ((lpsp = (LPSERVER_PREF)lpiServer->GetUserParam()) == NULL) ||
156 (lpsp->fIsMonitored) )
158 EnableMenu (hm, M_SVR_OPEN, !fOpenNow);
159 EnableMenu (hm, M_SVR_CLOSE, fOpenNow);
160 CheckMenu (hm, M_SVR_MONITOR, TRUE);
165 EnableMenu (hm, M_SVR_CLOSE, FALSE);
166 if (fOpenNow || !gr.fOpenMonitors)
167 EnableMenu (hm, M_SVR_OPEN, FALSE);
169 CheckMenu (hm, M_SVR_MONITOR, FALSE);
171 EnableMenu (hm, M_SVR_SECURITY, FALSE);
172 EnableMenu (hm, M_SALVAGE, FALSE);
173 EnableMenu (hm, M_SET_CLONE, FALSE);
174 EnableMenu (hm, M_SET_UNLOCK, FALSE);
175 EnableMenu (hm, M_SYNCVLDB, FALSE);
179 DisplayContextMenu (hm, ptScreen, hParent);