[geary] Fix scrolling to the top on new messages



commit c0a62ef1735b9d6028e8996b2026f35cf7901328
Author: Charles Lindsay <chaz yorba org>
Date:   Thu Mar 6 13:17:24 2014 -0800

    Fix scrolling to the top on new messages
    
    This introduces the possibility of reentrancy, which was guarded against
    before.  It seems harmless, though.  Regardless, we'll keep our eyes
    peeled for any issues related to it.
    
    Closes: bgo #720712

 .../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]