Commit graph

288 commits

Author SHA1 Message Date
Jonas Dreßler
3aeb837cb0 sound: Set input/output meter stream to NULL when there's no active device
When there's no active input or output device, the input/output meter shouldn't
have a stream set, so call set_input_stream() with a NULL stream
(cc_volume_slider_set_stream() and cc_level_bar_set_stream() are already handling
NULL as expected) in case there's no active input or output device.

This fixes a bug where the input/output meter doesn't get updated when the active
input or output device gets unset.
2024-03-12 08:33:58 +00:00
Jonas Dreßler
afec106a8b sound: Unset active entry on the device comboBox when there's no active device
When gvc gives us an active-input/output-device ID we don't know or sets the ID
to 0, that means there's no device currently active. While this seems unlikely
to be the case without the device getting removed at the same time, it can happen:
When the bluetooth profile gets changed from handset (input+output) to
headphone (output only), the input device remains available, but there's no
more active-input-device anymore.

In this case, we shouldn't leave the active entry on the device combo box as-is,
instead we should set it to NULL to indicate that no input device is set.

This fixes a bug where the input switcher is not updated when there's no
internal microphone but there's a bluetooth headset connected, and the
bluetooth profile gets switched from Handset to Headphone.
2024-03-12 08:33:58 +00:00
Jonas Dreßler
bf6f72278e sound: Update active-device UI on signals from gvc, not on combo box changes
Gvc is the actual "source of truth" when it comes to the currently active input
or output device, so we should update widget visibility and the input/output
meter stream based on the information from gvc, not on changes to the combo box.

The flow when the selects a different device in the combo box now is:
"user change" -> gvc_mixer_control_change_output() -> receive
"active-output-changed" signal from gvc -> update active device and get it
using the DeviceComboBox -> set widget visibility and update stream based
on this device.

This fixes a few bugs where the stream for the input/output meter wouldn't
get updated properly on active device changes.
2024-03-12 08:33:58 +00:00
Jonas Dreßler
a74bc5a84d sound: Block our own signal handlers while updating the active-device combo box
When we get notified of an "active-input/output-device" change by gvc, we have
to update our respective combo box to reflect that change. Obviously, this in
turn shouldn't trigger our own signal handler for changes on that combo box,
that signal handler is only meant to handle the user interacting with the combo
box.

So block our signal handlers when we update the combo box to respond to changes
from the gvc side.

This fixes a recursive call to gvc_mixer_control_change_input/output() when we
get notified about an input/output change from gvc itself.
2024-03-12 08:33:58 +00:00
Jonas Dreßler
2152899354 sound: Listen to signals from GvcMixerControl only in sound panel
We should only listen to "active-input-update" and "active-output-update" in
one place, and then update the combo box from there. This way we can block our
own signal handler for input/output device changes on the combo box, which
we'll do in the next commit.
2024-03-12 08:33:58 +00:00
Automeris naranja
f513406f40 sound: Port some rows to CcListRow
Port the following rows to CcListRow:

- Alert Sound
- Volume Levels
2024-02-22 09:48:09 +00:00
Sam Hewitt
a5f6efaddb Update and clean up symbolic icon assets
- refresh the symbolic icons to sync some style changes and update the source sheet
- rename assets for the privacy subpanel's symbolic icons
- delete deprecated/unused symbolic icons
- add new icon for system panel
- add new icon for remote desktop so it isn't using displays icons
2024-02-10 16:17:35 +00:00
Automeris naranja
f4eb3daa9d alert-chooser-dialog: Show radio buttons as prefix widgets
Settings shows list rows with radio buttons before the
row title. However, the alert chooser looks inconsistent
because it shows the radio buttons at the end of the list
rows.

Fix that by setting the radio buttons as prefix widgets.
2024-02-08 10:00:16 +00:00
Matthijs Velsink
a8148b408c sound: Add tooltips to all speaker test buttons
With this change, Orca now reads the word
"speaker", for example: "Front Left Speaker push button"
instead of "Front Left push button".

Also, remove the a11y labels because Orca also reads
tooltips.
2024-02-08 01:44:59 -03:00
Pablo Correa Gómez
2611bc58e2 sound: fix compiler warning
Fix many warnings of the form:

../panels/sound/cc-output-test-wheel.c: In function 'cc_output_test_wheel_dispose':
../panels/sound/cc-output-test-wheel.c:155:20: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  155 |   g_clear_pointer ((GtkWidget**) &self->front_center_speaker_button, gtk_widget_unparent);
/usr/include/glib-2.0/glib/gmacros.h:870:47: note: in definition of macro 'G_STATIC_ASSERT'
  870 | #define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")
      |                                               ^~~~
../panels/sound/cc-output-test-wheel.c:155:3: note: in expansion of macro 'g_clear_pointer'
  155 |   g_clear_pointer ((GtkWidget**) &self->front_center_speaker_button, gtk_widget_unparent);
      |   ^~~~~~~~~~~~~~~
2023-12-11 15:12:00 +00:00
Automeris naranja
3fa07eb97a sound: Add ellipsis to the Test button
"Use an ellipsis (…) at the end of a label if further
input or confirmation is required from the user before
the action can be carried out".

https://developer.gnome.org/hig/guidelines/writing-style.html

Part-of: <https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/2053>
2023-11-23 06:14:20 +00:00
Automeris naranja
b3fc842999 sound: Add missing mnemonics
Partially fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2541

Part-of: <https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/2053>
2023-11-23 06:14:20 +00:00
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
Alice Mikhaylenko
4680f362f3 Port to AdwNavigationSplitView 2023-08-25 08:00:43 +00:00
Alice Mikhaylenko
dbfaa5cbfa sound: Port dialogs to AdwWindow and AdwToolbarView
Consistently handle Esc to close as well.
2023-08-25 08:00:43 +00:00
Alice Mikhaylenko
e56374e2ed sound: Port to AdwToolbarView 2023-08-25 08:00:43 +00:00
Markus Göllnitz
3fb3f547c7 sound: make output test wheel smaller
The output test wheel is fixed size with a size of 300px
and a margin of 60px on both sides. Decreasing each value
by 20px, makes it fit a width (and height) of 360px.

see: !1563

Signed-off-by: Markus Göllnitz <camelcasenick@bewares.it>
2023-08-07 10:54:16 +00:00
Markus Göllnitz
f7f6139e83 sound: ellipsize in profile combo box
While the combo box for devices can get ellipsized labels,
the one for the profile cannot. For Bluetooth profiles
with long descriptive names, this can lead to large
minimal widths for the combo box, the row, and the panel.

Signed-off-by: Markus Göllnitz <camelcasenick@bewares.it>
2023-08-07 10:54:16 +00:00
Robert Ancell
90d83f072e sound: Use self for object variable name 2023-06-06 07:54:38 +00:00
Felipe Borges
e97429f0f6 Make dialogs close when pressing the Escape key
Fixes #2503
2023-05-25 23:24:00 +00:00
Pablo Correa Gómez
7f7b65545c all: meson: do not specify resources from gresource files as dependencies
Meson extracts them by itself and add them as dependencies for the target.
It means one less location to keep track of files, and a lot less boilerplate
around the meson files
2023-05-24 08:34:14 +00:00
Automeris naranja
13e4e0c242 general: Set a minimum size for various dialogs
This change prevents some dialogs from being shrunk
to a really small size by setting a minimum size for them.
2023-05-04 09:54:07 +00:00
velsinki
eacef5a5a2 sound: Prevent duplicate sound device entries
For unknown reasons, GVC mixer control can sometimes signal a new
device with the same id as one that was added before. This means that
in `device_added_cb`, a duplicate entry with that id is created, in my
case with a different name. However, the last one added is valid, but
that one cannot be selected because all other logic in the sound panel
assumes the first hit in `get_iter` is valid. This breaks sound input
selection then.

The fix is easy; only add a new list entry if none with that id exists.
2023-03-22 13:06:39 +00:00
Jakub Steiner
a3c16f103b sound: Make bass audible on low quality hardware
- add mid range frequencies to make the bassy sound more audible on sub par hardware,
  because that's 85% of the hardware gnome runs on, sadly.

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2268
2023-03-16 11:53:29 +00:00
Lukáš Tyrychtr
62708fc44f Add the label with the current alert sound as a description for the row, so a screen reader reads it 2023-02-17 02:08:47 +00:00
Marco Melorio
9f7fad1aca sound: Add .lowres-icon to CcStreamRow app icons 2023-01-30 10:50:11 +00:00
Marco Melorio
be89d7df88 sound: Format sound-panel.ui 2023-01-30 10:49:09 +00:00
Marco Melorio
29514add66 sound: Remove the nested GtkListBox
See the previous commit for more info.

The UI file is not formatted on purpose to facilitate the review. It
will be reformatted in the next commit.
2023-01-30 10:49:09 +00:00
Marco Melorio
ec9a0052ba sound: Move the "No Devices" rows in different groups
Previously this was problematic because the current layout is a bit
messy. The reasoning is a bit complex, but I'll try to explain below.

Basically the AdwPreferencesGroup has an integrated GtkListBox where the
rows should normally be added to it by declaring AdwPreferencesRow
subclasses as its direct children in the UI file. This is not currently
done in the sound panel and we instead have another GtkListBox as its
direct child, while the "No Devices" row is actually a AdwPreferencesRow
subclass, so we end up with two listboxes with .boxed-list style. The
problem is that we hide the "No Devices" row when there are devices
available, but the internal listbox is still there, so we still see its
shadows.

This commit just separates the "No Devices" row in a separate group so
that we are sure to hide everything correctly.
2023-01-30 10:49:09 +00:00
Marco Melorio
fc3580f2f2 sound: Fix warning about missing measure in output test
Just measure the label to make GTK not complain about allocating
children without measuring anything. Measuring all the buttons is an
overkill because we expect this widget to have the minimum size
overwritten by CSS either way.
2023-01-27 17:46:58 +00:00
Marco Melorio
8dbf562276 sound: Remove stray character in UI file 2023-01-16 20:53:57 +01: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
866b08b4e8 sound: Hide controls when there are no devices
Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1221
and https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1575.
2023-01-16 20:53:15 +01:00
Marco Melorio
ba2a71fb44 sound: Cleanup and reorganize variables in CcSoundPanel
Remove unused ones and keep the same order as the UI hierarchy.
2023-01-16 20:52:14 +01:00
Marco Melorio
9e85ff5547 sound: Clamp level bars to avoid overflowing
Apparently the level value is not clamped by pulseaudio/gvc, so the
level bar can overflow when the value is greater than 1.
2023-01-16 20:51:12 +01:00
Marco Melorio
b3d99f281a sound: Add a "None" option to the alert chooser
Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2251.
2023-01-16 19:43:53 +00:00
Marco Melorio
98c8a7787c sound: Move alert chooser to a separate window 2023-01-16 19:43:53 +00: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
7556aef2aa sound: Add level bars to the stream rows
Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1303.
2023-01-12 13:25:27 +00:00
Marco Melorio
1950d1d7b5 sound: Move the mute buttons to the left side of the sliders 2023-01-12 13:25:27 +00:00
Marco Melorio
24ff4bd402 sound: Rename input volume label to match mockup
Rename "Volume" to "Input Volume", to match the mockup and the output
volume label.
2023-01-12 13:25:27 +00:00
Marco Melorio
fd3e7e478a sound: Move output volume slider in the "Output" section 2023-01-12 13:25:27 +00:00
Marco Melorio
5c07348fb9 sound: Move stream list in a separate window
Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/501.
2023-01-12 13:25:27 +00:00
Marco Melorio
458d8b53a2 sound: Use a model-based approach for the stream list box
This is useful for the next commit because the stream list will be moved
in a separate window and to do that we need an always-updated list of
the playing streams. Without this approach, we would lose all the
streams that played before the user opens the stream list window. Also,
this allows us to decuple data and UI, which is definitely not  a bad
thing.
2023-01-12 13:25:27 +00:00
Marco Melorio
034171a8e1 sound: Simplify icon theme check
Use the gtk_icon_theme_has_icon API which is definitely more appropriate
for this task.
2023-01-12 13:23:14 +00:00
Marco Melorio
8bf20930c2 sound: Fix custom icon for speech dispatcher not being used 2023-01-12 13:23:14 +00:00
Marco Melorio
6b726791bf sound: Stop using symbolic icons for stream rows 2023-01-12 13:23:14 +00:00