home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / Networking / SambaManager / NIDirectory.h < prev    next >
Encoding:
Text File  |  1998-04-01  |  5.1 KB  |  145 lines

  1. /*
  2.     SambaManger. A graphical frontend to configure the NetInfo enhanced samba.
  3.     Copyright (C) 1998  Robert Frank
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.         
  19.         Robert Frank, frank@ifi.unibas.ch
  20. */
  21.  
  22. #import <appkit/appkit.h>
  23. #import <nikit/NIDomain.h>
  24. #import <netinfo/ni.h>
  25.  
  26. // The different types of panels for obtaining items:
  27. #define NIPT_NONE            0
  28. #define NIPT_FILE            1
  29. #define NIPT_DIR            2
  30. #define NIPT_NETINFO    3
  31.  
  32. @interface NIDirectory:Object
  33. {
  34.     id                    delegate;         // Passed to NIProperty via the add... methods.
  35.  
  36.     ni_name            domainName;                // The string with the domain or NULL.
  37.     ni_name            dirName;                    // The string with the root of the directory.
  38.     ni_name            baseName;                    // The string with the directory or NULL.
  39.     ni_name            fullPath;                    // The full path if set.
  40.     
  41.     ni_name            saveTitle;
  42.     BOOL                mayChangeName;        // If the name may be changed before saving.
  43.     ni_name            user;                            // The user to authenticate.
  44.  
  45.     NIDomain        *domain;
  46.     ni_id                directory;
  47.     ni_proplist    properties;
  48.  
  49.     HashTable        *hash;                        // The hashtable
  50.     List                *list;                        // The linear list
  51. }
  52. // Create a new empty directory object. RootPath is the root to the
  53. // NetInfo directory which will be written. If dirPath is given, this
  54. // will be the mandatory directory to which to write the data.
  55. + new:sender root:(const char *)rootPath directory:(const char *)dirPath;
  56.  
  57. // Create a new directory object, show a NetInfo open panel
  58. // and read the selected NetInfo domain and directory.
  59. // Returns the NIDirectory object if successful.
  60. // If any errors occur, display the error message and return nil.
  61. + open:sender root:(const char *)rootPath withTitle:(const char *)title;
  62.  
  63. // Initialize a domain. This is usually not called directly but is invoked
  64. // by the class new and open methods. You can call init directly if you want
  65. // to check for or open an existing directory without displaying an open panel.
  66. - init:sender dom:(const char *)domPath
  67.                          root:(const char *)basePath dir:(const char *)dirPath
  68.                          errors:(BOOL)warn;
  69.  
  70. // Set the title to be displayed in the save panel.
  71. - setSaveTitle:(const char *)title;
  72.  
  73. // Set the user to authenticate. May be NULL for the mandatory root.
  74. - setAuthenticationUser:(const char *)userName;
  75.  
  76. // If the name many be changed before saving;
  77. - setAllowChangName:(BOOL)flag;
  78.  
  79. // Save the changes to niDirectory back into NetInfo.
  80. // Return self if successful. Displays an error message and
  81. // returns nil on failure. The previously read data and all modifications
  82. // remain unchanged.
  83. - save;
  84.  
  85. // Save to a new domain/directory as selected in the NISavePanel. Return
  86. // values same as save.
  87. - saveToDomain;
  88.  
  89. // Delete the directory from NetInfo. Does not free the NIDirectory object.
  90. // Returns nil on error.
  91. - delete;
  92.  
  93. // Close and free the directory.
  94. - close;
  95.  
  96. // Set/get the delegate to which the delegate methods are to be sent.
  97. - setDelegate:sender;
  98. - delegate;
  99.  
  100. // Get the domain name and the directory path
  101. - (const char *)domainName;
  102. - (const char *)directory;
  103. - (const char *)baseName;
  104.  
  105. // Get the domain, handle, and directoryid
  106. - (NIDomain *)domain;
  107. - (void *)handle;
  108. - (ni_id)directoryID;
  109.  
  110. // Methods for adding properties of specific types. Strings passed are only
  111. // referenced, not copied. They must exist during the whole life time of the object.
  112. // Returns the property object.
  113. - addBool:(const char *)label outlet:obj;
  114. - addChar:(const char *)label outlet:obj;
  115. - addInt:(const char *)label text:tObj slider:sObj zero:(const char *)string;
  116. - addString:(const char *)label outlet:obj;
  117. - addString:(const char *)label text:tObj button:bObj mode:(int)m path:(const char *)p
  118.         title:(const char *)tString;
  119. - addBrowser:(const char *)label browser:bObj text:tObj add:aObj remove:dObj;
  120. - addBrowser:(const char *)label browser:bObj add:aObj remove:dObj
  121.         mode:(int)m path:(const char *)p title:(const char *)tString;
  122. - addPopup:(const char *)label outlet:obj;
  123. - addPopup:(const char *)label outlet:obj default:(const char *)defStrng;
  124. - addCall:(const char *)label displayAction:(SEL)action;
  125. - addProperty:(const char *)label;
  126.  
  127. // Transfere from NetInfo property list to the GUI
  128. - scan;
  129.  
  130. // redisplay previously read values
  131. - reset;
  132.  
  133. // Return the NetInfo property of the given label.
  134. - property:(const char *)label;
  135.  
  136. @end
  137.  
  138. //******************************************************************
  139. // Methods that the delegate should implement:
  140. //
  141. // Called by the open method before reading a domain. If this method returns
  142. // NO, the open is aborted without an error and will return nil.
  143. // - (BOOL)niDirOk:(const char *)domain path:(const char *)directory;
  144. //
  145. //