Commit d4ec3a04 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: fix playlist column creation and customization

parent 68827bcd
......@@ -81,32 +81,6 @@
#pragma mark - Initialization
- (id)init
{
self = [super init];
if (self) {
_translationsForPlaylistTableColumns = [[NSDictionary alloc] initWithObjectsAndKeys:
_NS("Track Number"), TRACKNUM_COLUMN,
_NS("Title"), TITLE_COLUMN,
_NS("Author"), ARTIST_COLUMN,
_NS("Duration"), DURATION_COLUMN,
_NS("Genre"), GENRE_COLUMN,
_NS("Album"), ALBUM_COLUMN,
_NS("Description"), DESCRIPTION_COLUMN,
_NS("Date"), DATE_COLUMN,
_NS("Language"), LANGUAGE_COLUMN,
_NS("URI"), URI_COLUMN,
_NS("File Size"), FILESIZE_COLUMN,
nil];
// this array also assigns tags (index) to type of menu item
_menuOrderOfPlaylistTableColumns = [[NSArray alloc] initWithObjects: TRACKNUM_COLUMN, TITLE_COLUMN,
ARTIST_COLUMN, DURATION_COLUMN, GENRE_COLUMN, ALBUM_COLUMN,
DESCRIPTION_COLUMN, DATE_COLUMN, LANGUAGE_COLUMN, URI_COLUMN,
FILESIZE_COLUMN,nil];
}
return self;
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
......@@ -127,6 +101,25 @@
[self setRateControlsEnabled:NO];
_translationsForPlaylistTableColumns = [[NSDictionary alloc] initWithObjectsAndKeys:
_NS("Track Number"), TRACKNUM_COLUMN,
_NS("Title"), TITLE_COLUMN,
_NS("Author"), ARTIST_COLUMN,
_NS("Duration"), DURATION_COLUMN,
_NS("Genre"), GENRE_COLUMN,
_NS("Album"), ALBUM_COLUMN,
_NS("Description"), DESCRIPTION_COLUMN,
_NS("Date"), DATE_COLUMN,
_NS("Language"), LANGUAGE_COLUMN,
_NS("URI"), URI_COLUMN,
_NS("File Size"), FILESIZE_COLUMN,
nil];
// this array also assigns tags (index) to type of menu item
_menuOrderOfPlaylistTableColumns = [[NSArray alloc] initWithObjects: TRACKNUM_COLUMN, TITLE_COLUMN,
ARTIST_COLUMN, DURATION_COLUMN, GENRE_COLUMN, ALBUM_COLUMN,
DESCRIPTION_COLUMN, DATE_COLUMN, LANGUAGE_COLUMN, URI_COLUMN,
FILESIZE_COLUMN,nil];
#ifdef HAVE_SPARKLE
[_checkForUpdate setAction:@selector(checkForUpdates:)];
[_checkForUpdate setTarget:[SUUpdater sharedUpdater]];
......@@ -376,7 +369,7 @@
[_toggleEffectsButton setState: config_GetInt(VLCIntf, "macosx-show-effects-button")];
[_toggleSidebar setTitle: _NS("Show Sidebar")];
[_toggleSidebar setState: config_GetInt(VLCIntf, "macosx-show-sidebar")];
[_playlistTableColumnsMenu setTitle: _NS("Playlist Table Columns")];
[self setupPlaylistTableColumnsForMenu:_playlistTableColumnsMenu];
[_playlistTableColumns setTitle: _NS("Playlist Table Columns")];
[_controlsMenu setTitle: _NS("Playback")];
......@@ -513,20 +506,17 @@
- (NSMenu *)setupPlaylistTableColumnsMenu
{
NSMenu *contextMenu = [[NSMenu alloc] init];
[self setupPlaylistTableColumnsForMenu:contextMenu];
return contextMenu;
}
- (void)setupPlaylistTableColumnsForMenu:(NSMenu *)menu
{
NSMenuItem *menuItem;
NSUInteger count = [_menuOrderOfPlaylistTableColumns count];
for (NSUInteger i = 0; i < count; i++) {
NSString *title = [_translationsForPlaylistTableColumns objectForKey:[_menuOrderOfPlaylistTableColumns objectAtIndex:i]];
menuItem = [_playlistTableColumnsMenu addItemWithTitle:title
action:@selector(togglePlaylistColumnTable:)
keyEquivalent:@""];
/* don't set a valid target for the title column selector, since we want it to be disabled */
if (![[_menuOrderOfPlaylistTableColumns objectAtIndex:i] isEqualToString: TITLE_COLUMN])
[menuItem setTarget:self];
[menuItem setTag:i];
menuItem = [contextMenu addItemWithTitle:title
menuItem = [menu addItemWithTitle:title
action:@selector(togglePlaylistColumnTable:)
keyEquivalent:@""];
/* don't set a valid target for the title column selector, since we want it to be disabled */
......@@ -534,9 +524,6 @@
[menuItem setTarget:self];
[menuItem setTag:i];
}
if (!_playlistTableColumnsContextMenu)
_playlistTableColumnsContextMenu = contextMenu;
return contextMenu;
}
#pragma mark - Termination
......
......@@ -202,6 +202,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"NO" forKey:@"LiveUpdateTheMessagesPanel"];
[defaults registerDefaults:appDefaults];
_mainmenu = [[VLCMainMenu alloc] init];
_voutController = [[VLCVoutWindowController alloc] init];
}
......@@ -224,7 +225,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
[NSBundle loadNibNamed:@"MainWindow" owner:self];
[[self mainWindow] makeKeyAndOrderFront:nil];
_open = [[VLCOpen alloc] init];
_mainmenu = [[VLCMainMenu alloc] init];
_coreinteraction = [VLCCoreInteraction sharedInstance];
playlist_t * p_playlist = pl_Get(VLCIntf);
......
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