[geary/wip/730682-refine-convo-list] Fix conversation list keyboard nav and autoselect on item removed.



commit 4baf748c3dfecab830f356ad6736ea6021b1f44f
Author: Michael James Gratton <mike vee net>
Date:   Sun Dec 24 16:41:44 2017 +1030

    Fix conversation list keyboard nav and autoselect on item removed.

 .../conversation-list/conversation-list.vala       |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/src/client/conversation-list/conversation-list.vala 
b/src/client/conversation-list/conversation-list.vala
index 6dc3ddc..7c12e3e 100644
--- a/src/client/conversation-list/conversation-list.vala
+++ b/src/client/conversation-list/conversation-list.vala
@@ -137,17 +137,21 @@ public class ConversationList : Gtk.ListBox {
                 new_index = ((int) this.model.get_n_items()) - 1;
             }
 
-            // XXX we should be only calling select_row() if
-            // autoselect is enabled, otherwise we should simply be
-            // updating the cursor, but Gtk.ListBox doesn't allow us
-            // to do that --- move_cursor() doesn't seem to work and
-            // is O(n) anyway.
-            row = get_row_at_index(new_index);
+            row = get_item_at_index(new_index);
             if (row != null) {
-                select_row(row);
+                if (this.config.autoselect) {
+                    select_row(row);
+                }
+
+                // Grab the focus so the user can continue using the
+                // keyboard to navigate if so desired.
+                row.grab_focus();
             }
         }
-        return row;
+
+        // Return null if not autoselecting so we don't emit a
+        // selection signal, causing the conversation to be displayed.
+        return this.config.autoselect ? row : null;
     }
 
     private void schedule_visible_conversations_changed() {


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