[geary/wip/765516-gtk-widget-conversation-viewer: 73/103] Allow ConversationEmail to manage its infobars indep. of ConversationMessage.



commit 68507fa22cabf1bb4fb10c955277ea8fbdeaeab3
Author: Michael James Gratton <mike vee net>
Date:   Thu Apr 21 16:07:08 2016 +1000

    Allow ConversationEmail to manage its infobars indep. of ConversationMessage.
    
    * src/client/conversation-viewer/conversation-email.vala: Move the
      draft_infobar wdiget from ConversationMessage, when the message is a
      draft add it to ConversationMessage's infobar box and show it.
    
    * ui/conversation-email.ui: Move the draft_infobar definition from
      conversation-message.ui here.
    
    * ui/conversation-message.ui: Wrap the remote messages infobar in an box
      so that ConversationEmail can easily append its own in the same location.

 .../conversation-viewer/conversation-email.vala    |   17 +-
 .../conversation-viewer/conversation-message.vala  |    2 +-
 ui/conversation-email.ui                           |   74 ++++++
 ui/conversation-message.ui                         |  235 +++++++-------------
 4 files changed, 170 insertions(+), 158 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-email.vala 
b/src/client/conversation-viewer/conversation-email.vala
index 998ba66..4143717 100644
--- a/src/client/conversation-viewer/conversation-email.vala
+++ b/src/client/conversation-viewer/conversation-email.vala
@@ -57,6 +57,9 @@ public class ConversationEmail : Gtk.Box {
     private Gtk.MenuButton email_menubutton;
 
     [GtkChild]
+    private Gtk.InfoBar draft_infobar;
+
+    [GtkChild]
     private Gtk.Box sub_messages_box;
 
     [GtkChild]
@@ -102,17 +105,19 @@ public class ConversationEmail : Gtk.Box {
         primary_message.web_view.link_selected.connect((link) => {
                 link_activated(link);
             });
-        primary_message.draft_infobar.response.connect((infobar, response_id) => {
-                if (response_id == 1) { edit_draft(email); }
-            });
         primary_message.summary_box.pack_start(action_box, false, false, 0);
-        if (is_draft) {
-            primary_message.draft_infobar.show();
-        }
 
         email_menubutton.set_menu_model(build_message_menu(email));
         email_menubutton.set_sensitive(false);
 
+        primary_message.infobar_box.pack_start(draft_infobar, false, false, 0);
+        if (is_draft) {
+            draft_infobar.show();
+            draft_infobar.response.connect((infobar, response_id) => {
+                    if (response_id == 1) { edit_draft(email); }
+                });
+        }
+
         // if (email.from != null && email.from.contains_normalized(current_account_information.email)) {
         //  // XXX set a RO property?
         //  get_style_context().add_class("sent");
diff --git a/src/client/conversation-viewer/conversation-message.vala 
b/src/client/conversation-viewer/conversation-message.vala
index d505d0c..bc79a25 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -64,7 +64,7 @@ public class ConversationMessage : Gtk.Box {
     public Gtk.Box summary_box; // not yet supported: { get; private set; }
 
     [GtkChild]
-    public Gtk.InfoBar draft_infobar; // not yet supported: { get; private set; }
+    public Gtk.Box infobar_box; // not yet supported: { get; private set; }
 
     [GtkChild]
     private Gtk.Image avatar_image;
diff --git a/ui/conversation-email.ui b/ui/conversation-email.ui
index 50e80d6..e15e712 100644
--- a/ui/conversation-email.ui
+++ b/ui/conversation-email.ui
@@ -163,6 +163,80 @@
       </packing>
     </child>
   </object>
+  <object class="GtkInfoBar" id="draft_infobar">
+    <property name="app_paintable">True</property>
+    <property name="can_focus">False</property>
+    <property name="message_type">warning</property>
+    <child internal-child="action_area">
+      <object class="GtkButtonBox">
+        <property name="can_focus">False</property>
+        <property name="spacing">6</property>
+        <property name="layout_style">end</property>
+        <child>
+          <object class="GtkButton" id="button3">
+            <property name="label" translatable="yes">Edit Draft</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child internal-child="content_area">
+      <object class="GtkBox">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Draft message</property>
+            <property name="xalign">0</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">This message has not yet been sent.</property>
+            <property name="xalign">0</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <action-widgets>
+      <action-widget response="1">button3</action-widget>
+    </action-widgets>
+  </object>
   <object class="GtkBox" id="sub_messages_box">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
diff --git a/ui/conversation-message.ui b/ui/conversation-message.ui
index 876318e..e1596e3 100644
--- a/ui/conversation-message.ui
+++ b/ui/conversation-message.ui
@@ -412,185 +412,118 @@
               </packing>
             </child>
             <child>
-              <object class="GtkInfoBar" id="remote_images_infobar">
-                <property name="app_paintable">True</property>
+              <object class="GtkBox" id="infobar_box">
+                <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="no_show_all">True</property>
-                <property name="message_type">warning</property>
-                <property name="show_close_button">True</property>
-                <signal name="response" handler="on_remote_images_response" swapped="no"/>
-                <child internal-child="action_area">
-                  <object class="GtkButtonBox">
-                    <property name="can_focus">False</property>
-                    <property name="spacing">6</property>
-                    <property name="layout_style">end</property>
-                    <child>
-                      <object class="GtkButton" id="button1">
-                        <property name="label" translatable="yes">Show Images</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkButton" id="button2">
-                        <property name="label" translatable="yes">Always Show From Sender</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">2</property>
-                        <property name="non_homogeneous">True</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child internal-child="content_area">
-                  <object class="GtkBox">
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkInfoBar" id="remote_images_infobar">
+                    <property name="app_paintable">True</property>
                     <property name="can_focus">False</property>
-                    <property name="orientation">vertical</property>
-                    <property name="spacing">2</property>
-                    <child>
-                      <object class="GtkLabel">
-                        <property name="visible">True</property>
+                    <property name="no_show_all">True</property>
+                    <property name="message_type">warning</property>
+                    <property name="show_close_button">True</property>
+                    <signal name="response" handler="on_remote_images_response" swapped="no"/>
+                    <child internal-child="action_area">
+                      <object class="GtkButtonBox">
                         <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Remote images not shown</property>
-                        <property name="xalign">0</property>
-                        <attributes>
-                          <attribute name="weight" value="bold"/>
-                        </attributes>
+                        <property name="spacing">6</property>
+                        <property name="layout_style">end</property>
+                        <child>
+                          <object class="GtkButton" id="button1">
+                            <property name="label" translatable="yes">Show Images</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="button2">
+                            <property name="label" translatable="yes">Always Show From Sender</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
+                            <property name="non_homogeneous">True</property>
+                          </packing>
+                        </child>
                       </object>
                       <packing>
                         <property name="expand">True</property>
-                        <property name="fill">True</property>
+                        <property name="fill">False</property>
                         <property name="position">0</property>
                       </packing>
                     </child>
-                    <child>
-                      <object class="GtkLabel">
-                        <property name="visible">True</property>
+                    <child internal-child="content_area">
+                      <object class="GtkBox">
                         <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Only show remote images from senders you 
trust.</property>
-                        <property name="xalign">0</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">2</property>
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Remote images not shown</property>
+                            <property name="xalign">0</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Only show remote images from senders 
you trust.</property>
+                            <property name="xalign">0</property>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
                       </object>
                       <packing>
                         <property name="expand">True</property>
                         <property name="fill">True</property>
-                        <property name="position">1</property>
+                        <property name="position">0</property>
                       </packing>
                     </child>
+                    <action-widgets>
+                      <action-widget response="1">button1</action-widget>
+                      <action-widget response="2">button2</action-widget>
+                    </action-widgets>
                   </object>
                   <packing>
-                    <property name="expand">True</property>
+                    <property name="expand">False</property>
                     <property name="fill">True</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
-                <action-widgets>
-                  <action-widget response="1">button1</action-widget>
-                  <action-widget response="2">button2</action-widget>
-                </action-widgets>
               </object>
               <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
                 <property name="position">1</property>
               </packing>
             </child>
             <child>
-              <object class="GtkInfoBar" id="draft_infobar">
-                <property name="app_paintable">True</property>
-                <property name="can_focus">False</property>
-                <property name="no_show_all">True</property>
-                <property name="message_type">warning</property>
-                <child internal-child="action_area">
-                  <object class="GtkButtonBox">
-                    <property name="can_focus">False</property>
-                    <property name="spacing">6</property>
-                    <property name="layout_style">end</property>
-                    <child>
-                      <object class="GtkButton" id="button3">
-                        <property name="label" translatable="yes">Edit Draft</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child internal-child="content_area">
-                  <object class="GtkBox">
-                    <property name="can_focus">False</property>
-                    <property name="orientation">vertical</property>
-                    <property name="spacing">2</property>
-                    <child>
-                      <object class="GtkLabel">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Draft message</property>
-                        <property name="xalign">0</property>
-                        <attributes>
-                          <attribute name="weight" value="bold"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">This message has not yet been 
sent.</property>
-                        <property name="xalign">0</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <action-widgets>
-                  <action-widget response="1">button3</action-widget>
-                </action-widgets>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">2</property>
-              </packing>
+              <placeholder/>
             </child>
           </object>
         </child>


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