Changeset 63 for trunk

Show
Ignore:
Timestamp:
05/29/08 21:02:30 (7 months ago)
Author:
mgorbach
Message:

Some overall cleanup. Addressing of ticket 40 (upgrade case)

Location:
trunk
Files:
12 modified

Legend:

Unmodified
Added
Removed
  • trunk/MFClient.m

    r54 r63  
    213213{ 
    214214        MFClientFS* fs = [self filesystemWithUUID: uuid]; 
    215         MFLogSO(self, fs, @"Note status changed for fs %@", fs); 
    216215        [fs noteStatusInfoChanged]; 
     216        MFLogSO(self, fs, @"Note status changed for fs %@ to %@", fs, fs.status); 
    217217} 
    218218 
  • trunk/MFClientFS.m

    r57 r63  
    122122                                                                                 to:(NSString*)newStatus 
    123123{ 
    124         MFLogS(self, @"Notifying for status %@ -> %@", previousStatus, newStatus); 
    125124        if ([previousStatus isEqualToString: newStatus]) 
    126125        { 
  • trunk/MFCommunicationServer.m

    r54 r63  
    5757                  toObjectsAtIndexes:indexes 
    5858                                  forKeyPath:@"status" 
    59                                          options:NSKeyValueObservingOptionNew 
     59                                         options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld 
    6060                                         context:nil]; 
    6161        [filesystems addObserver:self 
     
    111111                                                context:(void *)context 
    112112{ 
    113          
    114         // MFLogS(self, @"Observes: keypath %@ object %@, change %@", keyPath, object, change); 
    115         // TODO: We need to provide a way to call noteParametersChangedForFSWithUUID: here as well 
    116          
    117         if ([keyPath isEqualToString:@"status"] && [object isKindOfClass: [MFFilesystem class]]) 
     113        if ([keyPath isEqualToString:@"status"] && [object isKindOfClass: [MFFilesystem class]] 
     114                && ![[change objectForKey: NSKeyValueChangeOldKey] isEqualToString: [change objectForKey: NSKeyValueChangeNewKey]]) 
    118115        { 
    119116                MFFilesystem* fs = (MFFilesystem*)object; 
  • trunk/MFCore.h

    r62 r63  
    4040// FUSE versioning 
    4141NSString* mfcGetMacFuseVersion(); 
     42 
     43// Trashing 
     44void mfcSetupTrashMonitoring(); 
  • trunk/MFCore.m

    r62 r63  
    157157        CFStringRef processName; 
    158158        FSRef bundleFSRef; 
    159         OSErr getBundleError; 
    160         id runningAgentPath, runningMenulingPath; 
     159        OSErr error; 
     160        id runningAgentPath=nil, runningMenulingPath=nil; 
    161161        pid_t runningAgentPID, runningMenulingPID; 
    162162         
     
    171171                         [ (NSString*)processName isEqualToString: @"macfusionMenuling"] ) 
    172172                { 
    173                         getBundleError = GetProcessBundleLocation( &currentPSN, &bundleFSRef); 
     173                        error = GetProcessBundleLocation( &currentPSN, &bundleFSRef); 
    174174                        GetProcessPID( &currentPSN , &processPID); 
    175175                         
    176                         if (getBundleError == noErr) 
     176                        if (error == noErr) 
    177177                        { 
    178178                                CFURLRef bundleURLRef = CFURLCreateFromFSRef( kCFAllocatorDefault, &bundleFSRef); 
     
    207207        { 
    208208                // Agent is in the trash or running from the wrong path. Kill it & restart it. 
     209                MFLogS( self, @"Killing old or bad agent, and restarting." ); 
    209210                kill( runningAgentPID, SIGKILL); 
    210211                mfcLaunchAgent(); 
     
    215216        { 
    216217                // Menuling is in the trash or running from the wrong path. Kill it & restart it. 
     218                MFLogS( self, @"Killing old or bad menuling, and restarting." ); 
    217219                kill( runningMenulingPID, SIGKILL ); 
    218220                mfcLaunchMenuling(); 
    219221        } 
    220222} 
     223 
     224# pragma mark Trashing 
     225 
     226void trashFSEventCallBack(ConstFSEventStreamRef streamRef,  
     227                                                  void *clientCallBackInfo,  
     228                                                  size_t numEvents,  
     229                                                  void *eventPaths,  
     230                                                  const FSEventStreamEventFlags eventFlags[],  
     231                                                  const FSEventStreamEventId eventIds[]) 
     232{ 
     233        if (![[NSFileManager defaultManager] fileExistsAtPath: mfcMainBundlePath()]) 
     234        { 
     235                MFLogS(self, @"I have been deleted. Goodbye!"); 
     236                exit(0); 
     237        } 
     238} 
     239 
     240void mfcSetupTrashMonitoring() 
     241{ 
     242        FSEventStreamRef eventStream = FSEventStreamCreate( NULL, trashFSEventCallBack, NULL, 
     243                                                                                                           (CFArrayRef)[NSArray arrayWithObject:  
     244                                                                                                                                        [mfcMainBundlePath() stringByDeletingLastPathComponent]], 
     245                                                                                                           kFSEventStreamEventIdSinceNow, 
     246                                                                                                           0, kFSEventStreamCreateFlagUseCFTypes ); 
     247        FSEventStreamScheduleWithRunLoop( eventStream,  [[NSRunLoop currentRunLoop] getCFRunLoop], 
     248                                                                         kCFRunLoopDefaultMode ); 
     249        FSEventStreamStart( eventStream ); 
     250} 
  • trunk/MFFilesystemController.m

    r44 r63  
    9898                [self loadRecentFilesystems]; 
    9999                [self setUpVolumeMonitoring]; 
    100                 MFLogS(self, @"Init complete!"); 
    101100 
    102101        } 
  • trunk/MFLogReader.m

    r58 r63  
    7575        [self performSelectorOnMainThread:@selector(addASLEntries:) 
    7676                                                   withObject:logMessagesToAdd waitUntilDone:NO]; 
    77         // NSLog(@"Read entries from ASL Done. Added %d", [logMessagesToAdd count]); 
    7877} 
    7978 
    8079- (void)recordASLMessageDict:(NSDictionary*)messageDict 
    8180{ 
    82         // NSLog(@"Processing %@", messageDict); 
    83          
    8481        [[self mutableArrayValueForKey: @"logMessages"] addObject: 
    8582         messageDict]; 
  • trunk/MFMainController.h

    r24 r63  
    1616 
    1717#import <Cocoa/Cocoa.h> 
    18 #define TEMP_SSHFS_PATH @"/Users/mgorbach/Library/Macfusion/Plugins/SSHFS.bundle" 
    1918 
    2019@interface MFMainController : NSObject { 
     
    2423+ (MFMainController*)sharedController; 
    2524- (void)initialize; 
    26  
    27 // - (void)loadPlugins; 
    2825@end 
  • trunk/MFMainController.m

    r44 r63  
    5959- (void)initialize 
    6060{ 
     61        mfcSetupTrashMonitoring(); 
    6162        MFPluginController* pluginController = [MFPluginController sharedController]; 
    6263        [pluginController loadPlugins]; 
  • trunk/MFPreferences.m

    r57 r63  
    158158- (id)valueForUndefinedKey:(NSString*)key 
    159159{ 
    160         NSLog(@"Value being called"); 
    161160        return [self getValueForPreference: key]; 
    162161} 
  • trunk/MFServerFS.m

    r59 r63  
    732732- (void)setStatus:(NSString*)newStatus 
    733733{ 
    734         if (newStatus) 
     734        if (newStatus && ![newStatus isEqualToString: self.status] ) 
    735735        { 
    736736                // Hack this a bit so that we can set an error on faliure 
    737737                // Do this only if an error hasn't already been set 
    738738                [statusInfo setObject: newStatus forKey:kMFSTStatusKey ]; 
    739                  
    740                 /* 
    741                 if ([newStatus isEqualToString: kMFStatusFSMounted] ) 
    742                         [self tagMountPoint]; 
    743                  */ 
    744739                         
    745740                if( [newStatus isEqualToString: kMFStatusFSFailed] ) 
  • trunk/Settings/MFSettingsController.m

    r55 r63  
    9595- (BOOL)setup 
    9696{ 
     97        mfcSetupTrashMonitoring(); 
    9798        if ([client establishCommunication]) 
    9899        {