diff --git a/README.md b/README.md index e2c120efb..3acc07104 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ You'll need the following dependencies: - gparted - libgnomekbd-dev - libgranite-7-dev >=7.4.0 - - libgtk-4-dev + - libgtk-4-dev >=4.14 - libgee-0.8-dev - libadwaita-1-dev >=1.4.0 - libjson-glib-dev diff --git a/meson.build b/meson.build index 23dc6b9cc..a8a6388a1 100644 --- a/meson.build +++ b/meson.build @@ -14,7 +14,7 @@ i18n = import('i18n') glib_dep = dependency('glib-2.0', version: '>=2.74') gobject_dep = dependency('gobject-2.0') -gtk_dep = dependency('gtk4') +gtk_dep = dependency('gtk4', version: '>=4.14') # Gtk.Accessible.announce gtk_wayland_dep = dependency('gtk4-wayland') gtk_x11_dep = dependency('gtk4-x11') gee_dep = dependency('gee-0.8') diff --git a/src/Views/EncryptView.vala b/src/Views/EncryptView.vala index 01b69559c..3d6606522 100644 --- a/src/Views/EncryptView.vala +++ b/src/Views/EncryptView.vala @@ -26,6 +26,8 @@ public class EncryptView : AbstractInstallerView { private const string SKIP_STRING = _("Don’t Encrypt"); + private uint announce_timeout_id; + public EncryptView () { Object (cancellable: true); } @@ -70,27 +72,31 @@ public class EncryptView : AbstractInstallerView { "slate" ); - var pw_label = new Granite.HeaderLabel (_("Encryption Password")) { - secondary_text = _("A unique password for this device; not the password for your user account.") - }; - pw_error_revealer = new ErrorRevealer ("."); pw_error_revealer.label_widget.add_css_class (Granite.STYLE_CLASS_WARNING); pw_entry = new ValidatedEntry (); + var pw_label = new Granite.HeaderLabel (_("Encryption Password")) { + mnemonic_widget = pw_entry, + secondary_text = _("A unique password for this device, not the password for your user account.") + }; + pw_levelbar = new Gtk.LevelBar.for_interval (0.0, 100.0); pw_levelbar.set_mode (Gtk.LevelBarMode.CONTINUOUS); pw_levelbar.add_offset_value ("low", 50.0); pw_levelbar.add_offset_value ("high", 75.0); pw_levelbar.add_offset_value ("middle", 75.0); - var confirm_label = new Granite.HeaderLabel (_("Confirm Password")); - confirm_entry = new Granite.ValidatedEntry () { sensitive = false, visibility = false }; + confirm_entry.update_property (Gtk.AccessibleProperty.REQUIRED, true, -1); + + var confirm_label = new Granite.HeaderLabel (_("Confirm Password")) { + mnemonic_widget = confirm_entry + }; confirm_entry_revealer = new ErrorRevealer ("."); confirm_entry_revealer.label_widget.add_css_class (Granite.STYLE_CLASS_ERROR); @@ -171,6 +177,14 @@ public class EncryptView : AbstractInstallerView { pw_error_revealer.reveal_child = false; pw_levelbar.value = quality; + + if (quality <= 50) { + queue_announce (pw_entry, _("Acceptable password")); + } else if (quality <= 75) { + queue_announce (pw_entry, _("Good password")); + } else { + queue_announce (pw_entry, _("Great password")); + } } else { pw_entry.set_icon_from_icon_name (Gtk.EntryIconPosition.SECONDARY, "dialog-warning-symbolic"); @@ -178,6 +192,8 @@ public class EncryptView : AbstractInstallerView { pw_error_revealer.label = ((PasswordQuality.Error) quality).to_string (error); pw_levelbar.value = 0; + + queue_announce (pw_entry, pw_error_revealer.label); } return true; } @@ -190,8 +206,11 @@ public class EncryptView : AbstractInstallerView { if (pw_entry.text != confirm_entry.text) { confirm_entry_revealer.label = _("Passwords do not match"); confirm_entry_revealer.reveal_child = true; + + queue_announce (confirm_entry, confirm_entry_revealer.label); } else { confirm_entry_revealer.reveal_child = false; + queue_announce (confirm_entry, _("Passwords match")); return true; } } else { @@ -201,6 +220,19 @@ public class EncryptView : AbstractInstallerView { return false; } + private void queue_announce (Gtk.Entry entry, string announcement) { + if (announce_timeout_id != 0) { + Source.remove (announce_timeout_id); + announce_timeout_id = 0; + } + + announce_timeout_id = Timeout.add (500, () => { + entry.announce (announcement, MEDIUM); + announce_timeout_id = 0; + return GLib.Source.REMOVE; + }); + } + private void update_next_button () { if (pw_entry.is_valid && confirm_entry.is_valid) { encrypt_button.sensitive = true;