From 30e3cf5dfbfd138a84a2a29ba3483a48f0cb04a4 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 2 Apr 2025 00:18:22 +0200 Subject: File properties: improve accessibility of the simple permissions As the UI doesn't have semantic groups for owner/group/others settings but they are only visually apparent, add some more context to the accessible version of the labels to identify what it targets. This is especially useful for the setting for other's permissions, because the focus never lands on the line with the "Others" label, hence making it hard to infer the context while navigating. Another solution would be to redesign the UI to have semantic groups, like e.g. labeled frames, but it's a lot less trivial and a lot more intrusive a change. --- src/file-manager/fm-properties-window.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/file-manager/fm-properties-window.c') diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c index 88a97e55..e615e1fa 100644 --- a/src/file-manager/fm-properties-window.c +++ b/src/file-manager/fm-properties-window.c @@ -4245,13 +4245,23 @@ add_permissions_combo_box (FMPropertiesWindow *window, GtkGrid *grid, GtkListStore *store; GtkCellRenderer *cell; GtkTreeIter iter; - - if (short_label) { - label = attach_title_field (grid, _("Access:")); - } else if (is_folder) { - label = attach_title_field (grid, _("Folder access:")); - } else { - label = attach_title_field (grid, _("File access:")); + AtkObject *atk_object; + static const gchar *const descriptions[4][3] = { + { N_("Access:"), N_("Folder access:"), N_("File access:") }, + /* As the UI lacks semantic grouping, provide more context for accessibility */ + { N_("User access:"), N_("User folder access:"), N_("User file access:") }, + { N_("Group access:"), N_("Group folder access:"), N_("Group file access:") }, + { N_("Others access:"), N_("Others folder access:"), N_("Others file access:") } + }; + const guint group = short_label ? 0 : is_folder ? 1 : 2; + + g_return_if_fail (type + 1 < G_N_ELEMENTS (descriptions)); + + label = attach_title_field (grid, _(descriptions[0][group])); + + atk_object = gtk_widget_get_accessible (GTK_WIDGET (label)); + if (GTK_IS_ACCESSIBLE (atk_object)) { + atk_object_set_name (atk_object, _(descriptions[type + 1][group])); } store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN); -- cgit v1.2.1