[vlc-commits] macosx/MainWindow: fixed mute toggle and removed some minor code duplication

Felix Paul Kühne git at videolan.org
Sat Aug 25 12:35:23 CEST 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sat Aug 25 11:47:55 2012 +0200| [87b64a6b27dd3b292845c4cfa0f072fe724d80dd] | committer: Felix Paul Kühne

macosx/MainWindow: fixed mute toggle and removed some minor code duplication

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

 modules/gui/macosx/CoreInteraction.h |    1 +
 modules/gui/macosx/CoreInteraction.m |    9 +++++++++
 modules/gui/macosx/MainWindow.m      |    7 ++-----
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/modules/gui/macosx/CoreInteraction.h b/modules/gui/macosx/CoreInteraction.h
index 0f237f0..066a109 100644
--- a/modules/gui/macosx/CoreInteraction.h
+++ b/modules/gui/macosx/CoreInteraction.h
@@ -64,6 +64,7 @@
 
 - (void)volumeUp;
 - (void)volumeDown;
+- (void)toggleMute;
 
 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;
 
diff --git a/modules/gui/macosx/CoreInteraction.m b/modules/gui/macosx/CoreInteraction.m
index cb79dbf..43e0d94 100644
--- a/modules/gui/macosx/CoreInteraction.m
+++ b/modules/gui/macosx/CoreInteraction.m
@@ -446,6 +446,15 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
     aout_VolumeDown( pl_Get( p_intf ), 1, NULL );
 }
 
+- (void)toggleMute
+{
+    intf_thread_t *p_intf = VLCIntf;
+    if( !p_intf )
+        return;
+
+    aout_MuteToggle( pl_Get( p_intf ) );
+}
+
 - (void)setMute:(BOOL)b_value
 {
     intf_thread_t *p_intf = VLCIntf;
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index c0aa080..d6bda9f 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -1204,9 +1204,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
     if (sender == o_volume_sld)
         [[VLCCoreInteraction sharedInstance] setVolume: [sender intValue]];
     else if (sender == o_volume_down_btn)
-    {
-        [[VLCCoreInteraction sharedInstance] setMute: YES];
-    }
+        [[VLCCoreInteraction sharedInstance] toggleMute];
     else
         [[VLCCoreInteraction sharedInstance] setVolume: AOUT_VOLUME_MAX];
 }
@@ -1568,8 +1566,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
 
 - (void)updateVolumeSlider
 {
-    playlist_t * p_playlist = pl_Get( VLCIntf );
-    int i_volume = lroundf(aout_VolumeGet( p_playlist ) * AOUT_VOLUME_DEFAULT);
+    int i_volume = [[VLCCoreInteraction sharedInstance] volume];
     BOOL b_muted = [[VLCCoreInteraction sharedInstance] mute];
 
     if( !b_muted )



More information about the vlc-commits mailing list