[geary] Fix conversation message placholders being duplicated/not hidden



commit 55a6d79f412f8ce64a0b68bae38e717335c41f73
Author: Michael Gratton <mike vee net>
Date:   Thu Feb 7 17:08:59 2019 +1100

    Fix conversation message placholders being duplicated/not hidden

 .../conversation-viewer/conversation-message.vala  | 37 ++++++++++++----------
 1 file changed, 21 insertions(+), 16 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-message.vala 
b/src/client/conversation-viewer/conversation-message.vala
index c1712851..a238f30b 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -523,10 +523,7 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
         //pane.subtitle = _(
         //    "This email cannot currently be displayed"
         //);
-        this.body_placeholder = pane;
-        this.web_view.hide();
-        this.body_container.add(pane);
-        show_message_body(true);
+        show_placeholder_pane(pane);
         start_progress_pulse();
     }
 
@@ -549,10 +546,7 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
         //pane.subtitle = _(
         //    "This email cannot currently be displayed"
         //);
-        this.body_placeholder = pane;
-        this.web_view.hide();
-        this.body_container.add(pane);
-        show_message_body(true);
+        show_placeholder_pane(pane);
         stop_progress_pulse();
     }
 
@@ -576,10 +570,7 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
         // pane.subtitle = _(
         //     "This email will be downloaded when reconnected to the Internet"
         // );
-        this.body_placeholder = pane;
-        this.web_view.hide();
-        this.body_container.add(pane);
-        show_message_body(true);
+        show_placeholder_pane(pane);
         stop_progress_pulse();
     }
 
@@ -654,10 +645,7 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
             throw new GLib.IOError.CANCELLED("Conversation load cancelled");
         }
 
-        this.web_view.show();
-        if (this.body_placeholder != null) {
-            this.body_placeholder.hide();
-        }
+        show_placeholder_pane(null);
 
         string? body_text = null;
         try {
@@ -900,6 +888,23 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
         }
     }
 
+    private void show_placeholder_pane(Gtk.Widget? placeholder) {
+        if (this.body_placeholder != null) {
+            this.body_placeholder.hide();
+            this.body_container.remove(this.body_placeholder);
+            this.body_placeholder = null;
+        }
+
+        if (placeholder != null) {
+            this.body_placeholder = placeholder;
+            this.web_view.hide();
+            this.body_container.add(placeholder);
+            show_message_body(true);
+        } else {
+            this.web_view.show();
+        }
+    }
+
     private inline void set_revealer(Gtk.Revealer revealer,
                                      bool expand,
                                      bool use_transition) {


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