[geary/wip/765516-gtk-widget-conversation-viewer: 101/207] Ensure embedded composer is always located below its referred message.



commit 48a45cccd43a863263dac68045358add1060f0e7
Author: Michael James Gratton <mike vee net>
Date:   Fri Jul 8 16:27:44 2016 +1000

    Ensure embedded composer is always located below its referred message.

 .../conversation-viewer/conversation-email.vala    |   14 +++++++++
 .../conversation-viewer/conversation-viewer.vala   |   30 ++++++++++----------
 ui/geary.css                                       |   11 ++-----
 3 files changed, 32 insertions(+), 23 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-email.vala 
b/src/client/conversation-viewer/conversation-email.vala
index a63fa00..788a40d 100644
--- a/src/client/conversation-viewer/conversation-email.vala
+++ b/src/client/conversation-viewer/conversation-email.vala
@@ -380,6 +380,20 @@ public class ConversationEmail : Gtk.Box {
             : null;
     }
 
+    /**
+     * Attach an embedded composer to this email view.
+     */
+    public void attach_composer(ComposerEmbed embed) {
+        add(embed);
+    }
+
+    /**
+     * Detaches an embedded composer to this email view.
+     */
+    public void remove_composer(ComposerEmbed embed) {
+        remove(embed);
+    }
+
     private SimpleAction add_action(string name) {
         SimpleAction action = new SimpleAction(name, null);
         message_actions.add_action(action);
diff --git a/src/client/conversation-viewer/conversation-viewer.vala 
b/src/client/conversation-viewer/conversation-viewer.vala
index 0a0cc47..57a3ab7 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -299,21 +299,21 @@ public class ConversationViewer : Gtk.Stack {
         ComposerEmbed embed = new ComposerEmbed(
             referred, composer, conversation_page
         );
-        embed.set_property("name", "composer_embed"); // Bug 764622
-
-        Gtk.ListBoxRow row = new Gtk.ListBoxRow();
-        row.get_style_context().add_class("geary_composer");
-        row.show();
-        row.add(embed);
-        conversation_listbox.add(row);
-
-        embed.loaded.connect((box) => {
-                row.grab_focus();
-            });
-        embed.vanished.connect((box) => {
-                conversation_listbox.remove(row);
-            });
+        embed.get_style_context().add_class("geary-composer-embed");
 
+        ConversationEmail? email_view = conversation_email_for_id(referred.id);
+        if (email_view != null) {
+            email_view.attach_composer(embed);
+            embed.loaded.connect((box) => {
+                    embed.grab_focus();
+                });
+            embed.vanished.connect((box) => {
+                    email_view.remove_composer(embed);
+                });
+        } else {
+            error("Could not find referred email for embedded composer: %s",
+                  referred.id.to_string());
+        }
     }
 
     /**
diff --git a/ui/geary.css b/ui/geary.css
index 618f6a3..61883a3 100644
--- a/ui/geary.css
+++ b/ui/geary.css
@@ -33,11 +33,6 @@
   border-bottom-width: 0;
 }
 
-ComposerEmbed GtkHeaderBar,
-ComposerBox GtkHeaderBar,
-GtkBox.vertical GtkHeaderBar {
-  border-radius: 0px;
-}
 .geary-titlebar-left:dir(ltr),
 .geary-titlebar-right:dir(rtl) {
   border-top-right-radius: 0px;
@@ -75,9 +70,8 @@ row.geary-folder-popover-list-row > label {
 #conversation_listbox > row:hover > box {
   background: shade(@theme_base_color, 0.96);
 }
-#conversation_listbox > row.geary_expand,
-#conversation_listbox > row.geary_composer {
   margin-bottom: 18px;
+#conversation_listbox > row.geary_expand {
   border-bottom-width: 1px;
 }
 #conversation_listbox > row.geary_last {
@@ -98,7 +92,8 @@ row.geary-folder-popover-list-row > label {
   background-image: linear-gradient(rgba(0,0,0,0.2), @bg_color 6px);
 }
 
-#composer_embed headerbar {
+.geary-composer-embed headerbar {
+  border-top: 1px solid @borders;
   border-radius: 0px;
 }
 


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