OpenAFS Preference Pane 64bit and Symbolic Link features implemented.
authorClaudio Bisegni <Claudio.Bisegni@lnf.infn.it>
Sun, 18 Oct 2009 18:39:21 +0000 (20:39 +0200)
committerDerrick Brashear <shadow|account-1000005@unknown>
Mon, 19 Oct 2009 12:39:44 +0000 (05:39 -0700)
Now the OpenAFS preference pane is compiled with 32 and 64 bit snowleopard support, so the preference
windows is no more restarted in 32 bit mode.
The tab for symbolic link creation has been implemented. Now the user can create and delete link.
For create a link both name and destination path must be set. AFSBackgrounder has been updated to
manager in a separate thread the link creation and destroy operation, according to the vaule of
checkbox "Enable Symbolic Link" in "Mounts" tab.

Reviewed-on: http://gerrit.openafs.org/677
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSBackgrounderDelegate.h
src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSBackgrounderDelegate.m
src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSMenuExtra.m
src/platform/DARWIN/AFSPreference/AFSBackgrounder/AFSMenuExtraView.m
src/platform/DARWIN/AFSPreference/AFSCommanderPref.h
src/platform/DARWIN/AFSPreference/AFSCommanderPref.m
src/platform/DARWIN/AFSPreference/English.lproj/OpenAFSPreference.xib
src/platform/DARWIN/AFSPreference/Info.plist
src/platform/DARWIN/AFSPreference/LynkCreationController.m
src/platform/DARWIN/AFSPreference/OpenAFS.xcodeproj/project.pbxproj
src/platform/DARWIN/AFSPreference/global.h

index ef5707e..31239f2 100644 (file)
@@ -37,7 +37,9 @@
        //NSTimer for tokens refresh
        NSTimer *timerForCheckTokensList;
        NSLock *tokensLock;
-       
+       bool currentLinkActivationStatus;
+       NSMutableDictionary *linkConfiguration;
+       NSLock *linkCreationLock;
 }
 - (void)startTimer;
 - (void)stopTimer;
@@ -54,7 +56,7 @@
 - (void)menuNeedsUpdate:(NSMenu *)menu;
 - (void)repairHelperTool;
 - (void) afsVolumeMountChange:(NSNotification *)notification;
-
+- (void) updateLinkModeStatusWithpreferenceStatus:(BOOL)status;
 -(NSStatusItem*)statusItem;
 -(void) setStatusItem:(BOOL)show;
 -(NSImage*)imageToRender;
index e108254..d5d3170 100644 (file)
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
+#import <sys/xattr.h>
+
+#define LINK_ICON 'srvr'
 
 @implementation AFSBackgrounderDelegate
 #pragma mark NSApp Delegate
 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
-       afsMngr = [[AFSPropertyManager alloc] initWithAfsPath:afsSysPath];
+       
+       linkCreationLock = [[NSLock alloc] init];
+       
+       afsMngr = [[AFSPropertyManager alloc] initWithAfsPath:PREFERENCE_AFS_SYS_PAT_STATIC];
+       
        // allocate the lock for concurent afs check state
        tokensLock = [[NSLock alloc] init];
        
        
        noTokenImage = [self getImageFromBundle:@"noToken" 
                                                                        fileExt:@"png"];
-       //get the sazi of the menu icon
+       //get the size of the menu icon
        menuSize = [hasTokenImage size];
+       
+       //inizialize the local link mode status
+       currentLinkActivationStatus = NO;
+       
        //Start to read the afs path
        [self readPreferenceFile:nil];  
        [self startTimer];
        
        
        // Register for preference user change
-       [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(readPreferenceFile:) 
+       [[NSDistributedNotificationCenter defaultCenter] addObserver:self
+                                                                                                               selector:@selector(readPreferenceFile:)
                                                                                                                        name:kAFSMenuExtraID object:kPrefChangeNotification];
        
        // Register for afs state change
-       [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(afsVolumeMountChange:) 
+       [[NSDistributedNotificationCenter defaultCenter] addObserver:self
+                                                                                                               selector:@selector(afsVolumeMountChange:)
                                                                                                                        name:kAFSMenuExtraID object:kMExtraAFSStateChange];
        
        // Register for menu state change
-       [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(chageMenuVisibility:) 
+       [[NSDistributedNotificationCenter defaultCenter] addObserver:self
+                                                                                                               selector:@selector(chageMenuVisibility:)
                                                                                                                        name:kAFSMenuExtraID object:kMExtraAFSMenuChangeState];
        
        //Register for mount/unmount afs volume
-       [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self 
-                                                                                                                  selector:@selector(afsVolumeMountChange:) 
+       [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self
+                                                                                                                  selector:@selector(afsVolumeMountChange:)
                                                                                                                           name:NSWorkspaceDidMountNotification object:nil];
        
-       [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self 
-                                                                                                                  selector:@selector(afsVolumeMountChange:) 
+       [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self
+                                                                                                                  selector:@selector(afsVolumeMountChange:)
                                                                                                                           name:NSWorkspaceDidUnmountNotification object:nil];
        
        [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self
        
        if(tokensLock) [tokensLock release];
        if(afsMngr) [afsMngr release];
+       if(linkCreationLock) [linkCreationLock release];
        return NSTerminateNow;
 }
 #pragma mark Notification Handler
                [afsSysPath release];
                afsSysPath = nil;
        }
-       CFPreferencesSynchronize((CFStringRef)kAfsCommanderID,  kCFPreferencesAnyUser, kCFPreferencesAnyHost);
-       CFPreferencesSynchronize((CFStringRef)kAfsCommanderID,  kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+       CFPreferencesSynchronize((CFStringRef)kAfsCommanderID, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
+       CFPreferencesSynchronize((CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
        
        afsSysPath = PREFERENCE_AFS_SYS_PAT_STATIC;
        
        // read the preference for aklog use
-       useAklogPrefValue = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_USE_AKLOG, 
-                                                                                                                 (CFStringRef)kAfsCommanderID, 
-                                                                                                                 kCFPreferencesCurrentUser, 
+       useAklogPrefValue = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_USE_AKLOG,
+                                                                                                                 (CFStringRef)kAfsCommanderID,
+                                                                                                                 kCFPreferencesCurrentUser,
                                                                                                                  kCFPreferencesAnyHost);
        
-       showStatusMenu = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_SHOW_STATUS_MENU, 
-                                                                                                          (CFStringRef)kAfsCommanderID, 
-                                                                                                          kCFPreferencesCurrentUser, 
+       showStatusMenu = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_SHOW_STATUS_MENU,
+                                                                                                          (CFStringRef)kAfsCommanderID,
+                                                                                                          kCFPreferencesCurrentUser,
                                                                                                           kCFPreferencesAnyHost);
        
-       aklogTokenAtLogin = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_AKLOG_TOKEN_AT_LOGIN, (CFStringRef)kAfsCommanderID,  
-                                                                                                                                       kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+       aklogTokenAtLogin = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_AKLOG_TOKEN_AT_LOGIN, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
 
+       //get link configuration
+       NSData *prefData = (NSData*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_LINK_CONFIGURATION, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+       linkConfiguration = (NSMutableDictionary*)[NSPropertyListSerialization propertyListFromData:prefData
+                                                                                                                                                          mutabilityOption:NSPropertyListMutableContainers
+                                                                                                                                                                                format:nil
+                                                                                                                                                          errorDescription:nil];
+       
+       //get link enabled status
+       NSNumber *linkEnabledStatus =  (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_USE_LINK, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+       [self updateLinkModeStatusWithpreferenceStatus:[linkEnabledStatus boolValue]];
+       
+       
        //set the menu name
        [self updateAfsStatus:nil];
 }
 
 // -------------------------------------------------------------------------------
+//  - (void) updateLinkModeStatusWithpreferenceStatus:(BOOL)status
+// -------------------------------------------------------------------------------
+- (void) updateLinkModeStatusWithpreferenceStatus:(BOOL)status {
+       //exec the link operation on thread
+               [NSThread detachNewThreadSelector:@selector(performLinkOpeartionOnThread:)
+                                                        toTarget:self
+                                                  withObject:[NSNumber numberWithBool:status]];
+}
+
+
+// -------------------------------------------------------------------------------
+//  - (void) performLinkOpenartionOnThread:(id)object
+// -------------------------------------------------------------------------------
+- (void) performLinkOpeartionOnThread:(id)object {
+       [linkCreationLock lock];
+       NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+       NSError  *error = nil;
+       NSString *key = nil;
+       NSString *linkDstPath = nil;
+       NSString *linkSrcPath = nil;
+       NSArray  *paths = NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, NSUserDomainMask, YES);
+       NSString *documentFolderPath = [paths objectAtIndex:0];
+       NSNumber *number = (NSNumber*)object;
+       //NSString *fType = NSFileTypeForHFSTypeCode(LINK_ICON);
+       //NSImage  *picture = [[NSWorkspace sharedWorkspace] iconForFileType:fType];
+       
+       BOOL linkSourcePathExist = NO;
+       BOOL linkDestinationPathExist = NO;
+       
+       NSLog(@"updateLinkModeStatusWithpreferenceStatus %d", [number boolValue]);
+       NSEnumerator *keys = [linkConfiguration keyEnumerator];
+       while ((key = [keys nextObject])) {
+               //link path
+               linkSrcPath = [documentFolderPath  stringByAppendingPathComponent:key];
+               //afs destionation path
+               linkDstPath = [linkConfiguration objectForKey:key];
+               linkSourcePathExist = [[NSFileManager defaultManager] fileExistsAtPath:linkSrcPath];
+               linkDestinationPathExist = [[NSFileManager defaultManager] fileExistsAtPath:linkDstPath];
+               
+               if([number boolValue]) {
+                       if(!linkSourcePathExist) {
+                               if(linkDestinationPathExist) {
+                                       NSLog(@"Creating link \"%@\" to point to \"%@\"", linkSrcPath, linkDstPath);
+                                       [[NSFileManager defaultManager] createSymbolicLinkAtPath:linkSrcPath
+                                                                                                                withDestinationPath:linkDstPath
+                                                                                                                                          error:&error];
+                                       if(!error) {
+                                               //Link has been created so i can chnge the icon
+                                       /*      [[NSWorkspace sharedWorkspace] setIcon:picture
+                                                                                                          forFile:linkName
+                                                                                                          options:0];*/
+                                               NSLog(@"Link \"%@\" created", linkSrcPath);
+                                       } else {
+                                               NSLog(@"Link Creation Error: %@", [error localizedDescription]);
+                                       }
+                               } else {
+                                       NSLog(@"Deleting Link: %@", linkSrcPath);
+                                       [[NSFileManager defaultManager] removeItemAtPath:linkSrcPath
+                                                                                                                          error:&error];
+                               }
+                       } else {
+                               //the lynk already exist check if the dest path is accesible
+                               if(!linkSourcePathExist) {
+                                       NSLog(@"Deleting Link: %@", linkSrcPath);
+                                       [[NSFileManager defaultManager] removeItemAtPath:linkSrcPath
+                                                                                                                          error:&error];
+                               }
+                       }
+               } else {
+                       //delete the link
+                       NSLog(@"Deleting Link: %@", linkSrcPath);
+                       [[NSFileManager defaultManager] removeItemAtPath:linkSrcPath
+                                                                                                          error:&error];
+                       
+               }
+       }
+       
+       //update the status
+       currentLinkActivationStatus = [number boolValue];
+       //release thread resource
+       [pool release];
+       [linkCreationLock unlock];
+}
+
+// -------------------------------------------------------------------------------
 //  - (void)chageMenuVisibility:(NSNotification *)notification
 // -------------------------------------------------------------------------------
 - (void)chageMenuVisibility:(NSNotification *)notification {
 // -------------------------------------------------------------------------------
 - (void) afsVolumeMountChange:(NSNotification *)notification{
        [self updateAfsStatus:nil];
+       [self readPreferenceFile:nil];
 }
 
 
 // -------------------------------------------------------------------------------
 - (void)startStopAfs:(id)sender
 {
-       if(!afsSysPath) return;
-       
-       OSStatus status = noErr;
-       NSString *afsdPath = [TaskUtil searchExecutablePath:@"afsd"];
-       NSString *rootHelperApp = nil;
-       BOOL currentAfsState = NO;
-       
        @try {
-               if(afsdPath == nil) return;
+               BOOL currentAfsState = NO;
                currentAfsState = [afsMngr checkAfsStatus];
-               rootHelperApp = [[NSBundle mainBundle] pathForResource:@"afshlp" ofType:@""];
-
-               //Check helper app
-               [self repairHelperTool];
-               
                // make the parameter to call the root helper app
-               status = [[AuthUtil shared] autorize];
-               if(status == noErr){
-                       if(currentAfsState){
-                               //shutdown afs
-                               NSMutableString *afsKextPath = [[NSMutableString alloc] initWithCapacity:256];
-                               [afsKextPath setString:afsSysPath];
-                               [afsKextPath appendString:@"/etc/afs.kext"];
-                               
-                               const char *stopAfsArgs[] = {"stop_afs", [afsKextPath  UTF8String], [afsdPath UTF8String], 0L};
-                               [[AuthUtil shared] execUnixCommand:[rootHelperApp UTF8String] 
-                                                                                         args:stopAfsArgs
-                                                                                       output:nil];
-                       } else {
-                               const char *startAfsArgs[] = {[[ [NSBundle mainBundle] pathForResource:@"start_afs" ofType:@"sh"]  UTF8String], [afsSysPath UTF8String], [afsdPath UTF8String], 0L};
-                               [[AuthUtil shared] execUnixCommand:[rootHelperApp UTF8String] 
-                                                                                         args:startAfsArgs
-                                                                                       output:nil];
-                       }
+               if(currentAfsState){
+                       //shutdown afs
+                       NSLog(@"Shutting down afs");
+                       [afsMngr shutdown];
+               } else {
+                       //Start afs
+                       NSLog(@"Starting up afs");
+                       [afsMngr startup];
                }
-       }
-       @catch (NSException * e) {
-               NSLog([e reason]);
-       }
-       @finally {
-               [[AuthUtil shared] deautorize];
+       }@catch (NSException * e) {
+               NSLog(@"error %@", [e reason]);
+       }@finally {
                [self updateAfsStatus:nil];
                //Send notification to preferencepane
                [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAfsCommanderID object:kMenuExtraEventOccured];
 // -------------------------------------------------------------------------------
 - (void)getToken:(id)sender
 {
-       
        NSRect globalRect;
-       globalRect.origin = [[[statusItem view] window] convertBaseToScreen:[[statusItem view] frame].origin];
-       globalRect.size = [[statusItem view] frame].size;
-       AFSPropertyManager *afsPropMngr = [[AFSPropertyManager alloc] initWithAfsPath:afsSysPath ];
-       [afsPropMngr loadConfiguration]; 
-       
        if([useAklogPrefValue boolValue]) {
-               [afsPropMngr getTokens:false 
-                                                  usr:nil 
-                                                  pwd:nil];
+               [afsMngr getTokens:false
+                                          usr:nil
+                                          pwd:nil];
                [self klogUserEven:nil];
        } else {
+               globalRect.origin = [[[statusItem view] window] convertBaseToScreen:[[statusItem view] frame].origin];
+               globalRect.size = [[statusItem view] frame].size;
+               
                // register for user event
-               [[NSDistributedNotificationCenter defaultCenter] addObserver:self 
-                                                                                                                       selector:@selector(klogUserEven:) 
-                                                                                                                               name:kAFSMenuExtraID 
+               [[NSDistributedNotificationCenter defaultCenter] addObserver:self
+                                                                                                                       selector:@selector(klogUserEven:)
+                                                                                                                               name:kAFSMenuExtraID
                                                                                                                          object:kLogWindowClosed];
                
-               credentialMenuController = [[AFSMenuCredentialContoller alloc] initWhitRec:globalRect 
-                                                                                                                                       afsPropManager:afsPropMngr];
+               credentialMenuController = [[AFSMenuCredentialContoller alloc] initWhitRec:globalRect
+                                                                                                                                       afsPropManager:afsMngr];
                [credentialMenuController showWindow];
        }
-       
        //Dispose afs manager
-       [afsPropMngr release];
-       [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAfsCommanderID 
+       [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAfsCommanderID
                                                                                                                                   object:kMExtraTokenOperation];
 }
 
        //Try to locking
        if(![tokensLock tryLock]) return;
        
+       //reload configuration
+       [afsMngr loadConfiguration];
+       
        // check the afs state in esclusive mode
        afsState = [afsMngr checkAfsStatus];
        
index cf5c4d8..0073a31 100644 (file)
        afsSysPath = PREFERENCE_AFS_SYS_PAT_STATIC;
                
        // read the preference for aklog use
+       
+       useAklogPrefValue = [[NSUserDefaults standardUserDefaults] boolForKey:PREFERENCE_USE_AKLOG];
+       NSLog(@"NSUserDefaults:%d", useAklogPrefValue);
        useAklogPrefValue = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_USE_AKLOG, 
                                                                                                                  (CFStringRef)afsCommanderID, 
                                                                                                                  kCFPreferencesCurrentUser, 
                                                                                                                  kCFPreferencesAnyHost);
+       NSLog(@"CFPreferencesCopyValue:%d", useAklogPrefValue);
        [self updateAfsStatus:nil];
 }
 
index 8abd48f..b6839e6 100644 (file)
        int fontHeight = 0;
        NSAttributedString *kerberosStringIndicator = nil;
        
-       //check if we nedd to simulate the background menu clicked
+       //check if we need to simulate the background menu clicked
        [statusItem drawStatusBarBackgroundInRect:[self bounds] 
                                                                withHighlight:isMenuVisible];
-       
        image = [backgrounderDelegator imageToRender];
     if (image) {
                // Live updating even when menu is down handled by making the extra
                // draw the background if needed.               
                [image compositeToPoint:NSMakePoint(0, 0) operation:NSCompositeSourceOver];
        }
-       
-
-
-       
        //Draw, if necessary, the kerberos indicator for aklog usage for get token
        if([backgrounderDelegator useAklogPrefValue] == NSOnState) {
                kerberosStringIndicator = [[self makeKerberosIndicator:&fontHeight] autorelease];
index 9180d3b..f6666c7 100644 (file)
@@ -50,17 +50,17 @@ int CoreMenuExtraRemoveMenuExtra(void *menuExtra, int whoCares);
        IBOutlet NSBox *groupsBox;
        
        //id installationPathTextField;
-       id startStopButton;
-       id cellList;
+       IBOutlet NSButton *startStopButton;
+       IBOutlet NSTableView *cellList;
        //id cellNameTextEdit;
-       id cellIpButton;
-       id addCellButton;
-       id removeCellButton;
+       IBOutlet NSControl *cellIpButton;
+       IBOutlet NSControl *addCellButton;
+       IBOutlet NSControl *removeCellButton;
        //id refreshConfigurationButton;
-       id saveConfigurationButton;
+       IBOutlet NSControl *saveConfigurationButton;
        id labelSaveResult;
-       id tokensTable;
-       id afsMenucheckBox;
+       IBOutlet NSTableView *tokensTable;
+       IBOutlet NSControl *afsMenucheckBox;
                
        //Configuration sheet
        id ipConfigurationSheet;
@@ -83,7 +83,8 @@ int CoreMenuExtraRemoveMenuExtra(void *menuExtra, int whoCares);
        IBOutlet NSButton                                       *checkEnableLink;
        IBOutlet NSButton                                       *buttonAddLink;
        IBOutlet NSButton                                       *buttonRemoveLink;
-       bool enableLink;
+       IBOutlet NSTableView                            *tableViewLink;
+       NSMutableDictionary                                     *linkConfiguration;
        
        AFSPropertyManager *afsProperty;        //AFS Property managment class
        NSMutableArray *filteredCellDB;         //Filtered CellServDB
@@ -121,6 +122,7 @@ int CoreMenuExtraRemoveMenuExtra(void *menuExtra, int whoCares);
 - (IBAction) krb5KredentialAtLoginTimeEvent:(id) sender;
 - (IBAction) searchCellTextEvent:(id) sender;
 - (IBAction) manageBackgrounderActivation:(id)sender;
+- (IBAction) tableViewLinkPerformClick:(id) sender;
 - (void) credentialAtLoginTimeEventCreationLaunchAgentDir:(NSWindow*)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo;
 - (void) clearCellServDBFiltering;
 - (void) filterCellServDB:(NSString*)textToFilter;
@@ -129,7 +131,8 @@ int CoreMenuExtraRemoveMenuExtra(void *menuExtra, int whoCares);
 - (void) modifyCell:(DBCellElement*) cellElement;
 - (void) modifyCellByIDX:(int) idx;
 - (void) showMessage:(NSString*) message;
-- (void) manageButtonState:(int) rowSelected;
+- (void) tableViewCellmanageButtonState:(int) rowSelected;
+- (void) tableViewLinkmanageButtonState:(NSIndexSet *) rowsSelectedIndex;
 - (void) setAfsStatus;
 - (void) refreshTokens:(NSTimer*)theTimer;
 - (void) repairHelperTool;
@@ -144,4 +147,5 @@ int CoreMenuExtraRemoveMenuExtra(void *menuExtra, int whoCares);
 @interface AFSCommanderPref (NSTableDataSource)
 - (id) getTableTokensListValue:(int) colId row:(int)row;
 - (id) getTableCelListValue:(int) colId row:(int)row;
+- (id) getTableLinkValue:(int) colId row:(int)row;
 @end;
\ No newline at end of file
index fca2b97..a413c17 100644 (file)
@@ -31,6 +31,7 @@
 
 #define TABLE_TOKENS_LIST 1
 #define TABLE_CELL_LIST 2
+#define TABLE_LINK_LIST 3
 
 #define TAB_TOKENS 1
 #define TAB_CELL_SERV_DB 2
 #define CELLSRVDB_TABLE_NAME_COLUMN                            2
 #define CELLSRVDB_TABLE_DESCRIPTION_COLUMN             3
 
+//Link Table
+#define TABLE_COLUMN_LINK_NAME 0
+#define TABLE_COLUMN_LINK_PATH 1
+
+
 @implementation AFSCommanderPref
 
 // -------------------------------------------------------------------------------
                                                                                                                           name:NSWorkspaceDidUnmountNotification object:nil];
        
        // set self as table data source
-       [((NSTableView*)cellList) setDataSource:self];
-       [((NSTableView*)tokensTable) setDataSource:self];
-       
+       [cellList setDataSource:self];
+       [tokensTable setDataSource:self];
+       //[tableViewLink setDataSource:self];
        //check the afs state
        [self setAfsStatus];
        
 // -------------------------------------------------------------------------------
 - (void) readPreferenceFile
 {
-       
        // read the preference for aklog use
        NSNumber *useAklogPrefValue = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_USE_AKLOG, (CFStringRef)kAfsCommanderID,  
                                                                                                                                        kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
        [installKRB5AuthAtLoginButton setState:[PListManager checkKrb5AtLoginTimeLaunchdEnable]];
 
        //check for AFS enable at startup
-       NSNumber *afsEnableStartupTime = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_START_AFS_AT_STARTUP, 
+       NSNumber *afsEnableStartupTime = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_START_AFS_AT_STARTUP,
                                                                                                                                           (CFStringRef)kAfsCommanderID,  kCFPreferencesAnyUser, kCFPreferencesAnyHost);
-       if(afsEnableStartupTime) 
+       if(afsEnableStartupTime)
                startAFSAtLogin = [afsEnableStartupTime boolValue];
        else 
                startAFSAtLogin = false;
        
        //backgrounder state
        [backgrounderActivationCheck setState:[PListManager launchdJobState:BACKGROUNDER_P_FILE]];
+       
+       //link enabled status
+       NSNumber *linkEnabledStatus =  (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_USE_LINK,  (CFStringRef)kAfsCommanderID,  kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+       [checkEnableLink setState:[linkEnabledStatus boolValue]];
+       
+       //link configuration
+       NSData *prefData = (NSData*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_LINK_CONFIGURATION,  (CFStringRef)kAfsCommanderID,  kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+       linkConfiguration = (NSMutableDictionary*)[NSPropertyListSerialization propertyListFromData:prefData
+                                                                                                                                                          mutabilityOption:NSPropertyListMutableContainers
+                                                                                                                                                                                format:nil
+                                                                                                                                                          errorDescription:nil];
+       
 }
 
 // -------------------------------------------------------------------------------
                                                  (CFNumberRef)[NSNumber numberWithBool:[afsMenucheckBox state]], 
                                                  (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
        
+       //write preference for link
+       CFPreferencesSetValue((CFStringRef)PREFERENCE_USE_LINK,
+                                                 (CFNumberRef)[NSNumber numberWithBool:[checkEnableLink state]], 
+                                                 (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+       
        CFPreferencesSynchronize((CFStringRef)kAfsCommanderID,  kCFPreferencesAnyUser, kCFPreferencesAnyHost);
        CFPreferencesSynchronize((CFStringRef)kAfsCommanderID,  kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
-       
        [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kAFSMenuExtraID object:kPrefChangeNotification];
 }
 
 }
 
 // -------------------------------------------------------------------------------
-//  manageButtonState:
-// -------------------------------------------------------------------------------
--(void) manageButtonState:(int) rowSelected {
-       [((NSControl*) cellIpButton) setEnabled:rowSelected >= 0];
-       [((NSControl*) removeCellButton) setEnabled:rowSelected >= 0];
-}
-
-// -------------------------------------------------------------------------------
 //  setAfsStatus:
 // -------------------------------------------------------------------------------
 -(void) setAfsStatus
 //  removeExtra:
 // -------------------------------------------------------------------------------
 - (IBAction) removeLink:(id) sender {
+       if(!linkConfiguration) return;
+       int index = 0;
+       NSArray *keys = [linkConfiguration allKeys];
+       NSIndexSet *linkToRemove = [tableViewLink selectedRowIndexes];
+       if( [linkToRemove count] > 0) {
+               index = [linkToRemove firstIndex];
+               do {
+                       [linkConfiguration removeObjectForKey:[keys objectAtIndex:index]];
+               } while ((index = [linkToRemove indexGreaterThanIndex:index]) != -1);
+       }
        
+       //write the new configuration
+       NSData *prefData = nil;
+       if([linkConfiguration count] > 0) {
+               prefData = [NSPropertyListSerialization dataWithPropertyList:linkConfiguration
+                                                                                                                         format:NSPropertyListXMLFormat_v1_0
+                                                                                                                        options:0
+                                                                                                                          error:nil];
+       }
+       CFPreferencesSetValue((CFStringRef)PREFERENCE_LINK_CONFIGURATION,
+                                                 (CFDataRef)prefData,
+                                                 (CFStringRef)kAfsCommanderID,  kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+       
+       CFPreferencesSynchronize((CFStringRef)kAfsCommanderID,  kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+       
+       //reload the new data
+       [tableViewLink reloadData];
 }
 
 // -------------------------------------------------------------------------------
 //  removeExtra:
 // -------------------------------------------------------------------------------
 - (IBAction) enableLink:(id) sender {
-       
+       [self writePreferenceFile];
 }
 
 // -------------------------------------------------------------------------------
        [backgrounderActivationCheck setState:[PListManager launchdJobState:BACKGROUNDER_P_FILE]];
 }
 
+// -------------------------------------------------------------------------------
+//  tableViewLinkPerformClick:
+// -------------------------------------------------------------------------------
+- (IBAction) tableViewLinkPerformClick:(id) sender {
+       NSLog(@"tableViewLinkPerformClick");
+}
 
 // -------------------------------------------------------------------------------
 //  - (void)tabView:(NSTabView *)tabView willSelectTabViewItem: (NSTabViewItem *)tabViewItem
        //check to see if the cache param tab is the tab that will be selected
        if([((NSString*)[tabViewItem identifier]) intValue] == TAB_LINK)
        {
-               [ViewUtility enbleDisableControlView:[tabViewItem view]
-                                                               controlState:NO];
+               [tableViewLink reloadData];
        }
 }
 
                        //We are refreshing cell db table
                        result = [self getTableCelListValue:[identifier intValue] row:rowIndex];
                        break;
+                       
+               case TABLE_LINK_LIST:
+                       result = [self getTableLinkValue:[identifier intValue] row:rowIndex];
+                       break;
+
                
        }
        return result;  
 }
 
 // -------------------------------------------------------------------------------
+//  getTableCelListValue:
+// -------------------------------------------------------------------------------
+- (id)getTableLinkValue:(int) colId row:(int)row
+{
+       id result = nil;
+       NSArray *allKey = [linkConfiguration allKeys];
+       switch(colId){
+               case TABLE_COLUMN_LINK_NAME:
+                       result = [allKey objectAtIndex:row];
+                       break;
+                       
+               case TABLE_COLUMN_LINK_PATH:
+                       result = [linkConfiguration objectForKey:[allKey objectAtIndex:row]];
+                       break;
+       }
+       return result;
+}
+
+
+// -------------------------------------------------------------------------------
 //  numberOfRowsInTableView:
 // -------------------------------------------------------------------------------
 - (int)numberOfRowsInTableView:(NSTableView *)aTableView
                        if(filteredCellDB)  rowCount = [filteredCellDB count];
                        break;
                        
+               case TABLE_LINK_LIST:
+                       if(linkConfiguration)  rowCount = [linkConfiguration count];
+                       break;
+
+                       
        }       
        return rowCount;  
 }
 // -------------------------------------------------------------------------------
 - (BOOL)selectionShouldChangeInTableView:(NSTableView *)aTable
 {
-       [self manageButtonState:[aTable selectedRow]];
+       switch([aTable tag]){
+               case TABLE_TOKENS_LIST:
+                       
+                       break;
+                       
+               case TABLE_CELL_LIST:
+                       [self tableViewCellmanageButtonState:[aTable selectedRow]];
+                       break;
+                       
+               case TABLE_LINK_LIST:
+                       break;
+                       
+                       
+       }       
+       
        return YES;
 }
 
 // -------------------------------------------------------------------------------
 - (BOOL)tableView:(NSTableView *)aTable shouldSelectRow:(int)aRow
 {
-       [self manageButtonState:aRow];
+       switch([aTable tag]){
+               case TABLE_TOKENS_LIST:
+                       
+                       break;
+                       
+               case TABLE_CELL_LIST:
+                       [self tableViewCellmanageButtonState:aRow];
+                       break;
+                       
+               case TABLE_LINK_LIST:
+                       break;
+                       
+                       
+       }
+       
        return YES;
 }
 
+// -------------------------------------------------------------------------------
+//  tableView:
+// -------------------------------------------------------------------------------
+- (void)tableViewSelectionDidChange:(NSNotification *)aNotification {
+       NSTableView *aTable = [aNotification object];
+       switch([aTable tag]){
+               case TABLE_TOKENS_LIST:
+                       break;
+                       
+               case TABLE_CELL_LIST:
+                       break;
+                       
+               case TABLE_LINK_LIST:
+                       [self tableViewLinkmanageButtonState:[aTable selectedRowIndexes]];
+                       break;
+                       
+                       
+       }
+}
+// -------------------------------------------------------------------------------
+//  manageButtonState:
+// -------------------------------------------------------------------------------
+-(void) tableViewCellmanageButtonState:(int) rowSelected  {
+       [((NSControl*) cellIpButton) setEnabled:rowSelected >= 0];
+       [((NSControl*) removeCellButton) setEnabled:rowSelected >= 0];
+}
+
+// -------------------------------------------------------------------------------
+//  manageButtonState:
+// -------------------------------------------------------------------------------
+-(void) tableViewLinkmanageButtonState:(NSIndexSet *) rowsSelectedIndex {
+       NSLog(@"link selected %d", [rowsSelectedIndex count]);
+       [buttonRemoveLink setEnabled:[rowsSelectedIndex count]>0];
+}
 @end
 
 
index 582e5d6..2638635 100644 (file)
@@ -3,15 +3,16 @@
        <data>
                <int key="IBDocument.SystemTarget">1050</int>
                <string key="IBDocument.SystemVersion">10B504</string>
-               <string key="IBDocument.InterfaceBuilderVersion">732</string>
+               <string key="IBDocument.InterfaceBuilderVersion">740</string>
                <string key="IBDocument.AppKitVersion">1038.2</string>
                <string key="IBDocument.HIToolboxVersion">437.00</string>
                <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
                        <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
-                       <string key="NS.object.0">732</string>
+                       <string key="NS.object.0">740</string>
                </object>
                <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
                        <bool key="EncodedWithXMLCoder">YES</bool>
+                       <integer value="101"/>
                </object>
                <object class="NSArray" key="IBDocument.PluginDependencies">
                        <bool key="EncodedWithXMLCoder">YES</bool>
@@ -47,7 +48,7 @@
                                <object class="NSMutableString" key="NSViewClass">
                                        <characters key="NS.bytes">View</characters>
                                </object>
-                               <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
+                               <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
                                <object class="NSView" key="NSWindowView" id="645279396">
                                        <reference key="NSNextResponder"/>
                                        <int key="NSvFlags">274</int>
@@ -58,7 +59,6 @@
                                                        <int key="NSvFlags">256</int>
                                                        <string key="NSFrame">{{17, 1}, {304, 14}}</string>
                                                        <reference key="NSSuperview" ref="645279396"/>
-                                                       <reference key="NSWindow"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="947523856">
                                                                <int key="NSCellFlags">67239424</int>
@@ -76,7 +76,7 @@
                                                                        <string key="NSColorName">controlColor</string>
                                                                        <object class="NSColor" key="NSColor" id="277525007">
                                                                                <int key="NSColorSpace">3</int>
-                                                                               <bytes key="NSWhite">MC42NjY2NjY2ODY1AA</bytes>
+                                                                               <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
                                                                        </object>
                                                                </object>
                                                                <object class="NSColor" key="NSTextColor" id="276594776">
                                                                                        <int key="NSvFlags">268</int>
                                                                                        <string key="NSFrame">{{13, 7}, {109, 28}}</string>
                                                                                        <reference key="NSSuperview" ref="520583273"/>
-                                                                                       <reference key="NSWindow"/>
                                                                                        <bool key="NSEnabled">YES</bool>
                                                                                        <object class="NSButtonCell" key="NSCell" id="675447498">
                                                                                                <int key="NSCellFlags">67239424</int>
                                                                                        <int key="NSvFlags">265</int>
                                                                                        <string key="NSFrame">{{526, 9}, {21, 23}}</string>
                                                                                        <reference key="NSSuperview" ref="520583273"/>
-                                                                                       <reference key="NSWindow"/>
                                                                                        <bool key="NSEnabled">YES</bool>
                                                                                        <object class="NSButtonCell" key="NSCell" id="1009755861">
                                                                                                <int key="NSCellFlags">-2080244224</int>
                                                                                        <int key="NSvFlags">268</int>
                                                                                        <string key="NSFrame">{{138, 13}, {117, 18}}</string>
                                                                                        <reference key="NSSuperview" ref="520583273"/>
-                                                                                       <reference key="NSWindow"/>
                                                                                        <bool key="NSEnabled">YES</bool>
                                                                                        <object class="NSButtonCell" key="NSCell" id="98390178">
                                                                                                <int key="NSCellFlags">67239424</int>
                                                                        </object>
                                                                        <string key="NSFrame">{{1, 1}, {562, 43}}</string>
                                                                        <reference key="NSSuperview" ref="748501112"/>
-                                                                       <reference key="NSWindow"/>
                                                                </object>
                                                        </object>
                                                        <string key="NSFrame">{{17, 423}, {564, 45}}</string>
                                                        <reference key="NSSuperview" ref="645279396"/>
-                                                       <reference key="NSWindow"/>
                                                        <string key="NSOffsets">{0, 0}</string>
                                                        <object class="NSTextFieldCell" key="NSTitleCell">
                                                                <int key="NSCellFlags">67239424</int>
                                                        <int key="NSvFlags">274</int>
                                                        <string key="NSFrame">{{13, 15}, {572, 401}}</string>
                                                        <reference key="NSSuperview" ref="645279396"/>
-                                                       <reference key="NSWindow"/>
                                                        <object class="NSMutableArray" key="NSTabViewItems">
                                                                <bool key="EncodedWithXMLCoder">YES</bool>
                                                                <object class="NSTabViewItem" id="269508902">
                                                                                                                                <int key="NSvFlags">256</int>
                                                                                                                                <string key="NSFrameSize">{516, 140}</string>
                                                                                                                                <reference key="NSSuperview" ref="457121079"/>
-                                                                                                                               <reference key="NSWindow"/>
                                                                                                                                <int key="NSTag">1</int>
                                                                                                                                <bool key="NSEnabled">YES</bool>
                                                                                                                                <object class="NSTableHeaderView" key="NSHeaderView" id="1048519426">
                                                                                                                                        <int key="NSvFlags">256</int>
                                                                                                                                        <string key="NSFrameSize">{516, 17}</string>
                                                                                                                                        <reference key="NSSuperview" ref="214413149"/>
-                                                                                                                                       <reference key="NSWindow"/>
                                                                                                                                        <reference key="NSTableView" ref="313963250"/>
                                                                                                                                </object>
                                                                                                                                <object class="_NSCornerView" key="NSCornerView" id="360324124">
                                                                                                                                        <int key="NSvFlags">-2147483392</int>
                                                                                                                                        <string key="NSFrame">{{-22, 0}, {12, 17}}</string>
                                                                                                                                        <reference key="NSSuperview" ref="440720679"/>
-                                                                                                                                       <reference key="NSWindow"/>
                                                                                                                                </object>
                                                                                                                                <object class="NSMutableArray" key="NSTableColumns">
                                                                                                                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                                                                                                </object>
                                                                                                                <string key="NSFrame">{{1, 17}, {516, 140}}</string>
                                                                                                                <reference key="NSSuperview" ref="440720679"/>
-                                                                                                               <reference key="NSWindow"/>
                                                                                                                <reference key="NSNextKeyView" ref="313963250"/>
                                                                                                                <reference key="NSDocView" ref="313963250"/>
                                                                                                                <reference key="NSBGColor" ref="252569531"/>
                                                                                                                <int key="NSvFlags">-2147483392</int>
                                                                                                                <string key="NSFrame">{{494, 17}, {11, 80}}</string>
                                                                                                                <reference key="NSSuperview" ref="440720679"/>
-                                                                                                               <reference key="NSWindow"/>
                                                                                                                <int key="NSsFlags">256</int>
                                                                                                                <reference key="NSTarget" ref="440720679"/>
                                                                                                                <string key="NSAction">_doScroller:</string>
                                                                                                                <int key="NSvFlags">-2147483392</int>
                                                                                                                <string key="NSFrame">{{1, 97}, {505, 11}}</string>
                                                                                                                <reference key="NSSuperview" ref="440720679"/>
-                                                                                                               <reference key="NSWindow"/>
                                                                                                                <int key="NSsFlags">257</int>
                                                                                                                <reference key="NSTarget" ref="440720679"/>
                                                                                                                <string key="NSAction">_doScroller:</string>
                                                                                                                </object>
                                                                                                                <string key="NSFrame">{{1, 0}, {516, 17}}</string>
                                                                                                                <reference key="NSSuperview" ref="440720679"/>
-                                                                                                               <reference key="NSWindow"/>
                                                                                                                <reference key="NSNextKeyView" ref="1048519426"/>
                                                                                                                <reference key="NSDocView" ref="1048519426"/>
                                                                                                                <reference key="NSBGColor" ref="252569531"/>
                                                                                                </object>
                                                                                                <string key="NSFrame">{{17, 199}, {518, 158}}</string>
                                                                                                <reference key="NSSuperview" ref="1020318718"/>
-                                                                                               <reference key="NSWindow"/>
                                                                                                <reference key="NSNextKeyView" ref="457121079"/>
                                                                                                <int key="NSsFlags">562</int>
                                                                                                <reference key="NSVScroller" ref="884311606"/>
                                                                                                <int key="NSvFlags">265</int>
                                                                                                <string key="NSFrame">{{329, 164}, {80, 28}}</string>
                                                                                                <reference key="NSSuperview" ref="1020318718"/>
-                                                                                               <reference key="NSWindow"/>
                                                                                                <bool key="NSEnabled">YES</bool>
                                                                                                <object class="NSButtonCell" key="NSCell" id="327131725">
                                                                                                        <int key="NSCellFlags">67239424</int>
                                                                                                <int key="NSvFlags">265</int>
                                                                                                <string key="NSFrame">{{407, 164}, {133, 28}}</string>
                                                                                                <reference key="NSSuperview" ref="1020318718"/>
-                                                                                               <reference key="NSWindow"/>
                                                                                                <bool key="NSEnabled">YES</bool>
                                                                                                <object class="NSButtonCell" key="NSCell" id="73578210">
                                                                                                        <int key="NSCellFlags">67239424</int>
                                                                                                <int key="NSvFlags">268</int>
                                                                                                <string key="NSFrame">{{14, 172}, {86, 18}}</string>
                                                                                                <reference key="NSSuperview" ref="1020318718"/>
-                                                                                               <reference key="NSWindow"/>
                                                                                                <bool key="NSEnabled">YES</bool>
                                                                                                <object class="NSButtonCell" key="NSCell" id="428850916">
                                                                                                        <int key="NSCellFlags">67239424</int>
                                                                                                                                <int key="NSvFlags">268</int>
                                                                                                                                <string key="NSFrame">{{5, 32}, {75, 18}}</string>
                                                                                                                                <reference key="NSSuperview" ref="1000204505"/>
-                                                                                                                               <reference key="NSWindow"/>
                                                                                                                                <bool key="NSEnabled">YES</bool>
                                                                                                                                <object class="NSButtonCell" key="NSCell" id="989004902">
                                                                                                                                        <int key="NSCellFlags">67239424</int>
                                                                                                                                <int key="NSvFlags">268</int>
                                                                                                                                <string key="NSFrame">{{5, 12}, {167, 18}}</string>
                                                                                                                                <reference key="NSSuperview" ref="1000204505"/>
-                                                                                                                               <reference key="NSWindow"/>
                                                                                                                                <bool key="NSEnabled">YES</bool>
                                                                                                                                <object class="NSButtonCell" key="NSCell" id="95048095">
                                                                                                                                        <int key="NSCellFlags">67239424</int>
                                                                                                                                <int key="NSvFlags">268</int>
                                                                                                                                <string key="NSFrame">{{5, 52}, {170, 18}}</string>
                                                                                                                                <reference key="NSSuperview" ref="1000204505"/>
-                                                                                                                               <reference key="NSWindow"/>
                                                                                                                                <bool key="NSEnabled">YES</bool>
                                                                                                                                <object class="NSButtonCell" key="NSCell" id="855912809">
                                                                                                                                        <int key="NSCellFlags">67239424</int>
                                                                                                                </object>
                                                                                                                <string key="NSFrame">{{1, 1}, {193, 78}}</string>
                                                                                                                <reference key="NSSuperview" ref="184192603"/>
-                                                                                                               <reference key="NSWindow"/>
                                                                                                        </object>
                                                                                                </object>
                                                                                                <string key="NSFrame">{{113, 97}, {195, 94}}</string>
                                                                                                <reference key="NSSuperview" ref="1020318718"/>
-                                                                                               <reference key="NSWindow"/>
                                                                                                <string key="NSOffsets">{0, 0}</string>
                                                                                                <object class="NSTextFieldCell" key="NSTitleCell">
                                                                                                        <int key="NSCellFlags">67239424</int>
                                                                                                <int key="NSvFlags">268</int>
                                                                                                <string key="NSFrame">{{14, 152}, {96, 18}}</string>
                                                                                                <reference key="NSSuperview" ref="1020318718"/>
-                                                                                               <reference key="NSWindow"/>
                                                                                                <bool key="NSEnabled">YES</bool>
                                                                                                <object class="NSButtonCell" key="NSCell" id="237101992">
                                                                                                        <int key="NSCellFlags">67239424</int>
                                                                                </object>
                                                                                <string key="NSFrame">{{10, 25}, {552, 363}}</string>
                                                                                <reference key="NSSuperview" ref="739317740"/>
-                                                                               <reference key="NSWindow"/>
                                                                        </object>
                                                                        <string key="NSLabel">Tokens</string>
                                                                        <reference key="NSColor" ref="568311573"/>
                                                                                                                                                        <bool key="NS.raise.underflow">YES</bool>
                                                                                                                                                        <bool key="NS.raise.dividebyzero">YES</bool>
                                                                                                                                                </object>
-                                                                                                                                               <string key="NS.decimal">,</string>
-                                                                                                                                               <string key="NS.thousand">.</string>
+                                                                                                                                               <string key="NS.decimal">.</string>
+                                                                                                                                               <string key="NS.thousand">,</string>
                                                                                                                                                <bool key="NS.hasthousands">NO</bool>
                                                                                                                                                <bool key="NS.localized">NO</bool>
                                                                                                                                                <bool key="NS.allowsfloats">YES</bool>
                                                                                                                                                        <bool key="NS.raise.underflow">YES</bool>
                                                                                                                                                        <bool key="NS.raise.dividebyzero">YES</bool>
                                                                                                                                                </object>
-                                                                                                                                               <string key="NS.decimal">,</string>
-                                                                                                                                               <string key="NS.thousand">.</string>
+                                                                                                                                               <string key="NS.decimal">.</string>
+                                                                                                                                               <string key="NS.thousand">,</string>
                                                                                                                                                <bool key="NS.hasthousands">NO</bool>
                                                                                                                                                <bool key="NS.localized">NO</bool>
                                                                                                                                                <bool key="NS.allowsfloats">YES</bool>
                                                                                                                                                        <bool key="NS.raise.underflow">YES</bool>
                                                                                                                                                        <bool key="NS.raise.dividebyzero">YES</bool>
                                                                                                                                                </object>
-                                                                                                                                               <string key="NS.decimal">,</string>
-                                                                                                                                               <string key="NS.thousand">.</string>
+                                                                                                                                               <string key="NS.decimal">.</string>
+                                                                                                                                               <string key="NS.thousand">,</string>
                                                                                                                                                <bool key="NS.hasthousands">NO</bool>
                                                                                                                                                <bool key="NS.localized">NO</bool>
                                                                                                                                                <bool key="NS.allowsfloats">YES</bool>
                                                                                                                                                        <bool key="NS.raise.underflow">YES</bool>
                                                                                                                                                        <bool key="NS.raise.dividebyzero">YES</bool>
                                                                                                                                                </object>
-                                                                                                                                               <string key="NS.decimal">,</string>
-                                                                                                                                               <string key="NS.thousand">.</string>
+                                                                                                                                               <string key="NS.decimal">.</string>
+                                                                                                                                               <string key="NS.thousand">,</string>
                                                                                                                                                <bool key="NS.hasthousands">NO</bool>
                                                                                                                                                <bool key="NS.localized">NO</bool>
                                                                                                                                                <bool key="NS.allowsfloats">NO</bool>
                                                                                                                                                        <bool key="NS.raise.underflow">YES</bool>
                                                                                                                                                        <bool key="NS.raise.dividebyzero">YES</bool>
                                                                                                                                                </object>
-                                                                                                                                               <string key="NS.decimal">,</string>
-                                                                                                                                               <string key="NS.thousand">.</string>
+                                                                                                                                               <string key="NS.decimal">.</string>
+                                                                                                                                               <string key="NS.thousand">,</string>
                                                                                                                                                <bool key="NS.hasthousands">NO</bool>
                                                                                                                                                <bool key="NS.localized">NO</bool>
                                                                                                                                                <bool key="NS.allowsfloats">YES</bool>
                                                                                                                                <int key="NSvFlags">256</int>
                                                                                                                                <string key="NSFrameSize">{501, 283}</string>
                                                                                                                                <reference key="NSSuperview" ref="229139620"/>
+                                                                                                                               <int key="NSTag">3</int>
                                                                                                                                <bool key="NSEnabled">YES</bool>
                                                                                                                                <object class="NSTableHeaderView" key="NSHeaderView" id="209519573">
                                                                                                                                        <reference key="NSNextResponder" ref="785725164"/>
                                                                                                                                <object class="NSMutableArray" key="NSTableColumns">
                                                                                                                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                                                                                                                        <object class="NSTableColumn" id="604570943">
+                                                                                                                                               <string key="NSIdentifier">0</string>
                                                                                                                                                <double key="NSWidth">84</double>
                                                                                                                                                <double key="NSMinWidth">40</double>
                                                                                                                                                <double key="NSMaxWidth">1000</double>
                                                                                                                                                <reference key="NSTableView" ref="1029505942"/>
                                                                                                                                        </object>
                                                                                                                                        <object class="NSTableColumn" id="915858279">
+                                                                                                                                               <string key="NSIdentifier">1</string>
                                                                                                                                                <double key="NSWidth">411</double>
                                                                                                                                                <double key="NSMinWidth">40</double>
                                                                                                                                                <double key="NSMaxWidth">1000</double>
                                                        <int key="NSvFlags">289</int>
                                                        <string key="NSFrame">{{323, 3}, {258, 11}}</string>
                                                        <reference key="NSSuperview" ref="645279396"/>
-                                                       <reference key="NSWindow"/>
                                                        <bool key="NSEnabled">YES</bool>
                                                        <object class="NSTextFieldCell" key="NSCell" id="999146642">
                                                                <int key="NSCellFlags">68288064</int>
                                        </object>
                                        <string key="NSFrameSize">{595, 486}</string>
                                        <reference key="NSSuperview"/>
-                                       <reference key="NSWindow"/>
                                </object>
                                <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
-                               <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
+                               <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
                        </object>
                        <object class="NSWindowTemplate" id="52789773">
                                <int key="NSWindowStyleMask">9</int>
                                <object class="NSMutableString" key="NSViewClass">
                                        <characters key="NS.bytes">View</characters>
                                </object>
-                               <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
+                               <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
                                <object class="NSView" key="NSWindowView" id="1017822711">
                                        <nil key="NSNextResponder"/>
                                        <int key="NSvFlags">256</int>
                                        <string key="NSFrameSize">{715, 485}</string>
                                </object>
                                <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
-                               <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
+                               <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
                        </object>
                        <object class="NSCustomObject" id="176554930">
                                <string key="NSClassName">InfoController</string>
                                </object>
                                <object class="IBConnectionRecord">
                                        <object class="IBOutletConnection" key="connection">
-                                               <string key="label">buttonRemoveLink</string>
-                                               <reference key="source" ref="773588579"/>
-                                               <reference key="destination" ref="642014996"/>
-                                       </object>
-                                       <int key="connectionID">2044</int>
-                               </object>
-                               <object class="IBConnectionRecord">
-                                       <object class="IBOutletConnection" key="connection">
                                                <string key="label">buttonAddLink</string>
                                                <reference key="source" ref="773588579"/>
                                                <reference key="destination" ref="642014996"/>
                                        </object>
                                        <int key="connectionID">2057</int>
                                </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBOutletConnection" key="connection">
+                                               <string key="label">tableViewLink</string>
+                                               <reference key="source" ref="773588579"/>
+                                               <reference key="destination" ref="1029505942"/>
+                                       </object>
+                                       <int key="connectionID">2059</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBOutletConnection" key="connection">
+                                               <string key="label">dataSource</string>
+                                               <reference key="source" ref="1029505942"/>
+                                               <reference key="destination" ref="773588579"/>
+                                       </object>
+                                       <int key="connectionID">2060</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBOutletConnection" key="connection">
+                                               <string key="label">delegate</string>
+                                               <reference key="source" ref="1029505942"/>
+                                               <reference key="destination" ref="773588579"/>
+                                       </object>
+                                       <int key="connectionID">2061</int>
+                               </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBOutletConnection" key="connection">
+                                               <string key="label">buttonRemoveLink</string>
+                                               <reference key="source" ref="773588579"/>
+                                               <reference key="destination" ref="635503948"/>
+                                       </object>
+                                       <int key="connectionID">2063</int>
+                               </object>
                        </object>
                        <object class="IBMutableOrderedSet" key="objectRecords">
                                <object class="NSArray" key="orderedObjects">
                                        <integer value="1"/>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <integer value="1"/>
-                                       <string>{{369, 135}, {595, 486}}</string>
+                                       <string>{{165, 432}, {595, 486}}</string>
                                        <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
                                        <boolean value="NO"/>
                                        <boolean value="NO"/>
-                                       <string>{{369, 135}, {595, 486}}</string>
+                                       <string>{{165, 432}, {595, 486}}</string>
                                        <integer value="1"/>
                                        <boolean value="NO"/>
                                        <string>{3.40282e+38, 3.40282e+38}</string>
@@ -4240,7 +4241,7 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg</string>
                                </object>
                        </object>
                        <nil key="sourceID"/>
-                       <int key="maxID">2057</int>
+                       <int key="maxID">2063</int>
                </object>
                <object class="IBClassDescriber" key="IBDocument.Classes">
                        <object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -4271,6 +4272,7 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg</string>
                                                        <string>showCellIP:</string>
                                                        <string>startStopAfs:</string>
                                                        <string>tableDoubleAction:</string>
+                                                       <string>tableViewLinkPerformClick:</string>
                                                        <string>unlog:</string>
                                                </object>
                                                <object class="NSMutableArray" key="dict.values">
@@ -4295,6 +4297,7 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg</string>
                                                        <string>id</string>
                                                        <string>id</string>
                                                        <string>id</string>
+                                                       <string>id</string>
                                                </object>
                                        </object>
                                        <object class="NSMutableDictionary" key="outlets">
@@ -4336,6 +4339,7 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg</string>
                                                        <string>saveConfigurationButton</string>
                                                        <string>startStopButton</string>
                                                        <string>statCacheEntry</string>
+                                                       <string>tableViewLink</string>
                                                        <string>textFieldDevInfoLabel</string>
                                                        <string>textSearchField</string>
                                                        <string>tokensButton</string>
@@ -4346,11 +4350,11 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg</string>
                                                </object>
                                                <object class="NSMutableArray" key="dict.values">
                                                        <bool key="EncodedWithXMLCoder">YES</bool>
-                                                       <string>id</string>
+                                                       <string>NSControl</string>
                                                        <string>NSView</string>
                                                        <string>NSButton</string>
                                                        <string>NSTextField</string>
-                                                       <string>id</string>
+                                                       <string>NSControl</string>
                                                        <string>NSTextField</string>
                                                        <string>NSTextField</string>
                                                        <string>NSButton</string>
@@ -4358,8 +4362,8 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg</string>
                                                        <string>NSButton</string>
                                                        <string>NSButton</string>
                                                        <string>NSTextField</string>
-                                                       <string>id</string>
-                                                       <string>id</string>
+                                                       <string>NSControl</string>
+                                                       <string>NSTableView</string>
                                                        <string>NSButton</string>
                                                        <string>NSButton</string>
                                                        <string>id</string>
@@ -4377,14 +4381,15 @@ Zm9yIGRlYnVnZ2luZyBhcyBpdCBwcmludHMgYSBMT1Qgb2YgaW5mb3JtYXRpb24uCg</string>
                                                        <string>id</string>
                                                        <string>LynkCreationController</string>
                                                        <string>NSTextField</string>
-                                                       <string>id</string>
-                                                       <string>id</string>
-                                                       <string>id</string>
+                                                       <string>NSControl</string>
+                                                       <string>NSControl</string>
+                                                       <string>NSButton</string>
                                                        <string>NSTextField</string>
+                                                       <string>NSTableView</string>
                                                        <string>NSTextField</string>
                                                        <string>NSSearchField</string>
                                                        <string>NSButton</string>
-                                                       <string>id</string>
+                                                       <string>NSTableView</string>
                                                        <string>NSButton</string>
                                                        <string>NSButton</string>
                                                        <string>NSButton</string>
index 80459b9..2d3b14e 100644 (file)
@@ -21,7 +21,7 @@
        <key>CFBundleSignature</key>
        <string>INFN</string>
        <key>CFBundleVersion</key>
-       <string>1.0b</string>
+       <string>1.0</string>
        <key>NSMainNibFile</key>
        <string>OpenAFSPreference</string>
        <key>NSPrefPaneIconFile</key>
index 308f61c..684958c 100644 (file)
@@ -7,7 +7,7 @@
 //
 
 #import "LynkCreationController.h"
-
+#import "global.h"
 
 @implementation LynkCreationController
 
 }
 
 - (IBAction) save:(id) sender {
+       NSMutableDictionary *linkConfiguration = nil;
+       if([[[textFieldLinkDestPath stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length] == 0 ||
+          [[[textfieldLinkName stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length] == 0 )
+               return;
+       
+       //load all configuration
+       NSData *prefData = (NSData*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_LINK_CONFIGURATION,  (CFStringRef)kAfsCommanderID,  kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+       if(prefData) {
+               linkConfiguration = [NSPropertyListSerialization propertyListFromData:prefData
+                                                                                                                        mutabilityOption:NSPropertyListMutableContainers
+                                                                                                                                          format:nil
+                                                                                                                        errorDescription:nil];
+       } else {
+               linkConfiguration = [NSMutableDictionary dictionaryWithCapacity:1];
+       }
+
+       [linkConfiguration setObject:[textFieldLinkDestPath stringValue] 
+                                                 forKey:[textfieldLinkName stringValue]];
+       
+       //save new configuration
+       prefData = [NSPropertyListSerialization dataWithPropertyList:linkConfiguration
+                                                                                                                 format:NSPropertyListXMLFormat_v1_0
+                                                                                                                options:0
+                                                                                                                  error:nil];
+       CFPreferencesSetValue((CFStringRef)PREFERENCE_LINK_CONFIGURATION,
+                                                 (CFDataRef)prefData,
+                                                 (CFStringRef)kAfsCommanderID,  kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+       CFPreferencesSynchronize((CFStringRef)kAfsCommanderID,  kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
        [NSApp endSheet:lynkCreationSheet];
 }
 
index 7fa0150..d10bdc4 100644 (file)
@@ -3,7 +3,7 @@
        archiveVersion = 1;
        classes = {
        };
-       objectVersion = 42;
+       objectVersion = 45;
        objects = {
 
 /* Begin PBXBuildFile section */
                089C1669FE841209C02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 1DBD214C08BA80EA00186707 /* Build configuration list for PBXProject "OpenAFS" */;
-                       compatibilityVersion = "Xcode 2.4";
+                       compatibilityVersion = "Xcode 3.1";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                1DBD214A08BA80EA00186707 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               ARCHS = (
-                                       ppc,
-                                       i386,
-                               );
+                               ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
                                GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
                                GCC_MODEL_TUNING = G5;
                                GCC_PRECOMPILE_PREFIX_HEADER = YES;
                                GCC_PREFIX_HEADER = AFSCommander_Prefix.pch;
                                INFOPLIST_FILE = Info.plist;
-                               INSTALL_PATH = "$(HOME)/Library/PreferencePanes";
+                               INSTALL_PATH = "";
                                PRODUCT_NAME = OpenAFS;
                                WRAPPER_EXTENSION = prefPane;
                        };
                1DBD214D08BA80EA00186707 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
-                               ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
+                               ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
                                GCC_C_LANGUAGE_STANDARD = gnu99;
                                GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+                               GCC_ENABLE_OBJC_GC = supported;
                                GCC_WARN_ABOUT_RETURN_TYPE = YES;
                                GCC_WARN_UNUSED_VARIABLE = YES;
-                               INSTALL_PATH = /Library/PreferencePanes;
-                               ONLY_ACTIVE_ARCH = NO;
+                               INSTALL_PATH = "";
+                               ONLY_ACTIVE_ARCH = YES;
                                PREBINDING = NO;
                                SKIP_INSTALL = NO;
                                VALID_ARCHS = "i386 ppc x86_64";
                1DBD214E08BA80EA00186707 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               ARCHS = (
-                                       ppc,
-                                       i386,
-                               );
+                               ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
                                GCC_C_LANGUAGE_STANDARD = gnu99;
                                GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+                               GCC_ENABLE_OBJC_GC = supported;
                                GCC_WARN_ABOUT_RETURN_TYPE = YES;
                                GCC_WARN_UNUSED_VARIABLE = YES;
+                               ONLY_ACTIVE_ARCH = YES;
                                PREBINDING = NO;
+                               VALID_ARCHS = "i386 ppc x86_64";
                        };
                        name = Release;
                };
index d695592..4e3fe51 100644 (file)
@@ -36,6 +36,8 @@
 #define PREFERENCE_START_AFS_AT_STARTUP                @"PREFERENCE_START_AFS_AT_STARTUP"
 #define PREFERENCE_SHOW_STATUS_MENU                    @"PREFERENCE_SHOW_STATUS_MENU"
 #define PREFERENCE_AKLOG_TOKEN_AT_LOGIN                @"PREFERENCE_AKLOG_TOKEN_AT_LOGIN"
+#define PREFERENCE_USE_LINK                                    @"PREFERENCE_USE_LINK"
+#define PREFERENCE_LINK_CONFIGURATION          @"PREFERENCE_LINK_CONFIGURATION"
 
 // AFSMENUEXTRA INFO
 #define kAFSMenuExtra                  [NSURL fileURLWithPath:[[self bundle] pathForResource:@"AFSBackgrounder" ofType:@"app" inDirectory:@""]]