[vlc-commits] macosx: Move status bar xib initialization into VLCStatusBarIcon class

David Fuhrmann git at videolan.org
Sat Aug 20 17:44:34 CEST 2016


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sat Aug 20 15:08:04 2016 +0200| [bf0c43ffc7832c3ce557d66f0186a2cc6f08b541] | committer: David Fuhrmann

macosx: Move status bar xib initialization into VLCStatusBarIcon class

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

 modules/gui/macosx/VLCMain.m          | 10 +---------
 modules/gui/macosx/VLCStatusBarIcon.m | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/modules/gui/macosx/VLCMain.m b/modules/gui/macosx/VLCMain.m
index d6affd4..f4953f2 100644
--- a/modules/gui/macosx/VLCMain.m
+++ b/modules/gui/macosx/VLCMain.m
@@ -96,10 +96,6 @@ int OpenIntf (vlc_object_t *p_this)
         [VLCMain sharedInstance];
 
         [NSBundle loadNibNamed:@"MainMenu" owner:[[VLCMain sharedInstance] mainMenu]];
-        // if statusbar enabled in preferences
-        if (var_InheritBool(p_intf, "macosx-statusicon")) {
-            [NSBundle loadNibNamed:@"VLCStatusBarIconMainMenu" owner:[[VLCMain sharedInstance] statusBarIcon]];
-        }
         [[[VLCMain sharedInstance] mainWindow] makeKeyAndOrderFront:nil];
 
         msg_Dbg(p_intf, "Finished loading macosx interface");
@@ -230,11 +226,7 @@ static VLCMain *sharedInstance = nil;
         _coredialogs = [[VLCCoreDialogProvider alloc] init];
 
         _mainmenu = [[VLCMainMenu alloc] init];
-
-        // if statusbar enabled in preferences
-        if (var_InheritBool(p_intf, "macosx-statusicon")) {
-            _statusBarIcon = [[VLCStatusBarIcon  alloc] init];
-        }
+        _statusBarIcon = [[VLCStatusBarIcon  alloc] init];
 
         _voutController = [[VLCVoutWindowController alloc] init];
         _playlist = [[VLCPlaylist alloc] init];
diff --git a/modules/gui/macosx/VLCStatusBarIcon.m b/modules/gui/macosx/VLCStatusBarIcon.m
index 94689b9..e56cfad 100644
--- a/modules/gui/macosx/VLCStatusBarIcon.m
+++ b/modules/gui/macosx/VLCStatusBarIcon.m
@@ -73,6 +73,19 @@
 #pragma mark -
 #pragma mark Init
 
+
+- (instancetype)init
+{
+    self = [super init];
+
+    if (self) {
+        msg_Dbg(getIntf(), "Loading VLCStatusBarIcon");
+        [NSBundle loadNibNamed:@"VLCStatusBarIconMainMenu" owner:self];
+    }
+
+    return self;
+}
+
 - (void)awakeFromNib
 {
     [super awakeFromNib];
@@ -115,6 +128,9 @@
  */
 - (void)enableMenuIcon
 {
+    if (!var_InheritBool(getIntf(), "macosx-statusicon"))
+        return;
+
     // Init the status item
     _statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
     [_statusItem setHighlightMode:YES];



More information about the vlc-commits mailing list