Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OutputPanel: include screen reader shortcut #245

Merged
merged 3 commits into from
Jun 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion src/OutputPanel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@ public class Sound.OutputPanel : Gtk.Box {
private uint notify_timeout_id = 0;
private unowned Canberra.Context? ca_context = null;
private unowned PulseAudioManager pam;
private Settings media_keys_settings;

private string _screenreader_shortcut_label = "";
private string screenreader_shortcut_label {
get {
string?[] granite_accel_strings = null;
foreach (unowned var key in media_keys_settings.get_strv ("screenreader")) {
granite_accel_strings += Granite.accel_to_string (key);
}

_screenreader_shortcut_label = _("Provide audio descriptions for items on the screen. %s").printf (
string.joinv (_(", "), granite_accel_strings)
);

return _screenreader_shortcut_label;
}
}

construct {
var no_device_grid = new Granite.Widgets.AlertView (
Expand Down Expand Up @@ -97,7 +114,8 @@ public class Sound.OutputPanel : Gtk.Box {
hexpand = true
};

var screen_reader_description_label = new Gtk.Label (_("Provide audio descriptions for items on the screen")) {
media_keys_settings = new Settings ("org.gnome.settings-daemon.plugins.media-keys");
var screen_reader_description_label = new Gtk.Label (screenreader_shortcut_label) {
wrap = true,
xalign = 0
};
Expand Down Expand Up @@ -163,6 +181,10 @@ public class Sound.OutputPanel : Gtk.Box {
pam.set_default_device.begin (((Sound.DeviceRow) row).device);
});

media_keys_settings.changed["screenreader"].connect (() => {
screen_reader_description_label.label = screenreader_shortcut_label;
});

volume_scale.button_release_event.connect (e => {
notify_change ();
return false;
Expand Down