[geary/wip/765516-gtk-widget-conversation-viewer: 190/207] Improve ConversationViewer encapsulation.



commit 2ee52ec596ec4ed7effc1317925e11dd12729964
Author: Michael James Gratton <mike vee net>
Date:   Mon Sep 19 14:20:03 2016 +1000

    Improve ConversationViewer encapsulation.
    
    * src/client/application/geary-controller.vala: Move construction of
      ComposerEmbed into ConversationViewer so its scrollbar doesn't need to
      be made available.

 src/client/application/geary-controller.vala       |   12 +++---------
 .../conversation-viewer/conversation-viewer.vala   |   19 ++++++++++++++++++-
 2 files changed, 21 insertions(+), 10 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 5c455be..972bf21 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -2226,9 +2226,6 @@ public class GearyController : Geary.BaseObject {
         if (!should_create_new_composer(compose_type, referred, quote, is_draft, out inline))
             return;
 
-        ConversationListBox? conversation_view =
-            main_window.conversation_viewer.current_list;
-
         ComposerWidget widget;
         if (mailto != null) {
             widget = new ComposerWidget.from_mailto(current_account, mailto);
@@ -2265,14 +2262,11 @@ public class GearyController : Geary.BaseObject {
                     ACTION_FIND_IN_CONVERSATION
                 ).set_sensitive(false);
             } else {
-                ComposerEmbed embed = new ComposerEmbed(
-                    referred,
+                main_window.conversation_viewer.do_compose_embedded(
                     widget,
-                    main_window.conversation_viewer.conversation_scroller
+                    referred,
+                    is_draft
                 );
-                if (conversation_view != null) {
-                    conversation_view.add_embedded_composer(embed, is_draft);
-                }
             }
         } else {
             new ComposerWindow(widget);
diff --git a/src/client/conversation-viewer/conversation-viewer.vala 
b/src/client/conversation-viewer/conversation-viewer.vala
index a13d283..1ba8ffc 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -43,7 +43,7 @@ public class ConversationViewer : Gtk.Stack {
     private Gtk.Grid composer_page;
 
     [GtkChild]
-    internal Gtk.ScrolledWindow conversation_scroller;
+    private Gtk.ScrolledWindow conversation_scroller;
 
     [GtkChild]
     internal Gtk.SearchBar conversation_find_bar;
@@ -126,6 +126,23 @@ public class ConversationViewer : Gtk.Stack {
     }
 
     /**
+     * Puts the view into composer mode, showing an embedded composer.
+     */
+    public void do_compose_embedded(ComposerWidget composer,
+                                    Geary.Email? referred,
+                                    bool is_draft) {
+        ComposerEmbed embed = new ComposerEmbed(
+            referred,
+            composer,
+            this.conversation_scroller
+        );
+
+        if (this.current_list != null) {
+            this.current_list.add_embedded_composer(embed, is_draft);
+        }
+    }
+
+    /**
      * Shows the loading UI.
      */
     public void show_loading() {


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