[gnome-games/wip/exalm/mobile: 8/15] platforms-view: Only refresh icon view on row-activated



commit 91d7ccbc5ecf0cd906df092408adbe3cc2edd5a4
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Fri May 24 21:42:10 2019 +0500

    platforms-view: Only refresh icon view on row-activated
    
    Don't try updating icon view on row-selected. This changes keyboard
    navigation to be more in line with other apps, and prevents problems with
    adaptive UI in the future.
    
    Make gamepad navigation call row-activated handler explicitly, so gamepad
    navigation should still work the same way.

 data/ui/platforms-view.ui  |  1 -
 src/ui/platforms-view.vala | 21 +++++++--------------
 2 files changed, 7 insertions(+), 15 deletions(-)
---
diff --git a/data/ui/platforms-view.ui b/data/ui/platforms-view.ui
index 0cfbb72d..b0f548cc 100644
--- a/data/ui/platforms-view.ui
+++ b/data/ui/platforms-view.ui
@@ -15,7 +15,6 @@
           <object class="GtkListBox" id="list_box">
             <property name="visible">True</property>
             <signal name="row-activated" handler="on_list_box_row_activated"/>
-            <signal name="row-selected" handler="on_list_box_row_selected"/>
             <style>
               <class name="sidebar"/>
             </style>
diff --git a/src/ui/platforms-view.vala b/src/ui/platforms-view.vala
index 59fd8e41..37f4c471 100644
--- a/src/ui/platforms-view.vala
+++ b/src/ui/platforms-view.vala
@@ -156,14 +156,16 @@ private class Games.PlatformsView : Gtk.Box {
                switch (direction) {
                case Gtk.DirectionType.UP:
                        list_box.move_cursor (Gtk.MovementStep.DISPLAY_LINES, -1);
+                       list_box.activate_cursor_row ();
 
                        return true;
                case Gtk.DirectionType.DOWN:
                        list_box.move_cursor (Gtk.MovementStep.DISPLAY_LINES, 1);
+                       list_box.activate_cursor_row ();
 
                        return true;
                case Gtk.DirectionType.RIGHT:
-                       list_box.activate_cursor_row ();
+                       collection_view.select_default_game (Gtk.DirectionType.RIGHT);
 
                        return true;
                default:
@@ -186,23 +188,12 @@ private class Games.PlatformsView : Gtk.Box {
        }
 
        [GtkCallback]
-       private void on_list_box_row_selected (Gtk.ListBoxRow? row_item) {
-               if (row_item == null)
-                       return;
-
+       private void on_list_box_row_activated (Gtk.ListBoxRow row_item) {
                var row = row_item as PlatformListItem;
-               list_box.select_row (row);
-               row.focus (Gtk.DirectionType.LEFT);
                selected_platform = row.platform;
 
                collection_view.invalidate_flow_box_filter ();
                collection_view.reset_scroll_position ();
-               collection_view.unselect_game ();
-       }
-
-       [GtkCallback]
-       private void on_list_box_row_activated (Gtk.ListBoxRow row_item) {
-               collection_view.select_default_game (Gtk.DirectionType.RIGHT);
        }
 
        private void on_model_changed (uint position, uint removed, uint added) {
@@ -228,7 +219,9 @@ private class Games.PlatformsView : Gtk.Box {
                        var row = child as Gtk.ListBoxRow;
 
                        if (row.visible) {
-                               on_list_box_row_selected (row);
+                               list_box.select_row (row);
+                               row.focus (Gtk.DirectionType.LEFT);
+                               on_list_box_row_activated (row);
                                break;
                        }
                }


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