[gnome-games] savestates-list: Remove selected savestate with Delete key
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] savestates-list: Remove selected savestate with Delete key
- Date: Fri, 16 Aug 2019 22:03:12 +0000 (UTC)
commit 634d391f5696bba5d45b4da1b85e30751010a311
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Sat Aug 17 03:02:18 2019 +0500
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.
src/ui/display-box.vala | 7 +++++--
src/ui/savestates-list.vala | 13 +++++++++++++
2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/ui/display-box.vala b/src/ui/display-box.vala
index 6f6d134f..54627242 100644
--- a/src/ui/display-box.vala
+++ b/src/ui/display-box.vala
@@ -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) {
diff --git a/src/ui/savestates-list.vala b/src/ui/savestates-list.vala
index d3af0d2b..2f82f8e8 100644
--- a/src/ui/savestates-list.vala
+++ b/src/ui/savestates-list.vala
@@ -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;
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]