[geary/wip/765516-gtk-widget-conversation-viewer: 91/174] Minor conversation code cleanup.



commit 95a9fb80bb2e8b78fb67a91390487a122982ba7f
Author: Michael James Gratton <mike vee net>
Date:   Tue Jul 26 15:17:06 2016 +1000

    Minor conversation code cleanup.

 .../conversation-viewer/conversation-listbox.vala  |   10 +++++-----
 .../conversation-viewer/conversation-message.vala  |    8 +-------
 2 files changed, 6 insertions(+), 12 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-listbox.vala 
b/src/client/conversation-viewer/conversation-listbox.vala
index 96ab9da..bf38803 100644
--- a/src/client/conversation-viewer/conversation-listbox.vala
+++ b/src/client/conversation-viewer/conversation-listbox.vala
@@ -98,8 +98,7 @@ public class ConversationListBox : Gtk.ListBox {
             // message has a non-trivial height, and then wait for it
             // to be reallocated, so that it picks up the web_view's
             // height.
-            ConversationWebView web_view = view.primary_message.web_view;
-            if (web_view.load_status == WebKit.LoadStatus.FINISHED) {
+            if (view.primary_message.is_loading_complete) {
                 // Disable should_scroll after the message body has
                 // been loaded so we don't keep on scrolling later,
                 // like when the window has been resized.
@@ -311,13 +310,14 @@ public class ConversationListBox : Gtk.ListBox {
                 !email_view.is_manually_read) {
                  int body_top = 0;
                  int body_left = 0;
-                 conversation_message.web_view.translate_coordinates(
+                 ConversationWebView web_view = conversation_message.web_view;
+                 web_view.translate_coordinates(
                      this,
                      0, 0,
                      out body_left, out body_top
                  );
-                 int body_bottom = body_top +
-                     conversation_message.web_view_allocation.height;
+                 int body_bottom =
+                     body_top + web_view.get_allocated_height();
 
                  // Only mark the email as read if it's actually visible
                  if (body_bottom > top_bound &&
diff --git a/src/client/conversation-viewer/conversation-message.vala 
b/src/client/conversation-viewer/conversation-message.vala
index 5d16eff..7049cba 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -59,9 +59,6 @@ public class ConversationMessage : Gtk.Box {
     /** The specific RFC822 message displayed by this view. */
     public Geary.RFC822.Message message { get; private set; }
 
-    /** Current allocated size of the HTML body view. */
-    public Gdk.Rectangle web_view_allocation { get; private set; }
-
     /** Specifies if the message body been been fully loaded. */
     public bool is_loading_complete = false;
 
@@ -264,9 +261,6 @@ public class ConversationMessage : Gtk.Box {
         this.web_view = new ConversationWebView();
         // Suppress default context menu.
         this.web_view.context_menu.connect(() => { return true; });
-        this.web_view.size_allocate.connect((widget, allocation) => {
-                web_view_allocation = allocation;
-            });
         this.web_view.hovering_over_link.connect(on_hovering_over_link);
         this.web_view.selection_changed.connect(on_selection_changed);
         this.web_view.show();
@@ -393,7 +387,7 @@ public class ConversationMessage : Gtk.Box {
 
                     // XXX Not actually true since remote images will
                     // still be loading.
-                    is_loading_complete = true;
+                    this.is_loading_complete = true;
                 }
             });
 


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