home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / next / programm / 7981 < prev    next >
Encoding:
Text File  |  1993-01-05  |  1.8 KB  |  50 lines

  1. Newsgroups: comp.sys.next.programmer
  2. Path: 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
  3. From: Bob_Vadnais@pdh.com (Bob Vadnais)
  4. Subject: Re: Setting the UNIX Preferences from a service
  5. Message-ID: <C0Cw2M.5oJ@pdh.com>
  6. Sender: news@pdh.com (USENET News Account)
  7. Nntp-Posting-Host: alpine
  8. Reply-To: Bob_Vadnais@pdh.com
  9. Organization: PDH, Inc.
  10. References: <1993Jan3.073519.1235@parsec.mixcom.com>
  11. Date: Tue, 5 Jan 1993 00:59:09 GMT
  12. Lines: 36
  13.  
  14. In article <1993Jan3.073519.1235@parsec.mixcom.com> 
  15. alberto@parsec.mixcom.com (Manuel Alberto Ricart) writes:
  16. >
  17. > Is there a way of messaging the Workspace to be in UNIX
  18. > Expert mode? (Is there a way of finding out what messages
  19. > the Listener responds to?)  
  20.  
  21. I'm not sure if there's an officially documented way to do it,
  22. but there's no black magic involved and it's not very complicated.
  23. All you need to do is set the preference in the defaults database,
  24. then use the NXWorkspaceRequestProtocol method to notify the 
  25. workspace that the defaults database changed.  
  26.  
  27. The following function should do just that.
  28.  
  29. void setUnixExpert(BOOL expert) 
  30. /* Requires NS3.0 or greater (for NXWorkspaceRequestProtocol) */
  31. {
  32.   const char *unixExpertValue = NXGetDefaultValue("System", "UnixExpert");
  33.   const char *newUnixExpertValue = expert ? "No" : "Yes";
  34.   BOOL changeDefault = (unixExpertValue == NULL) || 
  35.                 (strcasecmp(unixExpertValue, newUnixExpertValue));
  36.    
  37.   if (changeDefault) {
  38.     NXWriteDefault("System", "UnixExpert", newUnixExpertValue);
  39.     [[Application workspace] defaultsChanged];
  40.   }
  41.   
  42. }
  43.  
  44. Cheers,
  45. Bob
  46. --
  47. Bob_Vadnais@pdh.com (NeXT Mail welcome)
  48. PDH Inc., 2635 North First Street Suite 224, San Jose, CA 95134-2034
  49. Voice: (408)428-9596  Fax: (408)428-9599
  50.