label: Stop overriding accessible label

There's no need to, the accessible name computation
picks the content up where it is allowed (and not
overridden by explicit attributes).
This commit is contained in:
Matthias Clasen 2023-06-18 18:57:02 -04:00
parent 4449344fad
commit 7df9cc1b47
3 changed files with 5 additions and 12 deletions

View File

@ -797,11 +797,6 @@ gtk_inscription_set_text (GtkInscription *self,
g_free (self->text);
self->text = g_strdup (text);
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_PROPERTY_LABEL, self->text,
-1);
pango_layout_set_text (self->layout,
self->text ? self->text : "",
-1);

View File

@ -3067,10 +3067,6 @@ gtk_label_set_text_internal (GtkLabel *self,
g_free (self->text);
self->text = str;
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_PROPERTY_LABEL, self->text,
-1);
gtk_label_select_region_index (self, 0, 0);
}

View File

@ -45,11 +45,13 @@ label_properties (void)
g_object_ref_sink (label);
gtk_test_accessible_assert_property (label, GTK_ACCESSIBLE_PROPERTY_LABEL, "a");
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
gtk_label_set_label (GTK_LABEL (label), "b");
gtk_test_accessible_assert_property (GTK_ACCESSIBLE (label), GTK_ACCESSIBLE_PROPERTY_HAS_POPUP, TRUE);
gtk_test_accessible_assert_property (label, GTK_ACCESSIBLE_PROPERTY_LABEL, "b");
gtk_label_set_selectable (GTK_LABEL (label), FALSE);
g_assert_false (gtk_test_accessible_has_property (GTK_ACCESSIBLE (label), GTK_ACCESSIBLE_PROPERTY_HAS_POPUP));
g_object_unref (label);
}