Commit graph

18 commits

Author SHA1 Message Date
Lukáš Tyrychtr
89e3041ebc sound: When setting mixer control for a stream row, update muted state as well
We were updating the volume state, but not the mute one, so, do both.

Fixes #2749
2023-11-15 15:28:20 +00:00
Lukáš Tyrychtr
92b0d54f11 sound: Fix accessibility issues for the mute button
This does the following:
* Replaces the a11y label by a tooltip
* Reflects what will happen when the button is pressed

Fixes #2750
2023-11-13 12:49:04 +00:00
Marco Melorio
ea0e2cf308 sound: Remove modelines at the top of the files
They are not even correct and make GNOME Builder to use 8 space
identation by default.
2023-01-16 20:53:56 +01:00
Marco Melorio
2fbbe0f60d sound: Use a microphone icon for input in CcVolumeSlider
There was some code that attempted to do that, but was incorrect.

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1762.
2023-01-15 20:07:04 +01:00
Marco Melorio
ca553bd377 sound: Make mute button in CcVolumeSlider more consistent
When pressing the mute button after the volume slider is manually moved
to 0 (and so the GVS "is-muted" property is still FALSE), set the volume
to 25% instead of actually muting the stream.

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/520.
2023-01-15 19:56:10 +01:00
Marco Melorio
7fddfa363f sound: Port the mute button in the CcVolumeSlider to GtkButton
The logic inside it is a bit reworked to make it more consistent. The
mute button and the slider now only communicate directly with GVC. The
notify callbacks are now used to change the UI states.

This fixes the UI problem of the mute button being "raised" when pressed
(see https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/520).
2023-01-15 19:44:23 +01:00
Marco Melorio
62ae77ce29 sound: Make CcVolumeSlider subclass from GtkWidget 2023-01-09 21:03:41 +00:00
Bilal Elmoussaoui
bb86c36147 panels: Use icon-name property instead
Don't embed a custom GtkImage as that would lack the appropriate style
classes
that GtkButton/GtkMenuButton would automatically add for us
2022-07-20 14:15:57 +02:00
Georges Basile Stavracas Neto
a719008403 sound: Port to GTK4 2021-12-14 22:34:21 -03:00
Hui Wang
0f18a662be sound: update the volume-slider after getting a valid stream
In the ubuntu 20.04, we met an issue about the output volume-slider
on the machine with the legacy HDA audio driver, the output device
is the Speaker first (analog-stereo pa sink), then we connect a hdmi
monitor, the HDMI audio is in the output combo-box, we select the
hdmi audio (hdmi-stereo pa sink) from the combo-box, the hdmi audio
becomes the active output device now, we adjust the output volume from
the volume-slider, the slider UI is changed, but the output sound
is not changed with the UI.

The root cause is when the speaker is active, the pulseaudio only
keeps the analog-stereo sink, the sink hdmi-stereo is unlinked, when
users select the hdmi audio from UI, the pulseaudio will unlink
analo-stereo sink and create hdmi-stereo sink, but before hdmi-stereo
is created, the output_device_changed_cb() is called and
gvc_mixer_control_get_stream_from_device() returns a NULL since the
hdmi-stereo sink is not created yet in the pulseaudio. Because stream
is NULL, the output_volume_slider->stream is NULL, users can't change
the output volume via the volume-slider.

To fix it, we add a output_volume_slider->stream check in the
device_update_cb(), if it is NULL, get the stream and set it to
volume-slider. In this function, the sink hdmi-stereo is created
already, so the stream is not NULL. And this change also applies to
input as well.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2021-08-01 22:12:11 +00:00
Benjamin Berg
a87dee7911 sound: Update mute button icon when volume changes
The icon on the mute button needs to be updated whenever the volume is
changed (externally). Add the appropriate call too notify_volume_cb.

Fixes: #1268
2021-02-21 15:30:40 +00:00
Benjamin Berg
4b8ff9f6f3 sound: Include zero volume in lowest volume icon
If changed externally at least, the volume can be zero while unmuted.
Just use the lowest volume icon in that case by including it in the
range.

It does not make sense to use the muted icon, as we are not technically
muted and the toggle button is not active.
2021-02-21 15:30:39 +00:00
Felipe Borges
4180e75aad sound: Set audio icon based on volume
The same way that GNOME Shell does it, we set:
 * audio-volume-muted-symbolic when mute button is toggled*
 * audio-volume-low-symbolic when 0 < volume < 30%
 * audio-volume-medium-symbolic when 30% < volume < 70%
 * audio-volume-high-symbolic when 70% < volume <= 100%

When "muted" we can't actually rely on volume (it can be close
to zero but not absolute zero). Instead of requiring volume == 0,
we track the state based on whether the mute button is active.

Fixes #521
2019-12-18 12:00:02 +01:00
Mart Raudsepp
389e7f59ae sound: Remove leftover canberra-gtk header inclusion
This may fail to build too, as we don't depend on canberra-gtk anymore,
and gsound only depends on canberra, not canberra-gtk.
2019-09-20 08:50:26 +03:00
Iain Lane
ad39840066 sound: Pass a GvcMixerControl to the stream volume sliders
Since 9d612ff1c7 this is required,
otherwise we never set up the GtkAdjustment and so the scales don't
display any values or widget to make adjustments, meaning they can't be
used.

Also call `notify_volume_cb()` from `update_ranges()` to initialise the
adjustment, since when we set the mixer control we now might not have
set the value.

Closes #652
2019-09-09 15:23:32 +00:00
Robert Ancell
9d612ff1c7 sound: Fix volume sliders regression
GVC added additional checks that break where we were using a NULL value instead
of a GvcMixerControl. Solution is to pass this object where appropriate.

(gnome-control-center:833): Gvc-CRITICAL **: 11:09:33.818: gvc_mixer_control_get_vol_max_norm: assertion 'GVC_IS_MIXER_CONTROL (control)' failed

Fixes #636
2019-08-25 09:51:31 +00:00
Jordan Petridis
b542e98359 sounds: Use correct mute icon in the input section
The current code does not differenciate between input and
output, and thus it shows the same icon for muting outputs
and inputs. As per design suggesion [1], the input row
should use the "microphone-sensitivity-muted-symbolic" icon.

In order to achieve that, move the CcLevelBarStreamType enum
to a separate header, and rename it to CcStreamType. And also
pass the stream type to the volume slider.

In CcVolumeSlider, update the code to switch to the correct
mute icon depending on the stream type.

[1] https://gitlab.gnome.org/GNOME/gnome-control-center/issues/539

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/issues/539
2019-06-16 01:01:36 +00:00
Robert Ancell
0799c864e8 sound: Rename new sound panel to replace old one 2019-02-07 09:31:18 +13:00
Renamed from panels/sound-new/cc-volume-slider.c (Browse further)