Make finding the history/commit selector more robust.

Shouldn't assume that the selector is the first item in the toolbar; the user
could have moved it.
This commit is contained in:
Owen Yamauchi
2009-01-29 23:19:00 -05:00
committed by Johannes Gilger
parent e5104b4069
commit 64dfd99089
+7 -1
View File
@@ -112,7 +112,13 @@
- (void) useToolbar:(NSToolbar *)toolbar
{
NSSegmentedControl *item = (NSSegmentedControl *)[[[toolbar items] objectAtIndex:0] view];
NSSegmentedControl *item = nil;
for (NSToolbarItem *toolbarItem in [toolbar items]) {
if ([[toolbarItem view] isKindOfClass:[NSSegmentedControl class]]) {
item = (NSSegmentedControl *)[toolbarItem view];
break;
}
}
[item bind:@"selectedIndex" toObject:self withKeyPath:@"selectedViewIndex" options:0];
[self.window setToolbar:toolbar];