1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00

#2680 "Group Name" cleared after choosing "Custom location"

This commit is contained in:
Mitchell Livingston 2009-12-16 03:19:09 +00:00
parent 512662d5b3
commit a942125d2f

View file

@ -35,6 +35,7 @@
@interface GroupsPrefsController (Private) @interface GroupsPrefsController (Private)
- (void) updateSelectedGroup; - (void) updateSelectedGroup;
- (void) refreshCustomLocation;
@end @end
@ -216,18 +217,15 @@
NSString * path = [[openPanel filenames] objectAtIndex: 0]; NSString * path = [[openPanel filenames] objectAtIndex: 0];
[[GroupsController groups] setCustomDownloadLocation: path forIndex: index]; [[GroupsController groups] setCustomDownloadLocation: path forIndex: index];
[[GroupsController groups] setUsesCustomDownloadLocation: YES forIndex: index]; [[GroupsController groups] setUsesCustomDownloadLocation: YES forIndex: index];
[self updateSelectedGroup]; //update the popup's icon/title
} }
else else
{ {
if (![[GroupsController groups] customDownloadLocationForIndex: index]) if (![[GroupsController groups] customDownloadLocationForIndex: index])
{
[[GroupsController groups] setUsesCustomDownloadLocation: NO forIndex: index]; [[GroupsController groups] setUsesCustomDownloadLocation: NO forIndex: index];
[fCustomLocationEnableCheck setState: NSOffState];
[fCustomLocationPopUp setEnabled: NO];
}
} }
[self refreshCustomLocation];
[fCustomLocationPopUp selectItemAtIndex: 0]; [fCustomLocationPopUp selectItemAtIndex: 0];
} }
@ -314,27 +312,13 @@
[fAddRemoveControl setEnabled: [fTableView numberOfSelectedRows] > 0 forSegment: REMOVE_TAG]; [fAddRemoveControl setEnabled: [fTableView numberOfSelectedRows] > 0 forSegment: REMOVE_TAG];
if ([fTableView numberOfSelectedRows] == 1) if ([fTableView numberOfSelectedRows] == 1)
{ {
NSInteger index = [[GroupsController groups] indexForRow: [fTableView selectedRow]]; const NSInteger index = [[GroupsController groups] indexForRow: [fTableView selectedRow]];
[fSelectedColorView setColor: [[GroupsController groups] colorForIndex: index]]; [fSelectedColorView setColor: [[GroupsController groups] colorForIndex: index]];
[fSelectedColorView setEnabled: YES]; [fSelectedColorView setEnabled: YES];
[fSelectedColorNameField setStringValue: [[GroupsController groups] nameForIndex: index]]; [fSelectedColorNameField setStringValue: [[GroupsController groups] nameForIndex: index]];
[fSelectedColorNameField setEnabled: YES]; [fSelectedColorNameField setEnabled: YES];
[fCustomLocationEnableCheck setState: [[GroupsController groups] usesCustomDownloadLocationForIndex: index]];
[fCustomLocationEnableCheck setEnabled: YES]; [self refreshCustomLocation];
[fCustomLocationPopUp setEnabled: [fCustomLocationEnableCheck state] == NSOnState];
if ([[GroupsController groups] customDownloadLocationForIndex: index])
{
NSString * location = [[GroupsController groups] customDownloadLocationForIndex: index];
ExpandedPathToPathTransformer * pathTransformer = [[[ExpandedPathToPathTransformer alloc] init] autorelease];
[[fCustomLocationPopUp itemAtIndex: 0] setTitle: [pathTransformer transformedValue: location]];
ExpandedPathToIconTransformer * iconTransformer = [[[ExpandedPathToIconTransformer alloc] init] autorelease];
[[fCustomLocationPopUp itemAtIndex: 0] setImage: [iconTransformer transformedValue: location]];
}
else
{
[[fCustomLocationPopUp itemAtIndex: 0] setTitle: @""];
[[fCustomLocationPopUp itemAtIndex: 0] setImage: nil];
}
[fAutoAssignRulesEnableCheck setState: [[GroupsController groups] usesAutoAssignRulesForIndex: index]]; [fAutoAssignRulesEnableCheck setState: [[GroupsController groups] usesAutoAssignRulesForIndex: index]];
[fAutoAssignRulesEnableCheck setEnabled: YES]; [fAutoAssignRulesEnableCheck setEnabled: YES];
@ -353,4 +337,27 @@
} }
} }
- (void) refreshCustomLocation
{
const NSInteger index = [[GroupsController groups] indexForRow: [fTableView selectedRow]];
[fCustomLocationEnableCheck setState: [[GroupsController groups] usesCustomDownloadLocationForIndex: index]];
[fCustomLocationEnableCheck setEnabled: YES];
[fCustomLocationPopUp setEnabled: [fCustomLocationEnableCheck state] == NSOnState];
if ([[GroupsController groups] customDownloadLocationForIndex: index])
{
NSString * location = [[GroupsController groups] customDownloadLocationForIndex: index];
ExpandedPathToPathTransformer * pathTransformer = [[[ExpandedPathToPathTransformer alloc] init] autorelease];
[[fCustomLocationPopUp itemAtIndex: 0] setTitle: [pathTransformer transformedValue: location]];
ExpandedPathToIconTransformer * iconTransformer = [[[ExpandedPathToIconTransformer alloc] init] autorelease];
[[fCustomLocationPopUp itemAtIndex: 0] setImage: [iconTransformer transformedValue: location]];
}
else
{
[[fCustomLocationPopUp itemAtIndex: 0] setTitle: @""];
[[fCustomLocationPopUp itemAtIndex: 0] setImage: nil];
}
}
@end @end