[vlc-commits] macosx: Fix initialization of VLCPlaylist object

David Fuhrmann git at videolan.org
Sat Jan 2 23:01:45 CET 2016


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sat Jan  2 22:55:09 2016 +0100| [2c83415d9c37451ab2884302e7beb015eba78453] | committer: David Fuhrmann

macosx: Fix initialization of VLCPlaylist object

This is not loaded from a xib anymore, but rather manually.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2c83415d9c37451ab2884302e7beb015eba78453
---

 modules/gui/macosx/VLCPlaylist.m |   36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/modules/gui/macosx/VLCPlaylist.m b/modules/gui/macosx/VLCPlaylist.m
index 16d3c54..2bc33f3 100644
--- a/modules/gui/macosx/VLCPlaylist.m
+++ b/modules/gui/macosx/VLCPlaylist.m
@@ -74,7 +74,6 @@
     NSTableColumn *_sortTableColumn;
 
     BOOL b_playlistmenu_nib_loaded;
-    BOOL b_view_setup;
 
     PLModel *_model;
 }
@@ -84,6 +83,22 @@
 
 @implementation VLCPlaylist
 
+- (id)init
+{
+    self = [super init];
+    if (self) {
+        /* This uses a private API, but works fine on all current OSX releases.
+         * Radar ID 11739459 request a public API for this. However, it is probably
+         * easier and faster to recreate similar looking bitmaps ourselves. */
+        _ascendingSortingImage = [[NSOutlineView class] _defaultTableHeaderSortImage];
+        _descendingSortingImage = [[NSOutlineView class] _defaultTableHeaderReverseSortImage];
+
+        [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(applicationWillTerminate:) name: NSApplicationWillTerminateNotification object: nil];
+
+    }
+    return self;
+}
+
 + (void)initialize
 {
     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
@@ -126,23 +141,8 @@
 
 - (void)awakeFromNib
 {
-    if (b_view_setup)
-        return;
-
-    [self reloadStyles];
+    // This is only called for the playlist popup menu
     [self initStrings];
-
-    /* This uses a private API, but works fine on all current OSX releases.
-     * Radar ID 11739459 request a public API for this. However, it is probably
-     * easier and faster to recreate similar looking bitmaps ourselves. */
-    _ascendingSortingImage = [[NSOutlineView class] _defaultTableHeaderSortImage];
-    _descendingSortingImage = [[NSOutlineView class] _defaultTableHeaderReverseSortImage];
-
-    _sortTableColumn = nil;
-
-    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(applicationWillTerminate:) name: NSApplicationWillTerminateNotification object: nil];
-
-    b_view_setup = YES;
 }
 
 - (void)setOutlineView:(VLCPlaylistView * __nullable)outlineView
@@ -162,6 +162,8 @@
     [_outlineView setAllowsEmptySelection: NO];
     [_outlineView registerForDraggedTypes: [NSArray arrayWithObjects:NSFilenamesPboardType, @"VLCPlaylistItemPboardType", nil]];
     [_outlineView setIntercellSpacing: NSMakeSize (0.0, 1.0)];
+
+    [self reloadStyles];
 }
 
 - (void)setPlaylistHeaderView:(NSTableHeaderView * __nullable)playlistHeaderView



More information about the vlc-commits mailing list