Skip to content
4 changes: 4 additions & 0 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 16 additions & 0 deletions src/Views/AbstractInstallerView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}
}
}
17 changes: 17 additions & 0 deletions src/Views/DiskView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand All @@ -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 ();
}
}
}
1 change: 1 addition & 0 deletions src/Views/EncryptView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 18 additions & 0 deletions src/Views/KeyboardLayoutView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
});
Expand Down
19 changes: 19 additions & 0 deletions src/Views/LanguageView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 1 addition & 5 deletions src/Views/PartitioningView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class Installer.PartitioningView : AbstractInstallerView {

public PartitioningView (uint64 size) {
minimum_disk_size = size;
Object (cancellable: false);
Object (cancellable: true);
}

[Flags]
Expand Down Expand Up @@ -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 ();
Expand Down
1 change: 0 additions & 1 deletion src/Views/SuccessView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,3 @@ public class SuccessView : AbstractInstallerView {
show_all ();
}
}

29 changes: 28 additions & 1 deletion src/Views/TryInstallView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) => {
Expand All @@ -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) => {
Expand All @@ -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) => {
Expand All @@ -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;
}
}
6 changes: 5 additions & 1 deletion src/Widgets/VariantWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 ();
Expand Down