[geary/wip/scroll-up-720712] Fix scrolling to the top on new messages



commit f3dfc5d982079c700507b208af9378ea1d20e176
Author: Charles Lindsay <chaz yorba org>
Date:   Wed Mar 5 18:27:47 2014 -0800

    Fix scrolling to the top on new messages

 .../conversation-list/conversation-list-store.vala |    9 +--------
 .../conversation-list/conversation-list-view.vala  |    6 ++++++
 2 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/src/client/conversation-list/conversation-list-store.vala 
b/src/client/conversation-list/conversation-list-store.vala
index b6ea5df..2444f7c 100644
--- a/src/client/conversation-list/conversation-list-store.vala
+++ b/src/client/conversation-list/conversation-list-store.vala
@@ -44,7 +44,6 @@ public class ConversationListStore : Gtk.ListStore {
     private Geary.App.EmailStore? email_store = null;
     private Cancellable? cancellable_folder = null;
     private bool loading_local_only = true;
-    private int conversations_added_counter = 0;
     private Geary.Nonblocking.Mutex refresh_mutex = new Geary.Nonblocking.Mutex();
     private uint update_id = 0;
     
@@ -387,13 +386,7 @@ public class ConversationListStore : Gtk.ListStore {
             if (add_conversation(conversation))
                 added++;
         }
-        int stage = ++conversations_added_counter;
-        debug("Added %d/%d conversations. (stage=%d)", added, conversations.size, stage);
-        
-        while (Gtk.events_pending()) {
-            if (Gtk.main_iteration() || conversations_added_counter != stage)
-                return;
-        }
+        debug("Added %d/%d conversations.", added, conversations.size);
         
         conversations_added_finished();
     }
diff --git a/src/client/conversation-list/conversation-list-view.vala 
b/src/client/conversation-list/conversation-list-view.vala
index 414952b..1d5c0de 100644
--- a/src/client/conversation-list/conversation-list-view.vala
+++ b/src/client/conversation-list/conversation-list-view.vala
@@ -119,6 +119,12 @@ public class ConversationListView : Gtk.TreeView {
         if (!reset_adjustment)
             return;
         
+        // Pump the loop to make sure the new conversations are taking up space
+        // in the window.  Without this, setting the adjustment here is a no-op
+        // because as far as it's concerned, it's already at the top.
+        while (Gtk.events_pending())
+            Gtk.main_iteration();
+        
         Gtk.Adjustment? adjustment = get_adjustment();
         if (adjustment == null)
             return;


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