Esempio n. 1
0
PVOID Server_LoadPreferences (LPIDENT lpiServer)
{
   LPSERVER_PREF psp = New (SERVER_PREF);

   if (!RestorePreferences (lpiServer, psp, sizeof(SERVER_PREF)))
      {
      Alert_SetDefaults (&psp->oa);

      psp->perWarnAggFull = perDEFAULT_AGGFULL_WARNING;
      psp->perWarnSetFull = perDEFAULT_SETFULL_WARNING;
      psp->fWarnSvcStop = fDEFAULT_SVCSTOP_WARNING;
      psp->fWarnSvrTimeout = TRUE;
      psp->fWarnSetNoVLDB = TRUE;
      psp->fWarnSetNoServ = TRUE;
      psp->fWarnAggNoServ = TRUE;
      psp->fWarnAggAlloc = FALSE;

      psp->rLast.right = 0;
      psp->fOpen = FALSE;
      psp->fExpandTree = TRUE;
      }

   psp->fIsMonitored = TRUE; // until dispatch.cpp sets it otherwise

   Alert_Initialize (&psp->oa);
   return psp;
}
Esempio n. 2
0
PVOID Filesets_LoadPreferences (LPIDENT lpiFileset)
{
   LPFILESET_PREF pfp = New (FILESET_PREF);

   if (!RestorePreferences (lpiFileset, pfp, sizeof(FILESET_PREF)))
      {
      pfp->perWarnSetFull = -1;	// use the server's default value

      Alert_SetDefaults (&pfp->oa);
      }

   Alert_Initialize (&pfp->oa);
   return pfp;
}
Esempio n. 3
0
/*
** LoadPrintPreferences
**
** Read an X database to obtain print dialog preferences.
**
**	prefDB		X database potentially containing print preferences
**	appName		Application name which can be used to qualify
**			resource names for database lookup.
**	appClass	Application class which can be used to qualify
**			resource names for database lookup.
**	lookForFlpr	Check if the flpr print command is installed
**			and use that for the default if it's found.
**			(flpr is a Fermilab utility for printing on
**			arbitrary systems that support the lpr protocol)
*/
void LoadPrintPreferences(Ne_Database* prefDB, const char* appName, int lookForFlpr)
{
   static char defaultQueue[MAX_QUEUE_STR], defaultHost[MAX_HOST_STR];

   /* check if flpr is installed, and otherwise choose appropriate
      printer per system type */
   if (lookForFlpr && flprPresent())
   {
      getFlprQueueDefault(defaultQueue);
      getFlprHostDefault(defaultHost);
      PrintPrefDescrip.printCommand.defaultString = "flpr";
      PrintPrefDescrip.copiesOption.defaultString = "";
      PrintPrefDescrip.queueOption.defaultString = "-q";
      PrintPrefDescrip.nameOption.defaultString = "-j ";
      PrintPrefDescrip.hostOption.defaultString = "-h";
      PrintPrefDescrip.defaultQueue.defaultString = defaultQueue;
      PrintPrefDescrip.defaultHost.defaultString = defaultHost;
   }
   else
   {
#ifdef USE_LPR_PRINT_CMD
      getLprQueueDefault(defaultQueue);
      PrintPrefDescrip.printCommand.defaultString = "lpr";
      PrintPrefDescrip.copiesOption.defaultString = "-# ";
      PrintPrefDescrip.queueOption.defaultString = "-P ";
      PrintPrefDescrip.nameOption.defaultString = "-J ";
      PrintPrefDescrip.hostOption.defaultString = "";
      PrintPrefDescrip.defaultQueue.defaultString = defaultQueue;
      PrintPrefDescrip.defaultHost.defaultString = "";
#else
      getLpQueueDefault(defaultQueue);
      PrintPrefDescrip.printCommand.defaultString = "lp"; /* was lp -c */
      PrintPrefDescrip.copiesOption.defaultString = "-n";
      PrintPrefDescrip.queueOption.defaultString = "-d";
      PrintPrefDescrip.nameOption.defaultString = "-t";
      PrintPrefDescrip.hostOption.defaultString = "";
      PrintPrefDescrip.defaultQueue.defaultString = defaultQueue;
      PrintPrefDescrip.defaultHost.defaultString = "";
#endif
   }

   /* Read in the preferences from the X database using the mechanism from
      prefFile.c (this allows LoadPrintPreferences to work before any
      widgets are created, which is more convenient than XtGetApplication-
      Resources for applications which have no main window) */
   RestorePreferences(NULL, prefDB, appName, (PrefDescripRec*)&PrintPrefDescrip, N_PRINT_PREFS);

   PreferencesLoaded = true;
}
Esempio n. 4
0
PVOID Aggregates_LoadPreferences (LPIDENT lpiAggregate)
{
   LPAGGREGATE_PREF pap = New (AGGREGATE_PREF);

   if (!RestorePreferences (lpiAggregate, pap, sizeof(AGGREGATE_PREF)))
      {
      pap->perWarnAggFull = -1;	// use the server's default value
      pap->fWarnAggAlloc = FALSE;

      Alert_SetDefaults (&pap->oa);
      }

   Alert_Initialize (&pap->oa);
   return pap;
}
Esempio n. 5
0
PVOID Services_LoadPreferences (LPIDENT lpiService)
{
   LPSERVICE_PREF psp = New (SERVICE_PREF);

   if (!RestorePreferences (lpiService, psp, sizeof(SERVICE_PREF)))
      {
      psp->fWarnSvcStop = TRUE;
      Alert_SetDefaults (&psp->oa);

      Services_GuessLogName (psp->szLogFile, lpiService);

      // write the logfile down so we won't have to guess again.
      StorePreferences (lpiService, psp, sizeof(SERVICE_PREF));
      }

   Alert_Initialize (&psp->oa);
   return psp;
}