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

AppSettingsView: set mnemonic widget, accessible label, description, role #236

Merged
merged 3 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
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
11 changes: 6 additions & 5 deletions src/Permissions/Widgets/AppSettingsView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,19 @@ public class Permissions.Widgets.AppSettingsView : Switchboard.SettingsPage {
permission_box.add_css_class ("boxed-list");
permission_box.add_css_class (Granite.STYLE_CLASS_RICH_LIST);

var sandbox_header = new Granite.HeaderLabel (_("Advanced System Access")) {
halign = FILL,
secondary_text = _("Access to system features can be restricted to make apps more secure, but some apps may not function properly without it")
};

sandbox_box = new Gtk.ListBox () {
hexpand = true,
selection_mode = NONE
};
sandbox_box.add_css_class ("boxed-list");
sandbox_box.add_css_class (Granite.STYLE_CLASS_RICH_LIST);

var sandbox_header = new Granite.HeaderLabel (_("Advanced System Access")) {
halign = FILL,
mnemonic_widget = sandbox_box,
secondary_text = _("Access to system features can be restricted to make apps more secure, but some apps may not function properly without it")
};

reset_button = new Gtk.Button.with_label (_("Reset to Defaults")) {
halign = END
};
Expand Down
18 changes: 15 additions & 3 deletions src/Permissions/Widgets/PermissionSettingsWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
*/

public class Permissions.Widgets.PermissionSettingsWidget : Gtk.ListBoxRow {
public string description { get; construct set; }
public string icon_name { get; construct set; }
public string primary_text { get; construct set; }
public string description { get; construct; }
public string icon_name { get; construct; }
public string primary_text { get; construct; }

public bool active { get; set; }

Expand Down Expand Up @@ -64,8 +64,20 @@ public class Permissions.Widgets.PermissionSettingsWidget : Gtk.ListBoxRow {
grid.attach (description_label, 1, 1);
grid.attach (allow_switch, 2, 0, 1, 2);

accessible_role = SWITCH;
child = grid;

update_property (
Gtk.AccessibleProperty.LABEL, primary_text,
Gtk.AccessibleProperty.DESCRIPTION, description,
-1
);

bind_property ("active", allow_switch, "active", BIDIRECTIONAL);

update_state (Gtk.AccessibleState.CHECKED, active, -1);
notify["active"].connect (() => {
update_state (Gtk.AccessibleState.CHECKED, active, -1);
});
}
}
8 changes: 6 additions & 2 deletions src/Permissions/Widgets/SidebarRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public class Permissions.SidebarRow : Gtk.ListBoxRow {
}

construct {
hexpand = true;

var image = new Gtk.Image.from_gicon (app.icon) {
pixel_size = 32
};
Expand Down Expand Up @@ -60,7 +58,10 @@ public class Permissions.SidebarRow : Gtk.ListBoxRow {
grid.attach (title_label, 1, 0);
grid.attach (description_revealer, 1, 1);

accessible_role = TAB;
child = grid;
hexpand = true;
update_property (Gtk.AccessibleProperty.LABEL, app.name, -1);

for (var i = 0; i < app.settings.length; i++) {
app.settings.get (i).notify.connect (update_description);
Expand All @@ -84,9 +85,12 @@ public class Permissions.SidebarRow : Gtk.ListBoxRow {
description_label.label = description;
description_revealer.reveal_child = true;
tooltip_text = description;

update_property (Gtk.AccessibleProperty.DESCRIPTION, description, -1);
} else {
description_revealer.reveal_child = false;
tooltip_text = null;
update_property (Gtk.AccessibleProperty.DESCRIPTION, null, -1);
}
}
}
2 changes: 2 additions & 0 deletions src/Sidebar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ public class Applications.Sidebar : Gtk.Box {
box.append (image);
box.append (title_label);

accessible_role = TAB;
child = box;
update_property (Gtk.AccessibleProperty.LABEL, label, -1);
}
}
}
Loading