[gnome-control-center] sound: Prevent > 100% volume showing up as 100%



commit ce561eb68f43a5f38cfe4e87433b716264c4f462
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Apr 8 16:12:56 2011 +0100

    sound: Prevent > 100% volume showing up as 100%
    
    When the output of input bar changes from a non-decibel capable
    output, to one that is (such as on startup), don't clip the
    volume displayed at 100%, by setting the level of the bar again.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=646254

 panels/sound/gvc-mixer-dialog.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/panels/sound/gvc-mixer-dialog.c b/panels/sound/gvc-mixer-dialog.c
index 84c7e00..56d0832 100644
--- a/panels/sound/gvc-mixer-dialog.c
+++ b/panels/sound/gvc-mixer-dialog.c
@@ -232,6 +232,7 @@ update_output_settings (GvcMixerDialog *dialog)
         GvcMixerStream      *stream;
         const GvcChannelMap *map;
         const GList         *ports;
+        GtkAdjustment       *adj;
 
         g_debug ("Updating output settings");
         if (dialog->priv->output_balance_bar != NULL) {
@@ -266,6 +267,12 @@ update_output_settings (GvcMixerDialog *dialog)
         gvc_channel_bar_set_is_amplified (GVC_CHANNEL_BAR (dialog->priv->output_bar),
                                           gvc_mixer_stream_get_can_decibel (stream));
 
+	/* Update the adjustment in case the previous bar wasn't decibel
+	 * capable, and we clipped it */
+        adj = GTK_ADJUSTMENT (gvc_channel_bar_get_adjustment (GVC_CHANNEL_BAR (dialog->priv->output_bar)));
+	gtk_adjustment_set_value (adj,
+				  gvc_mixer_stream_get_volume (stream));
+
         map = gvc_mixer_stream_get_channel_map (stream);
         if (map == NULL) {
                 g_warning ("Default sink stream has no channel map");
@@ -586,8 +593,9 @@ stop_monitor_stream_for_source (GvcMixerDialog *dialog)
 static void
 update_input_settings (GvcMixerDialog *dialog)
 {
-        const GList *ports;
+        const GList    *ports;
         GvcMixerStream *stream;
+        GtkAdjustment  *adj;
 
         g_debug ("Updating input settings");
 
@@ -610,6 +618,12 @@ update_input_settings (GvcMixerDialog *dialog)
         gvc_channel_bar_set_is_amplified (GVC_CHANNEL_BAR (dialog->priv->input_bar),
                                           gvc_mixer_stream_get_can_decibel (stream));
 
+	/* Update the adjustment in case the previous bar wasn't decibel
+	 * capable, and we clipped it */
+        adj = GTK_ADJUSTMENT (gvc_channel_bar_get_adjustment (GVC_CHANNEL_BAR (dialog->priv->input_bar)));
+	gtk_adjustment_set_value (adj,
+				  gvc_mixer_stream_get_volume (stream));
+
         ports = gvc_mixer_stream_get_ports (stream);
         if (ports != NULL) {
                 const GvcMixerStreamPort *port;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]