[geary/wip/728002-webkit2: 81/96] Fix attachments being added to the conversation email view many times.



commit a66739dc67362f65919754c8c955b3fb3e17cf3f
Author: Michael James Gratton <mike vee net>
Date:   Wed Jan 4 21:12:26 2017 +1100

    Fix attachments being added to the conversation email view many times.
    
    * src/client/components/client-web-view.vala (ClientWebView::has_valid_height),
      src/client/conversation-viewer/conversation-email.vala
      (ConversationEmail::message_bodies_loaded): Only update the values of
      these properties when they have actually changed, to avoid sending
      multiple notifies out for them.

 src/client/components/client-web-view.vala         |    6 +++++-
 .../conversation-viewer/conversation-email.vala    |    4 +++-
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/client/components/client-web-view.vala b/src/client/components/client-web-view.vala
index fe49820..7520732 100644
--- a/src/client/components/client-web-view.vala
+++ b/src/client/components/client-web-view.vala
@@ -237,7 +237,11 @@ public class ClientWebView : WebKit.WebView {
                 try {
                     this.preferred_height = (int) WebKitUtil.to_number(result);
                     if (this.preferred_height >= 1) {
-                        this.has_valid_height = true;
+                        if (!this.has_valid_height) {
+                            // Only update the property value if not
+                            // already true
+                            this.has_valid_height = true;
+                        }
                         queue_resize();
                     }
                 } catch (Geary.JS.Error err) {
diff --git a/src/client/conversation-viewer/conversation-email.vala 
b/src/client/conversation-viewer/conversation-email.vala
index f6b4f6f..4ea63f3 100644
--- a/src/client/conversation-viewer/conversation-email.vala
+++ b/src/client/conversation-viewer/conversation-email.vala
@@ -639,7 +639,9 @@ public class ConversationEmail : Gtk.Box {
                         }
                         return true;
                     });
-                if (all_loaded == true) {
+                if (all_loaded == true && !this.message_bodies_loaded) {
+                    // Only update the property value if not already
+                    // true
                     this.message_bodies_loaded = true;
                 }
             });


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