home *** CD-ROM | disk | FTP | other *** search
- /*
- SambaManger. A graphical frontend to configure the NetInfo enhanced samba.
- Copyright (C) 1998 Robert Frank
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Robert Frank, frank@ifi.unibas.ch
- */
-
- #import <appkit/appkit.h>
- #import <nikit/NIDomain.h>
- #import <netinfo/ni.h>
-
- // The different types of panels for obtaining items:
- #define NIPT_NONE 0
- #define NIPT_FILE 1
- #define NIPT_DIR 2
- #define NIPT_NETINFO 3
-
- @interface NIDirectory:Object
- {
- id delegate; // Passed to NIProperty via the add... methods.
-
- ni_name domainName; // The string with the domain or NULL.
- ni_name dirName; // The string with the root of the directory.
- ni_name baseName; // The string with the directory or NULL.
- ni_name fullPath; // The full path if set.
-
- ni_name saveTitle;
- BOOL mayChangeName; // If the name may be changed before saving.
- ni_name user; // The user to authenticate.
-
- NIDomain *domain;
- ni_id directory;
- ni_proplist properties;
-
- HashTable *hash; // The hashtable
- List *list; // The linear list
- }
- // Create a new empty directory object. RootPath is the root to the
- // NetInfo directory which will be written. If dirPath is given, this
- // will be the mandatory directory to which to write the data.
- + new:sender root:(const char *)rootPath directory:(const char *)dirPath;
-
- // Create a new directory object, show a NetInfo open panel
- // and read the selected NetInfo domain and directory.
- // Returns the NIDirectory object if successful.
- // If any errors occur, display the error message and return nil.
- + open:sender root:(const char *)rootPath withTitle:(const char *)title;
-
- // Initialize a domain. This is usually not called directly but is invoked
- // by the class new and open methods. You can call init directly if you want
- // to check for or open an existing directory without displaying an open panel.
- - init:sender dom:(const char *)domPath
- root:(const char *)basePath dir:(const char *)dirPath
- errors:(BOOL)warn;
-
- // Set the title to be displayed in the save panel.
- - setSaveTitle:(const char *)title;
-
- // Set the user to authenticate. May be NULL for the mandatory root.
- - setAuthenticationUser:(const char *)userName;
-
- // If the name many be changed before saving;
- - setAllowChangName:(BOOL)flag;
-
- // Save the changes to niDirectory back into NetInfo.
- // Return self if successful. Displays an error message and
- // returns nil on failure. The previously read data and all modifications
- // remain unchanged.
- - save;
-
- // Save to a new domain/directory as selected in the NISavePanel. Return
- // values same as save.
- - saveToDomain;
-
- // Delete the directory from NetInfo. Does not free the NIDirectory object.
- // Returns nil on error.
- - delete;
-
- // Close and free the directory.
- - close;
-
- // Set/get the delegate to which the delegate methods are to be sent.
- - setDelegate:sender;
- - delegate;
-
- // Get the domain name and the directory path
- - (const char *)domainName;
- - (const char *)directory;
- - (const char *)baseName;
-
- // Get the domain, handle, and directoryid
- - (NIDomain *)domain;
- - (void *)handle;
- - (ni_id)directoryID;
-
- // Methods for adding properties of specific types. Strings passed are only
- // referenced, not copied. They must exist during the whole life time of the object.
- // Returns the property object.
- - addBool:(const char *)label outlet:obj;
- - addChar:(const char *)label outlet:obj;
- - addInt:(const char *)label text:tObj slider:sObj zero:(const char *)string;
- - addString:(const char *)label outlet:obj;
- - addString:(const char *)label text:tObj button:bObj mode:(int)m path:(const char *)p
- title:(const char *)tString;
- - addBrowser:(const char *)label browser:bObj text:tObj add:aObj remove:dObj;
- - addBrowser:(const char *)label browser:bObj add:aObj remove:dObj
- mode:(int)m path:(const char *)p title:(const char *)tString;
- - addPopup:(const char *)label outlet:obj;
- - addPopup:(const char *)label outlet:obj default:(const char *)defStrng;
- - addCall:(const char *)label displayAction:(SEL)action;
- - addProperty:(const char *)label;
-
- // Transfere from NetInfo property list to the GUI
- - scan;
-
- // redisplay previously read values
- - reset;
-
- // Return the NetInfo property of the given label.
- - property:(const char *)label;
-
- @end
-
- //******************************************************************
- // Methods that the delegate should implement:
- //
- // Called by the open method before reading a domain. If this method returns
- // NO, the open is aborted without an error and will return nil.
- // - (BOOL)niDirOk:(const char *)domain path:(const char *)directory;
- //
- //