[vlc-commits] macosx: Improve VLCStatusBarIcon class

epirat07@gmail.com git at videolan.org
Sun May 8 19:58:07 CEST 2016


vlc | branch: master | epirat07 at gmail.com <epirat07 at gmail.com> | Sun May  8 01:45:26 2016 +0200| [3ba702e21c6e180bf8a94ac04edf3a50b53f05be] | committer: Jean-Baptiste Kempf

macosx: Improve VLCStatusBarIcon class

Use actual references to the MenuItems instead of finding them using tags.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/macosx/VLCStatusBarIcon.m |   12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/modules/gui/macosx/VLCStatusBarIcon.m b/modules/gui/macosx/VLCStatusBarIcon.m
index ee8f47d..f9e3484 100644
--- a/modules/gui/macosx/VLCStatusBarIcon.m
+++ b/modules/gui/macosx/VLCStatusBarIcon.m
@@ -35,9 +35,6 @@
 #pragma mark -
 #pragma mark Defines
 
-#define playPauseMenuItemTag 74747
-#define stopMenuItemTag 83838
-#define randomMenuItemTag 63636
 #define dataUpdateTimerInterval 1.0
 #define NSInitialToolTipDelayIn_ms 20
 // #define showURLInToolTip 1
@@ -123,8 +120,7 @@
     _menuImagePause = [NSImage imageNamed:@"pauseIcon"];
 
     _menuImageStop = [NSImage imageNamed:@"stopIcon"];
-    NSMenuItem *menuItemToChange = [_vlcStatusBarIconMenu itemWithTag:stopMenuItemTag];
-    [menuItemToChange setImage:_menuImageStop];
+    [stopItem setImage:_menuImageStop];
 
     // I'd rather not use a timer and only update when mouse comes near
     // status icon in bar. But one can't tell without evil sourcery :(
@@ -314,12 +310,10 @@
     playlist_t *p_playlist = pl_Get(getIntf());
     b_value = var_GetBool(p_playlist, "random");
 
-    // get menuitem 'Random'
-    NSMenuItem* menuItemToChange = [_vlcStatusBarIconMenu itemWithTag:randomMenuItemTag];
     if (b_value) {
-        [menuItemToChange setState:NSOnState];
+        [randItem setState:NSOnState];
     } else {
-        [menuItemToChange setState:NSOffState];
+        [randItem setState:NSOffState];
     }
 }
 



More information about the vlc-commits mailing list