Skip to content

Commit

Permalink
Fix synchronization of parameters (names should change in menuling now)
Browse files Browse the repository at this point in the history
Fix some problems with responding to DO endpoints stopping
Fix headers for some new files
  • Loading branch information
Michael Gorbach committed Apr 5, 2008
1 parent ea1b437 commit a67f653
Show file tree
Hide file tree
Showing 20 changed files with 184 additions and 22 deletions.
4 changes: 3 additions & 1 deletion MFClient.h
Expand Up @@ -16,6 +16,7 @@

#import <Cocoa/Cocoa.h>
#import "MFServerProtocol.h"
#import "MFClientDelegateProtocol.h"

@class MFClientFS, MFClientPlugin, MFClientRecent;

Expand All @@ -27,7 +28,8 @@
NSMutableArray* plugins;
NSMutableArray* recents;
id <MFServerProtocol> server;
id delegate;
id<MFClientDelegateProtocol> delegate;
NSConnection* connection;
}

+ (MFClient*)sharedClient;
Expand Down
21 changes: 19 additions & 2 deletions MFClient.m
Expand Up @@ -176,11 +176,12 @@ - (void)fillInitialStatus
- (BOOL)establishCommunication
{
// Set up DO
id serverObject = [NSConnection rootProxyForConnectionWithRegisteredName:kMFDistributedObjectName
host:nil];
connection = [NSConnection connectionWithRegisteredName:kMFDistributedObjectName host:nil];
id serverObject = [connection rootProxy];
[serverObject setProtocolForProxy:@protocol(MFServerProtocol)];
server = (id <MFServerProtocol>)serverObject;
[serverObject registerClient: self];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleConnectionDied:) name:NSConnectionDidDieNotification object:connection];
if (serverObject)
{
[MFLogReader sharedReader]; // Tell the log reader to update
Expand All @@ -192,6 +193,8 @@ - (BOOL)establishCommunication
}
}



- (BOOL)setup
{
if ([self establishCommunication])
Expand All @@ -213,6 +216,13 @@ - (void)noteStatusChangedForFSWithUUID:(NSString*)uuid
[fs noteStatusInfoChanged];
}

- (void)noteParametersChangedForFSWithUUID:(NSString*)uuid
{
MFClientFS* fs = [self filesystemWithUUID: uuid];
MFLogSO(self, fs, @"Note parameters changed for fs %@", fs);
[fs noteParametersChanged];
}

- (void)noteFilesystemAddedWithUUID:(NSString*)uuid
{
MFLogS(self, @"Note fs added with uuid %@", uuid);
Expand Down Expand Up @@ -283,6 +293,13 @@ - (void)deleteFilesystem:(MFClientFS*)fs
[server deleteFilesystemWithUUID: uuid];
}

- (void)handleConnectionDied:(NSNotification*)note
{
MFLogS(self, @"Connection died %@", note);
if ([delegate respondsToSelector: @selector(handleConnectionDied)])
[delegate handleConnectionDied];
}

#pragma mark Recents


Expand Down
24 changes: 24 additions & 0 deletions MFClientDelegateProtocol.h
@@ -0,0 +1,24 @@
/*
* MFClientDelegateProtocol.h
* MacFusion2
*
* Created by Michael Gorbach on 4/5/08.
* Copyright 2008 Michael Gorbach. All rights reserved.
*
*/
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

@protocol MFClientDelegateProtocol <NSObject>
- (void)handleConnectionDied;
@end

7 changes: 6 additions & 1 deletion MFClientFS.m
Expand Up @@ -218,6 +218,9 @@ - (NSError*)endEditingAndCommitChanges:(BOOL)commit
mfsecSetSecretsDictionaryForFilesystem( secrets, self );
}
isEditing = NO;
viewControllers = nil;
topViewController = nil;
editingTabView = nil;
return nil;
}
}
Expand All @@ -226,7 +229,9 @@ - (NSError*)endEditingAndCommitChanges:(BOOL)commit
isEditing = NO;
[self setParameters: [backupParameters mutableCopy] ];
[self setSecrets: [backupSecrets mutableCopy]];

viewControllers = nil;
topViewController = nil;
editingTabView = nil;
}

return nil;
Expand Down
11 changes: 11 additions & 0 deletions MFClientFSUI.h
Expand Up @@ -5,6 +5,17 @@
// Created by Michael Gorbach on 3/30/08.
// Copyright 2008 Michael Gorbach. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <Cocoa/Cocoa.h>
#import "MFClientFS.h"
Expand Down
11 changes: 11 additions & 0 deletions MFClientFSUI.m
Expand Up @@ -5,6 +5,17 @@
// Created by Michael Gorbach on 3/30/08.
// Copyright 2008 Michael Gorbach. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import "MFClientFSUI.h"
#import "MFAdvancedViewController.h"
Expand Down
12 changes: 12 additions & 0 deletions MFClientProtocol.h
Expand Up @@ -6,10 +6,22 @@
* Copyright 2008 Michael Gorbach. All rights reserved.
*
*/
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

@protocol MFClientProtocol <NSObject>
// Updates
- (void)noteStatusChangedForFSWithUUID:(NSString*)uuid;
- (void)noteParametersChangedForFSWithUUID:(NSString*)uuid;

// Filesystems Array
- (void)noteFilesystemAddedWithUUID:(NSString*)uuid;
Expand Down
7 changes: 7 additions & 0 deletions MFCommunicationServer.m
Expand Up @@ -121,6 +121,13 @@ - (void) observeValueForKeyPath:(NSString *)keyPath
withObject:fs.uuid];
}

if ([keyPath isEqualToString:@"parameters"] && [object isKindOfClass: [MFFilesystem class]])
{
MFFilesystem* fs = (MFFilesystem*)object;
[clients makeObjectsPerformSelector:@selector(noteParametersChangedForFSWithUUID:)
withObject:fs.uuid];
}

if ([keyPath isEqualToString:@"filesystems"] && object == [MFFilesystemController sharedController])
{
NSUInteger changeKind = [[change objectForKey: NSKeyValueChangeKindKey] intValue];
Expand Down
13 changes: 12 additions & 1 deletion MFPreferences.h
Expand Up @@ -3,8 +3,19 @@
// MacFusion2
//
// Created by Michael Gorbach on 3/15/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
// Copyright 2008 Michael Gorbach. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <Cocoa/Cocoa.h>
// Preference Keys
Expand Down
2 changes: 1 addition & 1 deletion MFPreferences.m
Expand Up @@ -3,7 +3,7 @@
// MacFusion2
//
// Created by Michael Gorbach on 3/15/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
// Copyright 2008 Michael Gorbach. All rights reserved.
//

#import "MFPreferences.h"
Expand Down
11 changes: 11 additions & 0 deletions MGTestView.h
Expand Up @@ -5,6 +5,17 @@
// Created by Michael Gorbach on 3/30/08.
// Copyright 2008 Michael Gorbach. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <Cocoa/Cocoa.h>

Expand Down
11 changes: 11 additions & 0 deletions MGTestView.m
Expand Up @@ -5,6 +5,17 @@
// Created by Michael Gorbach on 3/30/08.
// Copyright 2008 Michael Gorbach. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import "MGTestView.h"
#import <stdlib.h>
Expand Down
2 changes: 2 additions & 0 deletions MacFusion2.xcodeproj/project.pbxproj
Expand Up @@ -394,6 +394,7 @@
D439D6D50D0A0FDE0025574A /* sshfsConfiguration.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = sshfsConfiguration.xib; sourceTree = "<group>"; };
D441521F0CE2933C001EEF36 /* sshfs.mfplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = sshfs.mfplugin; sourceTree = BUILT_PRODUCTS_DIR; };
D441DB620D995C2B009F869A /* MFClientProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFClientProtocol.h; sourceTree = "<group>"; };
D44FA6AB0DA7D0FB007AB734 /* MFClientDelegateProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFClientDelegateProtocol.h; sourceTree = "<group>"; };
D45579150D40715F00669882 /* MFInertButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFInertButton.h; sourceTree = "<group>"; };
D45579160D40715F00669882 /* MFInertButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFInertButton.m; sourceTree = "<group>"; };
D45F0D940D8B3396008CC7E3 /* macfusionAgent-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "macfusionAgent-Info.plist"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -741,6 +742,7 @@
D403BC8D0D64C3D00049201D /* MFServerFSProtocol.h */,
D4D0E9FE0D7C887A00797279 /* MFClientFSDelegateProtocol.h */,
D441DB620D995C2B009F869A /* MFClientProtocol.h */,
D44FA6AB0DA7D0FB007AB734 /* MFClientDelegateProtocol.h */,
);
name = Protocols;
sourceTree = "<group>";
Expand Down
3 changes: 2 additions & 1 deletion Menuling/MFMenulingAppDelegate.h
Expand Up @@ -16,10 +16,11 @@

#import <Cocoa/Cocoa.h>
#import "MFClientFSDelegateProtocol.h"
#import "MFClientDelegateProtocol.h"

@class MFClient, MFQuickMountController;

@interface MFMenulingAppDelegate : NSObject <MFClientFSDelegateProtocol> {
@interface MFMenulingAppDelegate : NSObject <MFClientFSDelegateProtocol, MFClientDelegateProtocol> {
NSStatusItem* statusItem;
MFClient* client;
MFQuickMountController* qmController;
Expand Down
9 changes: 3 additions & 6 deletions Menuling/MFMenulingAppDelegate.m
Expand Up @@ -48,6 +48,8 @@ - (id)init
[NSApp terminate:self];
}
}

[client setDelegate: self];
return self;
}

Expand Down Expand Up @@ -87,11 +89,6 @@ - (void)awakeFromNib
[statusItem setHighlightMode: YES];
[statusItem setImage: menuIcon];
[statusItem setAlternateImage: menuIconSelected];
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self
selector:@selector(handleConnectionDidDie:)
name:NSConnectionDidDieNotification
object:nil];
}

- (void)connectToServer:(id)sender
Expand Down Expand Up @@ -264,7 +261,7 @@ - (void)quit:(id)sender
}

# pragma mark Error Handling
- (void)handleConnectionDidDie:(NSNotification*)note
- (void)handleConnectionDied
{
// We won't try to recover since we're a background app. Let's just die ...
MFLogS(self, @"Terminating due to dead agent connection");
Expand Down
11 changes: 11 additions & 0 deletions Settings/MFIconSettingImageView.h
Expand Up @@ -5,6 +5,17 @@
// Created by Michael Gorbach on 3/19/08.
// Copyright 2008 Michael Gorbach. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <Cocoa/Cocoa.h>
@class MFClientFS;
Expand Down
11 changes: 11 additions & 0 deletions Settings/MFIconSettingImageView.m
Expand Up @@ -5,6 +5,17 @@
// Created by Michael Gorbach on 3/19/08.
// Copyright 2008 Michael Gorbach. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import "MFIconSettingImageView.h"
#import "MFClientFS.h"
Expand Down
10 changes: 3 additions & 7 deletions Settings/MFSettingsController.m
Expand Up @@ -178,11 +178,6 @@ - (void)awakeFromNib
options:nil];
[filesystemTableView setController: self];
fsBeingEdited = nil;
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self
selector:@selector(handleConnectionDidDie:)
name:NSConnectionDidDieNotification
object:nil];
}

- (void)applicationWillFinishLaunching:(NSNotification*)note
Expand Down Expand Up @@ -601,8 +596,9 @@ - (void)connectionDidDieAlertDidEnd:(NSAlert*)alert
}
}

- (void)handleConnectionDidDie:(NSNotification*)note
- (void)handleConnectionDied
{

if (mfcClientIsUIElement())
[NSApp terminate:self];

Expand All @@ -616,7 +612,7 @@ - (void)handleConnectionDidDie:(NSNotification*)note
[connectDidDieAlert beginSheetModalForWindow:[filesystemTableView window]
modalDelegate:self
didEndSelector:@selector(connectionDidDieAlertDidEnd:returnCode:contextInfo:)
contextInfo:nil];
contextInfo:nil];

}

Expand Down

0 comments on commit a67f653

Please sign in to comment.