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
11 #include <afs/param.h>
16 #include "svr_general.h"
17 #include "propcache.h"
22 * SERVER PREFERENCES _________________________________________________________
26 PVOID Server_LoadPreferences (LPIDENT lpiServer)
28 LPSERVER_PREF psp = New (SERVER_PREF);
30 if (!RestorePreferences (lpiServer, psp, sizeof(SERVER_PREF)))
32 Alert_SetDefaults (&psp->oa);
34 psp->perWarnAggFull = perDEFAULT_AGGFULL_WARNING;
35 psp->perWarnSetFull = perDEFAULT_SETFULL_WARNING;
36 psp->fWarnSvcStop = fDEFAULT_SVCSTOP_WARNING;
37 psp->fWarnSvrTimeout = TRUE;
38 psp->fWarnSetNoVLDB = TRUE;
39 psp->fWarnSetNoServ = TRUE;
40 psp->fWarnAggNoServ = TRUE;
41 psp->fWarnAggAlloc = FALSE;
45 psp->fExpandTree = TRUE;
48 psp->fIsMonitored = TRUE; // until dispatch.cpp sets it otherwise
50 Alert_Initialize (&psp->oa);
55 BOOL Server_SavePreferences (LPIDENT lpiServer)
59 PVOID psp = lpiServer->GetUserParam();
62 rc = StorePreferences (lpiServer, psp, sizeof(SERVER_PREF));
70 * ROUTINES ___________________________________________________________________
74 void Server_ShowPopupMenu (HWND hList, POINT ptList, POINT ptScreen)
76 if (!ptScreen.x && !ptScreen.y)
79 GetWindowRect (hList, &rWindow);
80 ptScreen.x = rWindow.left + (rWindow.right -rWindow.left)/2;
81 ptScreen.y = rWindow.top + (rWindow.bottom -rWindow.top)/2;
82 Server_ShowParticularPopupMenu (hList, ptScreen, NULL);
84 else if (FL_HitTestForHeaderBar (hList, ptList))
86 HMENU hm = TaLocale_LoadMenu (MENU_COLUMNS);
87 DisplayContextMenu (hm, ptScreen, hList);
91 LPIDENT lpiServer = NULL;
94 if ((hItem = FastList_ItemFromPoint (hList, &ptList, TRUE)) != NULL)
95 lpiServer = (LPIDENT)FL_GetData (hList, hItem);
97 if (lpiServer && (lpiServer != (LPIDENT)FL_GetSelectedData (hList)))
100 Server_ShowParticularPopupMenu (hList, ptScreen, lpiServer);
105 void Server_ShowParticularPopupMenu (HWND hParent, POINT ptScreen, LPIDENT lpiServer)
109 if (lpiServer == NULL)
110 hm = TaLocale_LoadMenu (MENU_SVR_NONE);
112 hm = TaLocale_LoadMenu (MENU_SVR);
116 if (lpiServer == NULL)
118 int lvs = (gr.fPreview && !gr.fVert) ? gr.diHorz.viewSvr.lvsView : gr.diVert.viewSvr.lvsView;
119 HMENU hmView = GetSubMenu (hm, 0);
121 CheckMenuRadioItem (hmView,
122 M_SVR_VIEW_LARGE, M_SVR_VIEW_REPORT,
123 ( (lvs == FLS_VIEW_SMALL) ? M_SVR_VIEW_SMALL :
124 (lvs == FLS_VIEW_LIST) ? M_SVR_VIEW_REPORT :
128 ICONVIEW ivSvr = Display_GetServerIconView();
130 CheckMenuRadioItem (hmView,
131 M_SVR_VIEW_ONEICON, M_SVR_VIEW_STATUS,
132 (ivSvr == ivTWOICONS) ? M_SVR_VIEW_TWOICONS :
133 (ivSvr == ivONEICON) ? M_SVR_VIEW_ONEICON : M_SVR_VIEW_STATUS,
136 if (lvs != FLS_VIEW_LIST)
138 EnableMenu (hmView, M_SVR_VIEW_ONEICON, FALSE);
139 EnableMenu (hmView, M_SVR_VIEW_TWOICONS, FALSE);
140 EnableMenu (hmView, M_SVR_VIEW_STATUS, FALSE);
143 if (!PropCache_Search (pcSERVER, ANYVALUE))
144 EnableMenu (hmView, M_SVR_CLOSEALL, FALSE);
148 BOOL fOpenNow = (BOOL)!!(PropCache_Search (pcSERVER, lpiServer));
151 if ( ((lpsp = (LPSERVER_PREF)lpiServer->GetUserParam()) == NULL) ||
152 (lpsp->fIsMonitored) )
154 EnableMenu (hm, M_SVR_OPEN, !fOpenNow);
155 EnableMenu (hm, M_SVR_CLOSE, fOpenNow);
156 CheckMenu (hm, M_SVR_MONITOR, TRUE);
161 EnableMenu (hm, M_SVR_CLOSE, FALSE);
162 if (fOpenNow || !gr.fOpenMonitors)
163 EnableMenu (hm, M_SVR_OPEN, FALSE);
165 CheckMenu (hm, M_SVR_MONITOR, FALSE);
167 EnableMenu (hm, M_SVR_SECURITY, FALSE);
168 EnableMenu (hm, M_SALVAGE, FALSE);
169 EnableMenu (hm, M_SET_CLONE, FALSE);
170 EnableMenu (hm, M_SET_UNLOCK, FALSE);
171 EnableMenu (hm, M_SYNCVLDB, FALSE);
175 DisplayContextMenu (hm, ptScreen, hParent);