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 <afs/param.h>
19 #include "svr_general.h"
20 #include "propcache.h"
25 * SERVER PREFERENCES _________________________________________________________
29 PVOID Server_LoadPreferences (LPIDENT lpiServer)
31 LPSERVER_PREF psp = New (SERVER_PREF);
33 if (!RestorePreferences (lpiServer, psp, sizeof(SERVER_PREF)))
35 Alert_SetDefaults (&psp->oa);
37 psp->perWarnAggFull = perDEFAULT_AGGFULL_WARNING;
38 psp->perWarnSetFull = perDEFAULT_SETFULL_WARNING;
39 psp->fWarnSvcStop = fDEFAULT_SVCSTOP_WARNING;
40 psp->fWarnSvrTimeout = TRUE;
41 psp->fWarnSetNoVLDB = TRUE;
42 psp->fWarnSetNoServ = TRUE;
43 psp->fWarnAggNoServ = TRUE;
44 psp->fWarnAggAlloc = FALSE;
48 psp->fExpandTree = TRUE;
51 psp->fIsMonitored = TRUE; // until dispatch.cpp sets it otherwise
53 Alert_Initialize (&psp->oa);
58 BOOL Server_SavePreferences (LPIDENT lpiServer)
62 PVOID psp = lpiServer->GetUserParam();
65 rc = StorePreferences (lpiServer, psp, sizeof(SERVER_PREF));
73 * ROUTINES ___________________________________________________________________
77 void Server_ShowPopupMenu (HWND hList, POINT ptList, POINT ptScreen)
79 if (!ptScreen.x && !ptScreen.y)
82 GetWindowRect (hList, &rWindow);
83 ptScreen.x = rWindow.left + (rWindow.right -rWindow.left)/2;
84 ptScreen.y = rWindow.top + (rWindow.bottom -rWindow.top)/2;
85 Server_ShowParticularPopupMenu (hList, ptScreen, NULL);
87 else if (FL_HitTestForHeaderBar (hList, ptList))
89 HMENU hm = TaLocale_LoadMenu (MENU_COLUMNS);
90 DisplayContextMenu (hm, ptScreen, hList);
94 LPIDENT lpiServer = NULL;
97 if ((hItem = FastList_ItemFromPoint (hList, &ptList, TRUE)) != NULL)
98 lpiServer = (LPIDENT)FL_GetData (hList, hItem);
100 if (lpiServer && (lpiServer != (LPIDENT)FL_GetSelectedData (hList)))
103 Server_ShowParticularPopupMenu (hList, ptScreen, lpiServer);
108 void Server_ShowParticularPopupMenu (HWND hParent, POINT ptScreen, LPIDENT lpiServer)
112 if (lpiServer == NULL)
113 hm = TaLocale_LoadMenu (MENU_SVR_NONE);
115 hm = TaLocale_LoadMenu (MENU_SVR);
119 if (lpiServer == NULL)
121 int lvs = (gr.fPreview && !gr.fVert) ? gr.diHorz.viewSvr.lvsView : gr.diVert.viewSvr.lvsView;
122 HMENU hmView = GetSubMenu (hm, 0);
124 CheckMenuRadioItem (hmView,
125 M_SVR_VIEW_LARGE, M_SVR_VIEW_REPORT,
126 ( (lvs == FLS_VIEW_SMALL) ? M_SVR_VIEW_SMALL :
127 (lvs == FLS_VIEW_LIST) ? M_SVR_VIEW_REPORT :
131 ICONVIEW ivSvr = Display_GetServerIconView();
133 CheckMenuRadioItem (hmView,
134 M_SVR_VIEW_ONEICON, M_SVR_VIEW_STATUS,
135 (ivSvr == ivTWOICONS) ? M_SVR_VIEW_TWOICONS :
136 (ivSvr == ivONEICON) ? M_SVR_VIEW_ONEICON : M_SVR_VIEW_STATUS,
139 if (lvs != FLS_VIEW_LIST)
141 EnableMenu (hmView, M_SVR_VIEW_ONEICON, FALSE);
142 EnableMenu (hmView, M_SVR_VIEW_TWOICONS, FALSE);
143 EnableMenu (hmView, M_SVR_VIEW_STATUS, FALSE);
146 if (!PropCache_Search (pcSERVER, ANYVALUE))
147 EnableMenu (hmView, M_SVR_CLOSEALL, FALSE);
151 BOOL fOpenNow = (BOOL)!!(PropCache_Search (pcSERVER, lpiServer));
154 if ( ((lpsp = (LPSERVER_PREF)lpiServer->GetUserParam()) == NULL) ||
155 (lpsp->fIsMonitored) )
157 EnableMenu (hm, M_SVR_OPEN, !fOpenNow);
158 EnableMenu (hm, M_SVR_CLOSE, fOpenNow);
159 CheckMenu (hm, M_SVR_MONITOR, TRUE);
164 EnableMenu (hm, M_SVR_CLOSE, FALSE);
165 if (fOpenNow || !gr.fOpenMonitors)
166 EnableMenu (hm, M_SVR_OPEN, FALSE);
168 CheckMenu (hm, M_SVR_MONITOR, FALSE);
170 EnableMenu (hm, M_SVR_SECURITY, FALSE);
171 EnableMenu (hm, M_SALVAGE, FALSE);
172 EnableMenu (hm, M_SET_CLONE, FALSE);
173 EnableMenu (hm, M_SET_UNLOCK, FALSE);
174 EnableMenu (hm, M_SYNCVLDB, FALSE);
178 DisplayContextMenu (hm, ptScreen, hParent);