Skip to content
This repository has been archived by the owner on Aug 10, 2022. It is now read-only.

Commit

Permalink
Immediately apply the configuration when a new application is dropped.
Browse files Browse the repository at this point in the history
  • Loading branch information
Manfred committed Jan 10, 2011
1 parent 6e01166 commit 2d01326
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
14 changes: 11 additions & 3 deletions app/controllers/PassengerPref.m
Expand Up @@ -44,7 +44,9 @@ - (void) setupAuthorizationView {

- (void) setupApplicationView {
[self loadApplications];
[applicationsController setSelectedObjects:[NSArray arrayWithObjects:[applications objectAtIndex:0], nil]];
if ([applications count] > 0) {
[applicationsController setSelectedObjects:[NSArray arrayWithObjects:[applications objectAtIndex:0], nil]];
}
[applicationsTableView registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
[applicationsTableView setDraggingSourceOperationMask:NSDragOperationGeneric forLocal:NO];
}
Expand Down Expand Up @@ -100,7 +102,7 @@ - (BOOL) tableView:(NSTableView *)aTableView acceptDrop:(id)info row:(NSInteger)
[droppedApplications addObject:application];
}
[applicationsController addObjects:droppedApplications];
[self checkForDirtyApplications];
[self apply:self];

return YES;
}
Expand Down Expand Up @@ -147,6 +149,7 @@ - (IBAction) remove:(id)sender {
[[CLI sharedInstance] delete:application];
}
[applicationsController removeObject:application];
[self checkForDirtyApplications];
}

- (IBAction) browse:(id)sender {
Expand Down Expand Up @@ -189,6 +192,7 @@ - (IBAction) apply:(id)sender {
} else {
NSLog(@"Unable to apply because authorization failed.");
}
[self checkForDirtyApplications];
}
- (IBAction) revert:(id)sender {
Application *application;
Expand Down Expand Up @@ -239,7 +243,11 @@ - (void) reloadApplications {
}

- (Application *) selectedApplication {
return [[applicationsController selectedObjects] objectAtIndex:0];
if (applications && ([applications count] > 0)) {
return [[applicationsController selectedObjects] objectAtIndex:0];
} else {
return nil;
}
}

- (NSString *) pathForDirectoryBrowser {
Expand Down
10 changes: 6 additions & 4 deletions app/utils/CLI.m
Expand Up @@ -30,10 +30,12 @@ - (NSMutableArray *)listApplications {
result = [self execute:[NSArray arrayWithObjects:@"list", @"-m", nil] elevated:NO];
applications = [NSMutableArray arrayWithCapacity:[result count]];

for (attributes in result) {
application = [[Application alloc] initWithAttributes:attributes];
[application setDelegate:appDelegate];
[applications addObject:application];
if ([result count] > 0) {
for (attributes in result) {
application = [[Application alloc] initWithAttributes:attributes];
[application setDelegate:appDelegate];
[applications addObject:application];
}
}

return applications;
Expand Down
1 change: 0 additions & 1 deletion doc/TODO
@@ -1,4 +1,3 @@
- Immediately apply the configuration when a new application is added. In most cases the default configuration is exactly what you want.
- Prevent duplicate folders. When the user tries to add a duplicate folder, select the configuration for the application that uses this folder in the source list.
- Do not accept characters in the Address and Aliases fields that can't be used for the domain name (including whitespace in the address field).
- Check for duplicate addresses and aliases after Apply has been clicked. Show a sheet with the following alert:
Expand Down

0 comments on commit 2d01326

Please sign in to comment.