[gitg/vala: 20/35] Support adjustments where the ListBox is not at top



commit fbf0e164834c9093dc3553a05e5d8ebab6760a5a
Author: Alexander Larsson <alexl redhat com>
Date:   Mon May 21 14:39:57 2012 +0200

    Support adjustments where the ListBox is not at top

 egg-list-box.vala |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/egg-list-box.vala b/egg-list-box.vala
index c3525b0..9506597 100644
--- a/egg-list-box.vala
+++ b/egg-list-box.vala
@@ -343,9 +343,12 @@ public class Egg.ListBox : Container {
     cursor_child = child;
     this.grab_focus ();
     this.queue_draw ();
-    if (child != null && adjustment != null)
-      adjustment.clamp_page (cursor_child.y,
-			     cursor_child.y + cursor_child.height);
+    if (child != null && adjustment != null) {
+      Allocation allocation;
+      this.get_allocation (out allocation);
+      adjustment.clamp_page (cursor_child.y + allocation.y,
+			     cursor_child.y + allocation.y + cursor_child.height);
+    }
   }
 
   private void update_selected (ChildInfo? child) {



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