Commit 2d39e8f9 authored by David Fuhrmann's avatar David Fuhrmann
Browse files

macosx: robustify playlist table columns initialization

Unknown columns might occur if the prefs are written
by a newer VLC version.

close #10664
parent 5e4e1fa4
......@@ -254,7 +254,7 @@
- (IBAction)togglePlaymodeButtons:(id)sender;
- (IBAction)toggleSidebar:(id)sender;
- (IBAction)togglePlaylistColumnTable:(id)sender;
- (void)setPlaylistColumnTableState:(NSInteger)i_state forColumn:(NSString *)o_column;
- (BOOL)setPlaylistColumnTableState:(NSInteger)i_state forColumn:(NSString *)o_column;
- (NSMenu *)setupPlaylistTableColumnsMenu;
- (IBAction)quitAfterPlayback:(id)sender;
......
......@@ -751,12 +751,18 @@ static VLCMainMenu *_o_sharedInstance = nil;
[[[VLCMain sharedInstance] playlist] setColumn: o_column state: i_new_state translationDict: o_ptc_translation_dict];
}
- (void)setPlaylistColumnTableState:(NSInteger)i_state forColumn:(NSString *)o_column
- (BOOL)setPlaylistColumnTableState:(NSInteger)i_state forColumn:(NSString *)o_column
{
NSInteger i_tag = [o_ptc_menuorder indexOfObject: o_column];
NSUInteger i_tag = [o_ptc_menuorder indexOfObject: o_column];
// prevent setting unknown columns
if(i_tag == NSNotFound)
return NO;
[[o_mu_playlistTableColumns itemWithTag: i_tag] setState: i_state];
[[o_mu_playlistTableColumnsContextMenu itemWithTag: i_tag] setState: i_state];
[[[VLCMain sharedInstance] playlist] setColumn: o_column state: i_state translationDict: o_ptc_translation_dict];
return YES;
}
#pragma mark -
......
......@@ -522,7 +522,9 @@
if ([o_column isEqualToString:@"status"])
continue;
[o_menu setPlaylistColumnTableState: NSOnState forColumn: o_column];
if(![o_menu setPlaylistColumnTableState: NSOnState forColumn: o_column])
continue;
[[o_outline_view tableColumnWithIdentifier: o_column] setWidth: [[[o_columnArray objectAtIndex:i] objectAtIndex:1] floatValue]];
}
......@@ -1392,6 +1394,10 @@
NSTableColumn * o_work_tc;
if (i_state == NSOnState) {
NSString *o_title = [o_dict objectForKey:o_column];
if (!o_title)
return;
o_work_tc = [[NSTableColumn alloc] initWithIdentifier: o_column];
[o_work_tc setEditable: NO];
[[o_work_tc dataCell] setFont: [NSFont controlContentFontOfSize:11.]];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment