diff --git a/src/MainWindow.vala b/src/MainWindow.vala index fde8f2c3e..3773c14f5 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -178,6 +178,10 @@ public class Installer.MainWindow : Gtk.Dialog { stack.add (partitioning_view); stack.visible_child = partitioning_view; + partitioning_view.cancel.connect (() => { + stack.visible_child = try_install_view; + }); + partitioning_view.next_step.connect (() => { unowned Configuration config = Configuration.get_default (); config.luks = (owned) partitioning_view.luks; diff --git a/src/Views/AbstractInstallerView.vala b/src/Views/AbstractInstallerView.vala index 551292029..e58d50e23 100644 --- a/src/Views/AbstractInstallerView.vala +++ b/src/Views/AbstractInstallerView.vala @@ -66,5 +66,21 @@ public abstract class AbstractInstallerView : Gtk.Grid { orientation = Gtk.Orientation.VERTICAL; add (content_area); add (action_area); + + if (cancellable) { + key_press_event.connect ((event) => { + switch (event.keyval) { + case Gdk.Key.Left: + if (event.state != Gdk.ModifierType.MOD1_MASK) { + break; + } + case Gdk.Key.Escape: + cancel (); + return true; + } + + return false; + }); + } } } diff --git a/src/Views/DiskView.vala b/src/Views/DiskView.vala index 0597060c9..0f52f89cc 100644 --- a/src/Views/DiskView.vala +++ b/src/Views/DiskView.vala @@ -165,6 +165,19 @@ public class Installer.DiskView : AbstractInstallerView { } }); + disk_button.key_press_event.connect ((event) => { + if (event.keyval == Gdk.Key.Return) { + disk_button.clicked (); + if (next_button.sensitive) { + next_button.clicked (); + } + + return true; + } + + return false; + }); + enabled_buttons += disk_button; } } @@ -179,5 +192,9 @@ public class Installer.DiskView : AbstractInstallerView { disk_grid.show_all (); load_stack.set_visible_child_name ("disk"); + + if (enabled_buttons.length != 0) { + enabled_buttons[0].grab_focus (); + } } } diff --git a/src/Views/EncryptView.vala b/src/Views/EncryptView.vala index eba4d2ef5..53d40f2dc 100644 --- a/src/Views/EncryptView.vala +++ b/src/Views/EncryptView.vala @@ -144,6 +144,7 @@ public class EncryptView : AbstractInstallerView { next_button = new Gtk.Button.with_label (_("Choose Password")); next_button.can_default = true; next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + next_button.can_default = true; action_area.add (no_encrypt_button); action_area.add (back_button); diff --git a/src/Views/KeyboardLayoutView.vala b/src/Views/KeyboardLayoutView.vala index ca18ebae5..e8163ec3c 100644 --- a/src/Views/KeyboardLayoutView.vala +++ b/src/Views/KeyboardLayoutView.vala @@ -76,6 +76,24 @@ public class KeyboardLayoutView : AbstractInstallerView { return ((VariantRow) row1).description.collate (((VariantRow) row2).description); }); + input_variant_widget.key_press_event.connect ((event) => { + switch (event.keyval) { + case Gdk.Key.Left: + if (event.state != Gdk.ModifierType.MOD1_MASK) { + break; + } + case Gdk.Key.Escape: + if (input_variant_widget.variants_visible ()) { + input_variant_widget.back_button.clicked (); + } else { + back_button.clicked (); + }; + return true; + } + + return false; + }); + input_variant_widget.variant_listbox.row_activated.connect (() => { next_button.activate (); }); diff --git a/src/Views/LanguageView.vala b/src/Views/LanguageView.vala index 8dd958238..48ef9ae54 100644 --- a/src/Views/LanguageView.vala +++ b/src/Views/LanguageView.vala @@ -120,6 +120,25 @@ public class Installer.LanguageView : AbstractInstallerView { lang_variant_widget.main_listbox.select_row (lang_variant_widget.main_listbox.get_row_at_index (0)); lang_variant_widget.main_listbox.row_activated.connect (row_activated); + lang_variant_widget.key_press_event.connect ((event) => { + switch (event.keyval) { + case Gdk.Key.Return: + if (next_button.sensitive) { + next_button.clicked (); + } + return true; + case Gdk.Key.Left: + if (event.state != Gdk.ModifierType.MOD1_MASK) { + break; + } + case Gdk.Key.Escape: + lang_variant_widget.back_button.clicked (); + return true; + } + + return false; + }); + next_button.clicked.connect (() => { unowned Gtk.ListBoxRow row = lang_variant_widget.main_listbox.get_selected_row (); if (row != null) { diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index 48d7a58e5..3e2b10793 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -35,7 +35,7 @@ public class Installer.PartitioningView : AbstractInstallerView { public PartitioningView (uint64 size) { minimum_disk_size = size; - Object (cancellable: false); + Object (cancellable: true); } [Flags] @@ -100,16 +100,12 @@ public class Installer.PartitioningView : AbstractInstallerView { action_area.set_child_secondary (modify_partitions_button, true); action_area.set_child_non_homogeneous (modify_partitions_button, true); - var back_button = new Gtk.Button.with_label (_("Back")); - next_button = new Gtk.Button.with_label (_("Erase and Install")); next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); next_button.sensitive = false; - action_area.add (back_button); action_area.add (next_button); - back_button.clicked.connect (() => ((Gtk.Stack) get_parent ()).visible_child = previous_view); next_button.clicked.connect (() => next_step ()); show_all (); diff --git a/src/Views/SuccessView.vala b/src/Views/SuccessView.vala index 39a4292e1..6b28e5b92 100644 --- a/src/Views/SuccessView.vala +++ b/src/Views/SuccessView.vala @@ -70,4 +70,3 @@ public class SuccessView : AbstractInstallerView { show_all (); } } - diff --git a/src/Views/TryInstallView.vala b/src/Views/TryInstallView.vala index ce68e202e..e14f7a900 100644 --- a/src/Views/TryInstallView.vala +++ b/src/Views/TryInstallView.vala @@ -67,6 +67,20 @@ public class Installer.TryInstallView : AbstractInstallerView { var back_button = new Gtk.Button.with_label (_("Back")); back_button.clicked.connect (() => ((Gtk.Stack) get_parent ()).visible_child = previous_view); + key_press_event.connect ((event) => { + switch (event.keyval) { + case Gdk.Key.Left: + if (event.state != Gdk.ModifierType.MOD1_MASK) { + break; + } + case Gdk.Key.Escape: + back_button.clicked (); + return true; + } + + return false; + }); + next_button = new Gtk.Button.with_label (_("Next")); next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); next_button.sensitive = false; @@ -104,6 +118,7 @@ public class Installer.TryInstallView : AbstractInstallerView { type_grid.add (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); type_grid.add (custom_button); + demo_button.key_press_event.connect ((event) => handle_key_press (demo_button, event)); demo_button.clicked.connect (() => { if (demo_button.active) { type_grid.get_children ().foreach ((child) => { @@ -121,6 +136,7 @@ public class Installer.TryInstallView : AbstractInstallerView { } }); + clean_install_button.key_press_event.connect ((event) => handle_key_press (clean_install_button, event)); clean_install_button.clicked.connect (() => { if (clean_install_button.active) { type_grid.get_children ().foreach ((child) => { @@ -138,6 +154,7 @@ public class Installer.TryInstallView : AbstractInstallerView { } }); + custom_button.key_press_event.connect ((event) => handle_key_press (custom_button, event)); custom_button.clicked.connect (() => { if (custom_button.active) { type_grid.get_children ().foreach ((child) => { @@ -156,6 +173,16 @@ public class Installer.TryInstallView : AbstractInstallerView { }); show_all (); + demo_button.grab_focus (); } -} + private bool handle_key_press (Gtk.Button button, Gdk.EventKey event) { + if (event.keyval == Gdk.Key.Return) { + button.clicked (); + next_button.clicked (); + return true; + } + + return false; + } +} diff --git a/src/Widgets/VariantWidget.vala b/src/Widgets/VariantWidget.vala index 651799c0f..c15e95551 100644 --- a/src/Widgets/VariantWidget.vala +++ b/src/Widgets/VariantWidget.vala @@ -22,7 +22,7 @@ public class VariantWidget : Gtk.Frame { public signal void going_to_main (); - private Gtk.Button back_button; + public Gtk.Button back_button; private Gtk.Label variant_title; private Gtk.Stack stack; @@ -81,6 +81,10 @@ public class VariantWidget : Gtk.Frame { stack.visible_child_name = "variant"; } + public bool variants_visible () { + return stack.visible_child_name == "variant"; + } + public void clear_variants () { variant_listbox.get_children ().foreach ((child) => { child.destroy ();