UI: Fix table column duplication and other mess, due to saved application state
parent
934bdc9b35
commit
9e6199b108
|
@ -29,7 +29,20 @@
|
|||
NSFont *f = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:s]];
|
||||
// NSFont *bf = [[NSFontManager sharedFontManager] convertFont:f toHaveTrait:NSBoldFontMask];
|
||||
|
||||
for (NSTableColumn *col in [self tableColumns]) {
|
||||
NSArray<NSTableColumn *> *columns = [[NSSet setWithArray:[self tableColumns]] allObjects];
|
||||
|
||||
if ([columns count] < [[self tableColumns] count]) {
|
||||
// borkage in saved state
|
||||
NSArray<NSTableColumn *> *borkCols = [[self tableColumns] copy];
|
||||
for (NSTableColumn *col in borkCols) {
|
||||
[self removeTableColumn:col];
|
||||
}
|
||||
for (NSTableColumn *col in columns) {
|
||||
[self addTableColumn:col];
|
||||
}
|
||||
}
|
||||
|
||||
for (NSTableColumn *col in columns) {
|
||||
[[col dataCell] setControlSize:s];
|
||||
[[col dataCell] setFont:f];
|
||||
}
|
||||
|
@ -57,7 +70,7 @@
|
|||
|
||||
int visibleTableColumns = 0;
|
||||
int menuIndex = 0;
|
||||
for (NSTableColumn *col in [[self tableColumns] sortedArrayUsingDescriptors:sortDescriptors]) {
|
||||
for (NSTableColumn *col in [columns sortedArrayUsingDescriptors:sortDescriptors]) {
|
||||
NSString *title;
|
||||
if ([[col identifier] isEqualToString:@"status"]) {
|
||||
title = @"Status";
|
||||
|
@ -82,7 +95,7 @@
|
|||
}
|
||||
|
||||
if (visibleTableColumns == 0) {
|
||||
for (NSTableColumn *col in [self tableColumns]) {
|
||||
for (NSTableColumn *col in columns) {
|
||||
[col setHidden:NO];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue