diff options
author | Stefano Karapetsas <[email protected]> | 2014-01-28 11:10:14 +0100 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2014-01-28 11:10:14 +0100 |
commit | e26d41560bacf9f84846a754b356acc91582fb42 (patch) | |
tree | ac37c60cc858ff39bcebd40b00efa2da02ab9ade | |
parent | a1a20e1e15edf896c6daf677ea839f043f210057 (diff) | |
download | mate-media-e26d41560bacf9f84846a754b356acc91582fb42.tar.bz2 mate-media-e26d41560bacf9f84846a754b356acc91582fb42.tar.xz |
pulse: Middle click on applet toggles mute state
Closes #20
https://github.com/mate-desktop/mate-media/issues/20
-rw-r--r-- | mate-volume-control/src/gvc-stream-status-icon.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mate-volume-control/src/gvc-stream-status-icon.c b/mate-volume-control/src/gvc-stream-status-icon.c index ce13a83..dcf483d 100644 --- a/mate-volume-control/src/gvc-stream-status-icon.c +++ b/mate-volume-control/src/gvc-stream-status-icon.c @@ -217,6 +217,22 @@ on_status_icon_activate (GtkStatusIcon *status_icon, popup_dock (icon, GDK_CURRENT_TIME); } +static gboolean +on_status_icon_button_press (GtkStatusIcon *status_icon, + GdkEventButton *event, + GvcStreamStatusIcon *icon) +{ + /* middle click acts as mute/unmute */ + if (event->button == 2) { + gboolean is_muted; + is_muted = gvc_mixer_stream_get_is_muted (icon->priv->mixer_stream); + gvc_mixer_stream_set_is_muted (icon->priv->mixer_stream, !is_muted); + gvc_mixer_stream_change_is_muted (icon->priv->mixer_stream, !is_muted); + return TRUE; + } + return FALSE; +} + static void on_menu_mute_toggled (GtkMenuItem *item, GvcStreamStatusIcon *icon) @@ -791,6 +807,10 @@ gvc_stream_status_icon_init (GvcStreamStatusIcon *icon) G_CALLBACK (on_status_icon_activate), icon); g_signal_connect (icon, + "button-press-event", + G_CALLBACK (on_status_icon_button_press), + icon); + g_signal_connect (icon, "popup-menu", G_CALLBACK (on_status_icon_popup_menu), icon); |