From: Matthias Clasen Date: Sat, 10 Jun 2023 15:00:35 +0000 (-0400) Subject: fontchooser: Improve accessibility X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~160^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f20ef5a0fc76633b909b47528c9f61e699df7fd8;p=gtk4.git fontchooser: Improve accessibility Set up missing accessible relations, labels and roles. --- diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c index e54d1f575d..598466d027 100644 --- a/gtk/gtkfontchooserwidget.c +++ b/gtk/gtkfontchooserwidget.c @@ -1594,6 +1594,9 @@ add_axis (GtkFontChooserWidget *fontchooser, (double)ax->max_value, 1.0, 10.0, 0.0); axis->scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, axis->adjustment); + gtk_accessible_update_relation (GTK_ACCESSIBLE (axis->scale), + GTK_ACCESSIBLE_RELATION_LABELLED_BY, axis->label, NULL, + -1); gtk_scale_add_mark (GTK_SCALE (axis->scale), (double)ax->default_value, GTK_POS_TOP, NULL); gtk_widget_set_valign (axis->scale, GTK_ALIGN_BASELINE_FILL); gtk_widget_set_hexpand (axis->scale, TRUE); @@ -1601,6 +1604,9 @@ add_axis (GtkFontChooserWidget *fontchooser, gtk_scale_set_draw_value (GTK_SCALE (axis->scale), FALSE); gtk_grid_attach (GTK_GRID (fontchooser->axis_grid), axis->scale, 1, row, 1, 1); axis->spin = gtk_spin_button_new (axis->adjustment, 0, 0); + gtk_accessible_update_relation (GTK_ACCESSIBLE (axis->spin), + GTK_ACCESSIBLE_RELATION_LABELLED_BY, axis->label, NULL, + -1); g_signal_connect (axis->spin, "output", G_CALLBACK (output_cb), fontchooser); gtk_widget_set_valign (axis->spin, GTK_ALIGN_BASELINE_FILL); gtk_grid_attach (GTK_GRID (fontchooser->axis_grid), axis->spin, 2, row, 1, 1); @@ -2345,7 +2351,7 @@ add_enum_group (GtkFontChooserWidget *fontchooser, const char **tags, unsigned int n_tags) { - GtkWidget *label; + GtkWidget *label = NULL; GtkWidget *group; PangoAttrList *attrs; int i; @@ -2433,6 +2439,9 @@ add_radio_group (GtkFontChooserWidget *fontchooser, gtk_label_set_attributes (GTK_LABEL (label), attrs); pango_attr_list_unref (attrs); gtk_box_append (GTK_BOX (group), label); + gtk_accessible_update_relation (GTK_ACCESSIBLE (group), + GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL, + -1); for (i = 0; i < n_tags; i++) { diff --git a/gtk/ui/gtkfontchooserwidget.ui b/gtk/ui/gtkfontchooserwidget.ui index e1ccdd932c..99b30e86a9 100644 --- a/gtk/ui/gtkfontchooserwidget.ui +++ b/gtk/ui/gtkfontchooserwidget.ui @@ -196,6 +196,9 @@ Preview Font + + Preview Font + horizontal @@ -225,6 +228,9 @@ 1 slider_adjustment 0 + + size_label + horizontal @@ -241,6 +247,9 @@ spin_adjustment 3 + + size_label + 2 @@ -262,6 +271,10 @@ 1 3 3 + alert + + no_fonts_label + @@ -276,7 +289,7 @@ - + No Fonts Found @@ -317,6 +330,9 @@ 12 3 0 + + Font Name + selection @@ -334,6 +350,9 @@ Preview Font + + Preview Font + @@ -356,6 +375,9 @@ 6 12 + + Font Variation Axes + Size @@ -372,6 +394,9 @@ 1 slider_adjustment 0 + + size_label2 + 1 0 @@ -383,6 +408,9 @@ spin_adjustment 3 + + size_label2 + 2 0 @@ -395,6 +423,9 @@ 1 12 + + Font Features +