[gitg/wip/actions: 26/26] Select ref rows on button press



commit 446bfa8ee109db81e22a1fe3042f2abeec4d8e13
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sat Jul 12 10:36:00 2014 +0200

    Select ref rows on button press
    
    ListBox is designed to handle gestures, which means that it will wait
    for a release to actually select a row. This in turn means that there
    is a user noticeable delay in selecting rows in the refs list with the
    mouse. We override button_press_event to select the row directly on a
    button press.

 gitg/history/gitg-history-refs-list.vala |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gitg/history/gitg-history-refs-list.vala b/gitg/history/gitg-history-refs-list.vala
index 3231e80..6ad114f 100644
--- a/gitg/history/gitg-history-refs-list.vala
+++ b/gitg/history/gitg-history-refs-list.vala
@@ -873,6 +873,19 @@ public class RefsList : Gtk.ListBox
                var row = d_ref_map[reference];
                row.begin_editing((owned)done);
        }
+
+       protected override bool button_press_event(Gdk.EventButton button)
+       {
+               var ret = base.button_press_event(button);
+               var row = get_row_at_y((int)button.y);
+
+               if (row != null && row != get_selected_row())
+               {
+                       select_row(row);
+               }
+
+               return ret;
+       }
 }
 
 }


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