Commit 634d391f authored by Alexander Mikhaylenko's avatar Alexander Mikhaylenko

savestates-list: Remove selected savestate with Delete key

Another shortcut we should support. Also add a placeholder for moving the
other savestate-related shortcuts here, such as Esc to close the sidebar.
parent 6d0de5d1
Pipeline #105319 passed with stages
in 30 minutes and 32 seconds
......@@ -111,14 +111,17 @@ private class Games.DisplayBox : Gtk.Bin {
display_bin.remove (child);
}
public bool on_key_press_event (uint keyval, uint status) {
public bool on_key_press_event (uint keyval, uint state) {
if (!get_mapped ())
return false;
if (runner == null)
return false;
return runner.key_press_event (keyval, status);
if (savestates_list_state.is_revealed)
return savestates_list.on_key_press_event (keyval, state);
return runner.key_press_event (keyval, state);
}
public bool gamepad_button_press_event (Manette.Event event) {
......
......@@ -269,6 +269,8 @@ private class Games.SavestatesList : Gtk.Box {
state.selected_savestate = null;
}
else {
row.grab_focus ();
if (!(row is SavestateListBoxRow))
return;
......@@ -287,4 +289,15 @@ private class Games.SavestatesList : Gtk.Box {
delete_btn.sensitive = (state.selected_savestate != null);
rename_btn.sensitive = (state.selected_savestate != null && !state.selected_savestate.is_automatic ());
}
public bool on_key_press_event (uint keyval, uint state) {
// FIXME: Move the other list shortcuts here
if (keyval == Gdk.Key.Delete || keyval == Gdk.Key.KP_Delete) {
on_delete_clicked ();
return true;
}
return false;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment