summaryrefslogtreecommitdiff
path: root/mate-volume-control/gvc-level-bar.c
diff options
context:
space:
mode:
authorvvillenave <[email protected]>2021-11-10 20:33:53 +0000
committerGitHub <[email protected]>2021-11-10 21:33:53 +0100
commit5fd5b5a23011ed536472ea724153216c21515f39 (patch)
tree4f5f46f0ef37dfe0a5f7854c29b11ce8e9bed5d3 /mate-volume-control/gvc-level-bar.c
parent0d07e873ee10228a7d79221f42713a61e68b40b0 (diff)
downloadmate-media-5fd5b5a23011ed536472ea724153216c21515f39.tar.bz2
mate-media-5fd5b5a23011ed536472ea724153216c21515f39.tar.xz
Accessibility improvements
- Make the speaker test dialog accessible - Add an accessible object for the Input level custom widget Co-authored-by: Valentin Villenave <[email protected]>
Diffstat (limited to 'mate-volume-control/gvc-level-bar.c')
-rw-r--r--mate-volume-control/gvc-level-bar.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/mate-volume-control/gvc-level-bar.c b/mate-volume-control/gvc-level-bar.c
index b697ed5..0d815fc 100644
--- a/mate-volume-control/gvc-level-bar.c
+++ b/mate-volume-control/gvc-level-bar.c
@@ -215,12 +215,23 @@ update_peak_value (GvcLevelBar *bar)
bar->priv->peak_fraction = value;
if (value > bar->priv->max_peak) {
+ AtkObject *acc_obj;
+ char *acc_string;
+ gdouble peak_percentage;
+
if (bar->priv->max_peak_id > 0)
g_source_remove (bar->priv->max_peak_id);
bar->priv->max_peak_id =
g_timeout_add_seconds (1, (GSourceFunc) reset_max_peak, bar);
bar->priv->max_peak = value;
+ /* Providing an accessible based on peaks, so that
+ * it doesn’t get updated too often. */
+ acc_obj = gtk_widget_get_accessible (GTK_WIDGET (bar));
+ peak_percentage = round (value * 100.0);
+ acc_string = g_strdup_printf (_("Peak: %.0lf"), peak_percentage);
+ atk_object_set_name (acc_obj, acc_string);
+ g_free (acc_string);
}
layout = bar->priv->layout;
@@ -753,6 +764,9 @@ gvc_level_bar_init (GvcLevelBar *bar)
bar);
gtk_widget_set_has_window (GTK_WIDGET (bar), FALSE);
+
+ atk_object_set_role (gtk_widget_get_accessible (GTK_WIDGET (bar)),
+ ATK_ROLE_STATIC);
}
static void