[geary/wip/775956-dbus-activation: 6/16] Don't keep loading more conversations when started in background



commit 34e4b47396a8448a52251435968450da89a2811a
Author: Michael Gratton <mike vee net>
Date:   Wed Apr 10 00:51:17 2019 +1000

    Don't keep loading more conversations when started in background

 src/client/application/geary-controller.vala             | 4 +++-
 src/client/conversation-list/conversation-list-view.vala | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 06bc4e4a..36113f94 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -3028,7 +3028,9 @@ public class GearyController : Geary.BaseObject {
     private void on_scan_completed(Geary.App.ConversationMonitor monitor) {
         // Done scanning.  Check if we have enough messages to fill
         // the conversation list; if not, trigger a load_more();
-        if (!main_window.conversation_list_has_scrollbar() &&
+        if (this.main_window != null &&
+            this.main_window.is_visible() &&
+            !this.main_window.conversation_list_has_scrollbar() &&
             monitor == this.current_conversations &&
             monitor.can_load_more) {
             debug("Not enough messages, loading more for folder %s",
diff --git a/src/client/conversation-list/conversation-list-view.vala 
b/src/client/conversation-list/conversation-list-view.vala
index 73b74755..dee8a33b 100644
--- a/src/client/conversation-list/conversation-list-view.vala
+++ b/src/client/conversation-list/conversation-list-view.vala
@@ -141,7 +141,8 @@ public class ConversationListView : Gtk.TreeView, Geary.BaseInterface {
         Gtk.Adjustment adjustment = ((Gtk.Scrollable) this).get_vadjustment();
         double upper = adjustment.get_upper();
         double threshold = upper - adjustment.page_size - LOAD_MORE_HEIGHT;
-        if (this.conversation_monitor.can_load_more &&
+        if (this.is_visible() &&
+            this.conversation_monitor.can_load_more &&
             adjustment.get_value() >= threshold) {
             load_more();
         }


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