🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #2180

Re: Setting the UNIX Preferences from a service

#2180
From: Bob Vadnais
Date: Tue, 05 Jan 1993 00:59
36 lines
1859 bytes
In article <1993Jan3.073519.1235@parsec.mixcom.com> 
alberto@parsec.mixcom.com (Manuel Alberto Ricart) writes:
>
> Is there a way of messaging the Workspace to be in UNIX
> Expert mode? (Is there a way of finding out what messages
> the Listener responds to?)  

I'm not sure if there's an officially documented way to do it,
but there's no black magic involved and it's not very complicated.
All you need to do is set the preference in the defaults database,
then use the NXWorkspaceRequestProtocol method to notify the 
workspace that the defaults database changed.  

The following function should do just that.

void setUnixExpert(BOOL expert) 
/* Requires NS3.0 or greater (for NXWorkspaceRequestProtocol) */
{
  const char *unixExpertValue = NXGetDefaultValue("System", "UnixExpert");
  const char *newUnixExpertValue = expert ? "No" : "Yes";
  BOOL changeDefault = (unixExpertValue == NULL) || 
                (strcasecmp(unixExpertValue, newUnixExpertValue));
   
  if (changeDefault) {
    NXWriteDefault("System", "UnixExpert", newUnixExpertValue);
    [[Application workspace] defaultsChanged];
  }
  
}

Cheers,
Bob
--
Bob_Vadnais@pdh.com (NeXT Mail welcome)
PDH Inc., 2635 North First Street Suite 224, San Jose, CA 95134-2034
Voice: (408)428-9596  Fax: (408)428-9599
Technical Details
Message-ID: <C0Cw2M.5oJ@pdh.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!umn.edu!csus.edu!netcom.com!pdh.com!news
References: <1993Jan3.073519.1235@parsec.mixcom.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!umn.edu!csus.edu!netcom.com!pdh.com!news
From: Bob_Vadnais@pdh.com (Bob Vadnais)
Subject: Re: Setting the UNIX Preferences from a service
Message-ID: <C0Cw2M.5oJ@pdh.com>
Sender: news@pdh.com (USENET News Account)
Nntp-Posting-Host: alpine
Reply-To: Bob_Vadnais@pdh.com
Organization: PDH, Inc.
References: <1993Jan3.073519.1235@parsec.mixcom.com>
Date: Tue, 5 Jan 1993 00:59:09 GMT
Lines: 36