[gnome-games] savestates-list: Preview savestates immediately with keynav



commit 6b6db79607e598db75fef8c73e71e102759fc695
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Sat Aug 17 04:27:39 2019 +0500

    savestates-list: Preview savestates immediately with keynav
    
    Use move-cursor signal to preview savestate for selected row immediately
    without requiring a press of Enter or Space keys.
    
    This allows to load savestates with keyboard with a single key press.

 src/ui/savestates-list.vala | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/src/ui/savestates-list.vala b/src/ui/savestates-list.vala
index 2f82f8e8..34532dc7 100644
--- a/src/ui/savestates-list.vala
+++ b/src/ui/savestates-list.vala
@@ -53,6 +53,19 @@ private class Games.SavestatesList : Gtk.Box {
                scrolled_window.margin_top = margin;
        }
 
+       [GtkCallback]
+       private void on_move_cursor () {
+               var row = list_box.get_selected_row ();
+
+               if (row != null && row is SavestateListBoxRow) {
+                       var savestate_row = row as SavestateListBoxRow;
+                       var savestate = savestate_row.savestate;
+
+                       if (savestate != state.selected_savestate)
+                               select_savestate_row (row);
+               }
+       }
+
        [GtkCallback]
        private void on_row_activated (Gtk.ListBoxRow activated_row) {
                if (activated_row == new_savestate_row) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]