- Timestamp:
- 02/27/08 13:53:42 (10 months ago)
- Location:
- trunk
- Files:
-
- 7 added
- 8 removed
- 27 modified
-
MFClient.h (modified) (3 diffs)
-
MFClient.m (modified) (14 diffs)
-
MFClientFS.m (modified) (4 diffs)
-
MFClientRecent.h (added)
-
MFClientRecent.m (added)
-
MFCommunicationServer.h (modified) (2 diffs)
-
MFCommunicationServer.m (modified) (6 diffs)
-
MFConstants.h (modified) (4 diffs)
-
MFError.h (modified) (1 diff)
-
MFError.m (modified) (3 diffs)
-
MFFSDelegateProtocol.h (modified) (1 diff)
-
MFFilesystem.h (modified) (1 diff)
-
MFFilesystem.m (modified) (4 diffs)
-
MFFilesystemController.h (modified) (3 diffs)
-
MFFilesystemController.m (modified) (12 diffs)
-
MFMainController.m (modified) (1 diff)
-
MFPluginController.m (modified) (1 diff)
-
MFServerFS.h (modified) (2 diffs)
-
MFServerFS.m (modified) (6 diffs)
-
MFServerProtocol.h (modified) (1 diff)
-
MGNSImage.h (added)
-
MGNSImage.m (added)
-
MacFusion2.xcodeproj/project.pbxproj (modified) (25 diffs)
-
MacfusionMenuling-Info.plist (modified) (1 diff)
-
Menuling/MFMenulingAppDelegate.h (modified) (1 diff)
-
Menuling/MFMenulingAppDelegate.m (modified) (4 diffs)
-
Menuling/MFQuickMountController.h (added)
-
Menuling/MFQuickMountController.m (added)
-
Menuling/QuickMount.xib (added)
-
SSHFS/SSHFSDelegate.m (modified) (4 diffs)
-
SSHFS/sshfsConfiguration.xib (modified) (19 diffs)
-
Settings/MFFSCollectionView.h (deleted)
-
Settings/MFFSCollectionView.m (deleted)
-
Settings/MFFSItemView.h (deleted)
-
Settings/MFFSItemView.m (deleted)
-
Settings/MFFilesystemCell.m (modified) (3 diffs)
-
Settings/MFSettingsController.m (modified) (2 diffs)
-
Settings/NSEmptyGradientView.h (deleted)
-
Settings/NSEmptyGradientView.m (deleted)
-
Settings/TestView.h (deleted)
-
Settings/TestView.m (deleted)
-
Settings/main.xib (modified) (86 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/MFClient.h
r15 r16 17 17 NSMutableDictionary* pluginsDictionary; 18 18 NSMutableArray* plugins; 19 NSMutableArray* recents; 19 20 id <MFServerProtocol> server; 20 21 id delegate; … … 24 25 - (BOOL)setup; 25 26 26 - (NSArray*)filesystems;27 - (NSArray*)plugins;28 29 27 // Action methods 30 28 - (MFClientFS*)newFilesystemWithPlugin:(MFClientPlugin*)plugin; 29 - (MFClientFS*)quickMountFilesystemWithURL:(NSURL*)url 30 error:(NSError**)error; 31 31 32 32 // Accessors … … 36 36 @property(retain) id delegate; 37 37 38 // All filesystems, including temporary ones 39 @property(readonly) NSArray* filesystems; 40 41 // Only filesystems that are not temporary 42 @property(readonly) NSArray* persistentFilesystems; 43 @property(readonly) NSArray* mountedFilesystems; 44 45 // All plugins 46 @property (readonly) NSArray* plugins; 47 @property(readonly) NSArray* recents; 48 38 49 @end -
trunk/MFClient.m
r14 r16 11 11 #import "MFClientPlugin.h" 12 12 #import "MFConstants.h" 13 #import "MFClientRecent.h" 13 14 14 15 @interface MFClient(PrivateAPI) … … 16 17 - (void)storePlugin:(MFClientPlugin*)plugin; 17 18 - (void)removeFilesystem:(MFClientFS*)fs; 19 20 @property(readwrite, retain) NSMutableArray* filesystems; 21 @property(readwrite, retain) NSMutableArray* plugins; 22 @property(readwrite, retain) NSMutableArray* recents; 18 23 @end 19 24 … … 33 38 } 34 39 40 + (NSSet*)keyPathsForValuesAffectingValueForKey:(NSString*)key 41 { 42 if ([key isEqualToString:@"persistentFilesystems"] 43 || [key isEqualToString:@"mountedFilesystems"]) 44 return [NSSet setWithObject:@"filesystems"]; 45 else 46 return [super keyPathsForValuesAffectingValueForKey: key]; 47 } 48 49 35 50 + (MFClient*)allocWithZone:(NSZone*)zone 36 51 { … … 59 74 selector:@selector(handleFilesystemRemovedNotification:) 60 75 name:kMFFilesystemRemovedNotification 76 object:kMFDNCObject]; 77 [dnc addObserver:self 78 selector:@selector(handleRecentsUpdatedNotification:) 79 name:kMFRecentsUpdatedNotification 61 80 object:kMFDNCObject]; 62 81 } … … 69 88 filesystems = [NSMutableArray array]; 70 89 plugins = [NSMutableArray array]; 90 recents = [NSMutableArray array]; 71 91 } 72 92 return self; … … 97 117 [self storeFilesystem: fs]; 98 118 } 119 120 // Fill Recents 121 NSMutableArray* recentsFromServer = [[server recents] mutableCopy]; 122 for (NSDictionary* recent in recentsFromServer) 123 [[self mutableArrayValueForKey:@"recents"] addObject: 124 [[MFClientRecent alloc] initWithParameterDictionary: recent]]; 99 125 } 100 126 … … 140 166 NSDictionary* info = [note userInfo]; 141 167 NSString* uuid = [info objectForKey: KMFFSUUIDParameter]; 142 MFLogS(self, @"Filesystem Added: uuid %@", 143 uuid); 168 144 169 id remoteFilesystem = [server filesystemWithUUID: uuid]; 145 170 if (![self filesystemWithUUID:uuid]) … … 149 174 clientPlugin:plugin]; 150 175 151 152 176 [self storeFilesystem:fs ]; 153 177 } … … 158 182 NSDictionary* info = [note userInfo]; 159 183 NSString* uuid = [info objectForKey: KMFFSUUIDParameter]; 160 MFLogS(self, @"Filesystem Deleted: uuid %@",161 uuid);162 184 MFClientFS* fs = [self filesystemWithUUID: uuid]; 163 185 [self removeFilesystem:fs]; … … 175 197 } 176 198 177 #pragma Accessors and Setters 199 - (MFClientFS*)quickMountFilesystemWithURL:(NSURL*)url 200 error:(NSError**)error 201 { 202 id remoteFS = [server quickMountWithURL:url]; 203 if (!remoteFS) 204 { 205 NSError* serverError = [server recentError]; 206 if (serverError) 207 *error = serverError; 208 return nil; 209 } 210 else 211 { 212 if ([self filesystemWithUUID:[remoteFS uuid]]) 213 { 214 return [self filesystemWithUUID: [remoteFS uuid]]; 215 } 216 217 MFClientPlugin* plugin = [self pluginWithID: [remoteFS pluginID]]; 218 MFClientFS* newFS = [[MFClientFS alloc] initWithRemoteFS: remoteFS 219 clientPlugin: plugin ]; 220 [self storeFilesystem: newFS]; 221 return newFS; 222 } 223 } 224 225 #pragma mark Recents 226 - (void)handleRecentsUpdatedNotification:(NSNotification*)note 227 { 228 NSDictionary* recentParameterDict = [[note userInfo] objectForKey: kMFRecentKey ]; 229 [[self mutableArrayValueForKey:@"recents"] addObject: 230 [[MFClientRecent alloc] initWithParameterDictionary: recentParameterDict ]]; 231 232 if ([[self recents] count] > 10) 233 [[self mutableArrayValueForKey:@"recents"] removeObjectAtIndex: 0]; 234 } 235 236 #pragma mark Accessors and Setters 237 238 - (NSArray*)persistentFilesystems 239 { 240 return [self.filesystems filteredArrayUsingPredicate: 241 [NSPredicate predicateWithFormat:@"self.isPersistent == YES"]]; 242 } 243 244 - (NSArray*)mountedFilesystems 245 { 246 return [self.filesystems filteredArrayUsingPredicate: 247 [NSPredicate predicateWithFormat:@"self.isMounted == YES"]]; 248 } 178 249 179 250 - (void)storePlugin:(MFClientPlugin*)plugin … … 183 254 if ([plugins indexOfObject: plugin] == NSNotFound) 184 255 { 185 [self willChange:NSKeyValueChangeInsertion 186 valuesAtIndexes: [NSIndexSet indexSetWithIndex: [plugins count]] 187 forKey:@"plugins"]; 188 [plugins addObject: plugin]; 189 [self didChange:NSKeyValueChangeInsertion 190 valuesAtIndexes: [NSIndexSet indexSetWithIndex: [plugins count]] 191 forKey:@"plugins"]; 256 [[self mutableArrayValueForKey:@"plugins"] 257 addObject: plugin]; 192 258 } 193 259 } … … 200 266 if ([filesystems indexOfObject: fs] == NSNotFound) 201 267 { 202 [self willChange:NSKeyValueChangeInsertion 203 valuesAtIndexes: [NSIndexSet indexSetWithIndex: [filesystems count]] 204 forKey:@"filesystems"]; 205 [filesystems addObject: fs]; 206 [self didChange:NSKeyValueChangeInsertion 207 valuesAtIndexes: [NSIndexSet indexSetWithIndex: [filesystems count]] 208 forKey:@"filesystems"]; 268 [[self mutableArrayValueForKey:@"filesystems"] 269 addObject: fs]; 209 270 } 210 271 } … … 216 277 if ([filesystems indexOfObject:fs] != NSNotFound) 217 278 { 218 [self willChange:NSKeyValueChangeRemoval 219 valuesAtIndexes:[NSIndexSet indexSetWithIndex:[filesystems indexOfObject: fs]] 220 forKey:@"filesystems"]; 221 [filesystems removeObject: fs]; 222 [self didChange:NSKeyValueChangeRemoval 223 valuesAtIndexes:[NSIndexSet indexSetWithIndex:[filesystems indexOfObject: fs]] 224 forKey:@"filesystems"]; 279 [[self mutableArrayValueForKey:@"filesystems"] 280 removeObject: fs]; 225 281 } 226 282 } … … 239 295 } 240 296 241 - (NSArray*)plugins 242 { 243 return (NSArray*)plugins; 244 } 245 246 - (NSArray*)filesystems 247 { 248 return (NSArray*)filesystems; 249 } 250 251 @synthesize delegate; 297 @synthesize delegate, filesystems, plugins, recents; 252 298 @end -
trunk/MFClientFS.m
r14 r16 58 58 - (void)registerNotifications 59 59 { 60 /*61 [self addObserver:self62 forKeyPath:kMFParameterDict63 options:NSKeyValueObservingOptionNew64 context:nil];65 */66 60 } 67 61 … … 93 87 } 94 88 89 #pragma mark Notifications To Clients 90 - (void)sendNotificationForStatusChangeFrom:(NSString*)previousStatus 91 to:(NSString*)newStatus 92 { 93 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; 94 if ([previousStatus isEqualToString: newStatus]) 95 { 96 // Send No Notification 97 } 98 if ([previousStatus isEqualToString: kMFStatusFSWaiting] 99 && [newStatus isEqualToString: kMFStatusFSMounted]) 100 { 101 [nc postNotificationName: kMFClientFSMountedNotification 102 object:self 103 userInfo:nil]; 104 } 105 else if ([previousStatus isEqualToString: kMFStatusFSWaiting] 106 && [newStatus isEqualToString: kMFStatusFSFailed]) 107 { 108 [nc postNotificationName: kMFClientFSFailedNotification 109 object:self 110 userInfo:nil]; 111 } 112 } 113 95 114 #pragma mark Synchronization across IPC 96 115 - (void)handleStatusInfoChangedNotification:(NSNotification*)note 97 116 { 117 NSString* previousStatus = self.status; 98 118 [self copyStatusInfo]; 119 NSString* newStatus = self.status; 120 [self sendNotificationForStatusChangeFrom:previousStatus 121 to:newStatus]; 99 122 } 100 123 … … 143 166 { 144 167 [[NSException exceptionWithName:kMFBadAPIUsageException 145 reason:@" endEditing withoutbeginEditing"168 reason:@"Calling endEditing without previous call to beginEditing" 146 169 userInfo:nil] raise]; 147 170 } … … 173 196 if ([key isLike:@"parameters.*"] && !isEditing) 174 197 { 175 [[NSException exceptionWithName: @"MFBadAPIUsage"198 [[NSException exceptionWithName:kMFBadAPIUsageException 176 199 reason:@"Trying to modify parameters without beginEditing" 177 200 userInfo:nil] raise]; -
trunk/MFCommunicationServer.h
r10 r16 14 14 @interface MFCommunicationServer : NSObject <MFServerProtocol> 15 15 { 16 16 NSError* recentError; 17 17 } 18 18 … … 22 22 - (MFPluginController*)pluginController; 23 23 - (void)startServingRunloop; 24 - (NSError*)recentError; 24 25 25 26 @end -
trunk/MFCommunicationServer.m
r14 r16 62 62 options: NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld 63 63 context: nil]; 64 [[MFFilesystemController sharedController] addObserver: self 65 forKeyPath: @"recents" 66 options: NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld 67 context: nil]; 64 68 } 65 69 … … 79 83 if ([connection registerName:kMFDistributedObjectName] == YES) 80 84 { 81 MFLogS(self, @"Now Vending distributed object");82 85 } 83 86 else … … 93 96 context:(void *)context 94 97 { 95 // MFLogS(self, @"Observe triggered on keypath %@, object %@", keyPath, object); 96 98 97 99 // TODO: This observation method will not be called on objects added to filesystems after registerNotifications is called 98 100 // We need to observe filesystems itself, and add/remove observations on filesystems as they appear and dissapear 99 101 NSDistributedNotificationCenter* dnc = [NSDistributedNotificationCenter defaultCenter]; 102 103 // MFLogS(self, @"Observes: keypath %@ object %@, change %@", keyPath, object, change); 100 104 101 105 if ([keyPath isEqualToString:@"status"] && [object isKindOfClass: [MFFilesystem class]]) … … 143 147 [fs removeObserver: self 144 148 forKeyPath:@"parameters"]; 149 NSDictionary* userInfoDict = [NSDictionary dictionaryWithObject: [fs uuid] 150 forKey: KMFFSUUIDParameter ]; 151 [dnc postNotificationName:kMFFilesystemRemovedNotification 152 object:kMFDNCObject 153 userInfo:userInfoDict]; 145 154 } 146 155 } 147 156 } 148 157 149 158 if ([keyPath isEqualToString:@"recents"] && object == [MFFilesystemController sharedController]) 159 { 160 NSUInteger changeKind = [[change objectForKey: NSKeyValueChangeKindKey] intValue]; 161 if (changeKind == NSKeyValueChangeInsertion) 162 { 163 NSArray* newRecent = [change objectForKey:NSKeyValueChangeNewKey]; 164 NSDictionary* userInfoDict = [NSDictionary dictionaryWithObject:[newRecent objectAtIndex:0] 165 forKey:kMFRecentKey]; 166 [dnc postNotificationName:kMFRecentsUpdatedNotification 167 object:kMFDNCObject 168 userInfo:userInfoDict ]; 169 } 170 } 171 } 172 173 - (NSArray*)recents 174 { 175 return [[MFFilesystemController sharedController] recents]; 150 176 } 151 177 … … 185 211 return [[MFFilesystemController sharedController] filesystemWithUUID:uuid]; 186 212 } 213 214 - (MFServerFS*)quickMountWithURL:(NSURL*)url 215 { 216 NSError* error; 217 MFServerFS* fs = [[MFFilesystemController sharedController] quickMountWithURL: url error:&error]; 218 if (error) 219 recentError = error; 220 return fs; 221 } 187 222 188 223 … … 198 233 } 199 234 235 - (NSError*)recentError 236 { 237 return recentError; 238 } 239 200 240 @end -
trunk/MFConstants.h
r14 r16 40 40 #define kMFFilesystemAddedNotification @"org.mgorbach.macfusion.notifications.fsAdded" 41 41 #define kMFFilesystemRemovedNotification @"org.mgorbach.macfusion.notifications.fsRemoved" 42 #define kMFRecentsUpdatedNotification @"org.mgorbach.macfusion.notifications.recentsUpdated" 43 44 // Client Notifications (Non-distributed) 45 #define kMFClientFSMountedNotification @"org.mgorbach.macfusion.mfclient.fsMounted" 46 #define kMFClientFSUnmountedNotification @"org.mgorbach.macfusion.mfclient.fsUnmounted" 47 #define kMFClientFSFailedNotification @"org.mgorbach.macfusion.mfclient.fsFailed" 42 48 43 49 // IPC Object Names … … 48 54 #define kMFFilesystemNameKey @"Name" 49 55 #define kMFFilesystemStatusKey @"Status" 56 #define kMFRecentKey @"recent" 50 57 51 58 // Parameters Common to All FUSE Filesystems … … 58 65 #define kMFFSFilePathParameter @"File Path" 59 66 #define kMFFSPersistentParameter @"Is Persistent" 67 #define kMFFSDescriptionParameter @"Description" 60 68 61 69 // Status keys … … 77 85 kMFErrorCodeDataCannotBeRead, 78 86 kMFErrorCodeMissingParameter, 79 kMFErrorInvalidParameterValue 87 kMFErrorCodeInvalidParameterValue, 88 kMFErrorCodeNoPluginFound, 89 kMFErrorCodeMountFaliure 80 90 }; 81 91 -
trunk/MFError.h
r14 r16 20 20 description:(NSString*)description; 21 21 22 + (MFError*)errorWithErrorCode:(NSInteger)code 23 description:(NSString*)description; 24 22 25 @end -
trunk/MFError.m
r15 r16 31 31 nil]; 32 32 return [MFError errorWithDomain: kMFErrorDomain 33 code: kMFErrorInvalidParameterValue33 code: kMFErrorCodeInvalidParameterValue 34 34 userInfo: errorDict]; 35 35 } … … 48 48 paramName ]; 49 49 } 50 if ([self code] == kMFError InvalidParameterValue)50 if ([self code] == kMFErrorCodeInvalidParameterValue) 51 51 { 52 52 return [NSString stringWithFormat: @"Invalid value for %@\n%@", … … 59 59 } 60 60 61 + (MFError*)errorWithErrorCode:(NSInteger)code 62 description:(NSString*)description 63 { 64 return [MFError errorWithDomain:kMFErrorDomain 65 code:code 66 userInfo: [NSDictionary dictionaryWithObject: description 67 forKey: NSLocalizedDescriptionKey ] ]; 68 } 69 61 70 @end -
trunk/MFFSDelegateProtocol.h
r14 r16 29 29 30 30 - (NSString*)executablePath; 31 - (NSArray*)urlSchemesHandled; 31 32 32 33 @optional 33 34 - (NSDictionary*)taskEnvironmentForParameters:(NSDictionary*)parameters; 34 35 - (NSDictionary*)parameterDictionaryForURL:(NSURL*)url 36 error:(NSError**)error; 37 - (NSError*)errorForParameters:(NSDictionary*)parameters 38 output:(NSString*)output; 35 39 @end -
trunk/MFFilesystem.h
r14 r16 34 34 - (id)valueForParameterNamed:(NSString*)paramName; 35 35 - (NSMutableDictionary*)fillParametersWithImpliedValues:(NSDictionary*)params; 36 - (NSError*)error; 36 37 37 38 @property(readwrite, assign) NSString* status; -
trunk/MFFilesystem.m
r14 r16 78 78 if (status) 79 79 { 80 [statusInfo setObject:status 81 forKey:kMFSTStatusKey]; 80 [statusInfo setObject:status forKey:kMFSTStatusKey]; 82 81 } 83 82 }
