[gnome-media] Fix stream volume vs. muted status problems
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-media] Fix stream volume vs. muted status problems
- Date: Tue, 22 Sep 2009 13:03:15 +0000 (UTC)
commit bda054815bcb92c9bb269c4f6c282a6238c6b059
Author: Bastien Nocera <hadess hadess net>
Date: Tue Sep 22 13:57:04 2009 +0100
Fix stream volume vs. muted status problems
We need to behave differently when we have and don't have a muted
button in the channel bar.
Only mute and unmute the channel bar on 0-level when we don't
show a mute button (status icon)
Tell front-ends of the value change when we switch between
the zero adjustment, and the normal one.
Don't unmute muted streams when raising the volume (dialogue)
Set the stream mute status before changing it in PA.
All this fixes the status icon's slider not unmuting streams, and
staying stuck to zero.
https://bugzilla.gnome.org/show_bug.cgi?id=595857
gnome-volume-control/src/gvc-channel-bar.c | 30 +++++++++++++-------
gnome-volume-control/src/gvc-mixer-dialog.c | 4 ++-
gnome-volume-control/src/gvc-stream-status-icon.c | 9 +++++-
3 files changed, 29 insertions(+), 14 deletions(-)
---
diff --git a/gnome-volume-control/src/gvc-channel-bar.c b/gnome-volume-control/src/gvc-channel-bar.c
index a9794d3..bc53344 100644
--- a/gnome-volume-control/src/gvc-channel-bar.c
+++ b/gnome-volume-control/src/gvc-channel-bar.c
@@ -411,12 +411,14 @@ on_scale_button_release_event (GtkWidget *widget,
value = gtk_adjustment_get_value (adj);
- /* this means the adjustment moved away from zero and
- therefore we should unmute and set the volume. */
- if (value > 0)
- gvc_channel_bar_set_is_muted (bar, FALSE);
- else
- gvc_channel_bar_set_is_muted (bar, TRUE);
+ if (bar->priv->show_mute == FALSE) {
+ /* this means the adjustment moved away from zero and
+ * therefore we should unmute and set the volume. */
+ if (value > 0)
+ gvc_channel_bar_set_is_muted (bar, FALSE);
+ else
+ gvc_channel_bar_set_is_muted (bar, TRUE);
+ }
/* Play a sound! */
ca_gtk_play_for_widget (GTK_WIDGET (bar), 0,
@@ -490,10 +492,12 @@ on_zero_adjustment_value_changed (GtkAdjustment *adjustment,
value = gtk_adjustment_get_value (bar->priv->zero_adjustment);
gtk_adjustment_set_value (bar->priv->adjustment, value);
- /* this means the adjustment moved away from zero and
- therefore we should unmute and set the volume. */
- gvc_channel_bar_set_is_muted (bar, FALSE);
+ if (bar->priv->show_mute == FALSE) {
+ /* this means the adjustment moved away from zero and
+ * therefore we should unmute and set the volume. */
+ gvc_channel_bar_set_is_muted (bar, value > 0.0);
+ }
}
static void
@@ -520,9 +524,11 @@ update_mute_button (GvcChannelBar *bar)
gtk_range_set_adjustment (GTK_RANGE (bar->priv->scale),
bar->priv->zero_adjustment);
} else {
- /* no longer muted so restore the original adjustment */
+ /* no longer muted so restore the original adjustment
+ * and tell the front-end that the value changed */
gtk_range_set_adjustment (GTK_RANGE (bar->priv->scale),
bar->priv->adjustment);
+ gtk_adjustment_value_changed (bar->priv->adjustment);
}
}
}
@@ -534,9 +540,11 @@ gvc_channel_bar_set_is_muted (GvcChannelBar *bar,
g_return_if_fail (GVC_IS_CHANNEL_BAR (bar));
if (is_muted != bar->priv->is_muted) {
+ /* Update our internal state before telling the
+ * front-end about our changes */
bar->priv->is_muted = is_muted;
- g_object_notify (G_OBJECT (bar), "is-muted");
update_mute_button (bar);
+ g_object_notify (G_OBJECT (bar), "is-muted");
}
}
diff --git a/gnome-volume-control/src/gvc-mixer-dialog.c b/gnome-volume-control/src/gvc-mixer-dialog.c
index 0be5e33..ffeba97 100644
--- a/gnome-volume-control/src/gvc-mixer-dialog.c
+++ b/gnome-volume-control/src/gvc-mixer-dialog.c
@@ -659,7 +659,9 @@ on_adjustment_value_changed (GtkAdjustment *adjustment,
g_free (name);
/* FIXME would need to do that in the balance bar really... */
- gvc_mixer_stream_set_is_muted (stream, volume == 0);
+ /* Make sure we do not unmute muted streams, there's a button for that */
+ if (volume == 0.0)
+ gvc_mixer_stream_set_is_muted (stream, TRUE);
/* Only push the volume if it's actually changed */
if (gvc_mixer_stream_set_volume(stream, (pa_volume_t) rounded) != FALSE)
gvc_mixer_stream_push_volume (stream);
diff --git a/gnome-volume-control/src/gvc-stream-status-icon.c b/gnome-volume-control/src/gvc-stream-status-icon.c
index 37131ea..9185f1a 100644
--- a/gnome-volume-control/src/gvc-stream-status-icon.c
+++ b/gnome-volume-control/src/gvc-stream-status-icon.c
@@ -617,8 +617,13 @@ on_bar_is_muted_notify (GObject *object,
gboolean is_muted;
is_muted = gvc_channel_bar_get_is_muted (GVC_CHANNEL_BAR (object));
- gvc_mixer_stream_change_is_muted (icon->priv->mixer_stream,
- is_muted);
+
+ if (gvc_mixer_stream_get_is_muted (icon->priv->mixer_stream) != is_muted) {
+ /* Update the stream before pushing the change */
+ gvc_mixer_stream_set_is_muted (icon->priv->mixer_stream, is_muted);
+ gvc_mixer_stream_change_is_muted (icon->priv->mixer_stream,
+ is_muted);
+ }
}
static GObject *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]