[geary/wip/765516-gtk-widget-conversation-viewer: 109/117] Simplify how ConversationListBox removal, explicitly destroy them.



commit 6467fef70adaaa65881a7bba4631e631e37c9963
Author: Michael James Gratton <mike vee net>
Date:   Thu Jul 28 00:03:59 2016 +1000

    Simplify how ConversationListBox removal, explicitly destroy them.
    
    As for the composers in the last commit, manually destroying old lists
    lists seems to be required.

 .../conversation-viewer/conversation-viewer.vala   |   23 +++++++------------
 1 files changed, 9 insertions(+), 14 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-viewer.vala 
b/src/client/conversation-viewer/conversation-viewer.vala
index 8328810..2e3f502 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -274,22 +274,17 @@ public class ConversationViewer : Gtk.Stack {
 
     // Remove any existing conversation list, cancelling its loading
     private void remove_current_list() {
-        Gtk.Viewport? viewport =
-            this.conversation_page.get_child() as Gtk.Viewport;
-        if (viewport != null) {
-            ConversationListBox? previous_list =
-                viewport.get_child() as ConversationListBox;
-            if (previous_list != null) {
-                // Cancel any pending avatar loads here, rather than in
-                // ConversationListBox, sinece we don't have per-message
-                // control of it when using Soup.Session.queue_message.
-                GearyApplication.instance.controller.avatar_session.flush_queue();
-                previous_list.cancel_load();
-                this.conversation_removed(previous_list);
-            }
-            this.conversation_page.remove(viewport);
+        if (this.current_list != null) {
+            GearyApplication.instance.controller.avatar_session.flush_queue();
+            this.current_list.cancel_load();
+            this.conversation_removed(this.current_list);
+            this.current_list.destroy();
             this.current_list = null;
         }
+        Gtk.Widget? scrolled_child = this.conversation_page.get_child();
+        if (scrolled_child != null) {
+            scrolled_child.destroy();
+        }
     }
 
     // State reset.


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