[vlc-commits] macosx: Improve creation of sidebar items
David Fuhrmann
git at videolan.org
Fri Nov 6 08:06:35 CET 2020
vlc/vlc-3.0 | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Fri Nov 6 07:52:54 2020 +0100| [57a0ec167dc9097faa5439d428f531c829c65579] | committer: David Fuhrmann
macosx: Improve creation of sidebar items
Respect that the header and cell are two different classes.
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=57a0ec167dc9097faa5439d428f531c829c65579
---
modules/gui/macosx/VLCMainWindow.m | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/modules/gui/macosx/VLCMainWindow.m b/modules/gui/macosx/VLCMainWindow.m
index d4c18b561c..84d33a5ed4 100644
--- a/modules/gui/macosx/VLCMainWindow.m
+++ b/modules/gui/macosx/VLCMainWindow.m
@@ -1100,19 +1100,24 @@ static const float f_min_window_height = 307.;
- (NSView *)sourceList:(PXSourceList *)aSourceList viewForItem:(id)item
{
- VLCSourceListTableCellView *cellView = nil;
- if ([aSourceList levelForItem:item] == 0)
- cellView = [aSourceList makeViewWithIdentifier:@"HeaderCell" owner:nil];
- else
- cellView = [aSourceList makeViewWithIdentifier:@"DataCell" owner:nil];
-
PXSourceListItem *sourceListItem = item;
+ if ([aSourceList levelForItem:item] == 0) {
+ PXSourceListTableCellView *cellView = [aSourceList makeViewWithIdentifier:@"HeaderCell" owner:nil];
+
+ cellView.textField.editable = NO;
+ cellView.textField.selectable = NO;
+ cellView.textField.stringValue = sourceListItem.title ? sourceListItem.title : @"";
+
+ return cellView;
+ }
+
+ VLCSourceListTableCellView * cellView = [aSourceList makeViewWithIdentifier:@"DataCell" owner:nil];
+
cellView.textField.editable = NO;
cellView.textField.selectable = NO;
-
cellView.textField.stringValue = sourceListItem.title ? sourceListItem.title : @"";
- cellView.imageView.image = [item icon];
+ cellView.imageView.image = [sourceListItem icon];
// Badge count
{
@@ -1120,9 +1125,9 @@ static const float f_min_window_height = 307.;
playlist_item_t *p_pl_item = NULL;
NSInteger i_playlist_size = 0;
- if ([[item identifier] isEqualToString: @"playlist"]) {
+ if ([[sourceListItem identifier] isEqualToString: @"playlist"]) {
p_pl_item = p_playlist->p_playing;
- } else if ([[item identifier] isEqualToString: @"medialibrary"]) {
+ } else if ([[sourceListItem identifier] isEqualToString: @"medialibrary"]) {
p_pl_item = p_playlist->p_media_library;
}
More information about the vlc-commits
mailing list