[anselServers removeObjectAtIndex: [serverTable selectedRow]];
[userPrefs setObject:anselServers forKey:TURAnselServersKey];
[userPrefs synchronize];
+ NSLog(@"Attempting to reload");
[serverTable reloadData];
+ NSLog(@"Reloaded");
[self updateServersPopupMenu];
}
// Server setup sheet
-(IBAction)doAddServer: (id)sender
{
- // Sanity Checking
- // TODO - make sure we don't have more than one gallery with the same nick??
-// if (![[serverNickName stringValue] length]) {
-// // TODO: Errors - for now, just silently fail, yea, I know....
-// return;
-// }
+ // TODO: Sanity checks
+ [self disconnect];
+
NSDictionary *newServer = [[NSDictionary alloc] initWithObjectsAndKeys:
[serverNickName stringValue], TURAnselServerNickKey,
[anselHostURL stringValue], TURAnselServerEndpointKey,
[NSApp endSheet: newServerSheet];
[newServerSheet orderOut: nil];
- [self disconnect];
currentServer = [newServer retain];
[self doConnect];
// Save it to the userdefaults
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
[prefs setObject:anselServers forKey:TURAnselServersKey];
+ [prefs synchronize];
+
+ [self updateServersPopupMenu];
+
[newServer release];
}
}
if ([anselServers count] == 0) {
[mServersPopUp addItemWithTitle:@"(None)"];
- //[mainStatusString setStringValue:@"No galleries configured"];
}
// add separator
{
[galleryCombo setDelegate: nil];
[galleryCombo setDataSource: nil];
-
+ [galleryCombo setEnabled: false];
+
[currentServer release];
currentServer = nil;
[anselController release];
// Start the connection process.
-(void)doConnect
{
+ [galleryCombo deselectItemAtIndex: [galleryCombo indexOfSelectedItem]];
+ [mServersPopUp setEnabled: false];
[self setStatusText: @"Connecting..."];
[spinner startAnimation: self];
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- (void)TURAnselDidInitialize
{
[galleryCombo reloadData];
+ [galleryCombo setEnabled: true];
[self setStatusText: @"Connected" withColor: [NSColor greenColor]];
[self canExport];
[spinner stopAnimation: self];
+ [mServersPopUp setEnabled: true];
}
- (void)TURAnselHadError: (NSError *)error
// Stop the spinner
[spinner stopAnimation: self];
[self disconnect];
+ [mServersPopUp setEnabled: true];
NSAlert *alert;
// For some reason, this method doesn't pick up our userInfo dictionary...
- (void)comboBoxSelectionDidChange:(NSNotification *)notification
{
// Yes, I'm comparing the pointers here on purpose
- if ([notification object] == galleryCombo) {
+ //if ([notification object] == galleryCombo) {
int row = [galleryCombo indexOfSelectedItem];
[currentGallery setDelegate:nil];
[currentGallery autorelease];
[defaultImageView setImage: theImage];
[theImage release];
[self canExport];
- }
+ //}
}