[geary] Compact header for inline replies



commit 94c15bd461907e2f30559f47a6932a2009b38da1
Author: Robert Schroll <rschroll gmail com>
Date:   Thu May 15 23:27:33 2014 -0700

    Compact header for inline replies

 src/client/composer/composer-embed.vala  |    4 ++--
 src/client/composer/composer-widget.vala |   24 +++++++++++++++++++++---
 ui/composer.glade                        |   17 +++++++++++++++++
 3 files changed, 40 insertions(+), 5 deletions(-)
---
diff --git a/src/client/composer/composer-embed.vala b/src/client/composer/composer-embed.vala
index d3bf44f..ceaeabb 100644
--- a/src/client/composer/composer-embed.vala
+++ b/src/client/composer/composer-embed.vala
@@ -58,7 +58,7 @@ public class ComposerEmbed : Gtk.Bin, ComposerContainer {
     }
     
     public void on_detach() {
-        composer.inline = false;
+        composer.inline = composer.inline_reply = false;
         if (composer.editor.has_focus)
             on_focus_out();
         composer.editor.focus_in_event.disconnect(on_focus_in);
@@ -103,7 +103,7 @@ public class ComposerEmbed : Gtk.Bin, ComposerContainer {
     
     public void vanish() {
         hide();
-        composer.inline = false;
+        composer.inline = composer.inline_reply = false;
         composer.editor.focus_in_event.disconnect(on_focus_in);
         composer.editor.focus_out_event.disconnect(on_focus_out);
         
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index 3b71f2c..6454366 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -135,6 +135,7 @@ public class ComposerWidget : Gtk.EventBox {
     }
     
     public bool inline { get; set; default = true; }
+    public bool inline_reply { get; set; }
     
     public ComposeType compose_type { get; private set; default = ComposeType.NEW_MESSAGE; }
     
@@ -166,6 +167,7 @@ public class ComposerWidget : Gtk.EventBox {
     private Gtk.Alignment visible_on_attachment_drag_over;
     private Gtk.Widget hidden_on_attachment_drag_over_child;
     private Gtk.Widget visible_on_attachment_drag_over_child;
+    private Gtk.Label compact_header;
     private Gtk.Label draft_save_label;
     
     private Gtk.Menu menu = new Gtk.Menu();
@@ -235,6 +237,18 @@ public class ComposerWidget : Gtk.EventBox {
         visible_on_attachment_drag_over_child = (Gtk.Widget) 
builder.get_object("visible_on_attachment_drag_over_child");
         visible_on_attachment_drag_over.remove(visible_on_attachment_drag_over_child);
         
+        Gtk.Widget recipients = builder.get_object("recipients") as Gtk.Widget;
+        bind_property("inline-reply", recipients, "visible",
+            BindingFlags.INVERT_BOOLEAN | BindingFlags.SYNC_CREATE);
+        compact_header = builder.get_object("compact_recipients") as Gtk.Label;
+        bind_property("inline-reply", compact_header, "visible",
+            BindingFlags.SYNC_CREATE);
+        // Set the visibilities later, after show_all is called on the widget.
+        Idle.add(() => {
+            inline_reply = (compose_type != ComposeType.NEW_MESSAGE);
+            return false;
+        });
+        
         from_label = (Gtk.Label) builder.get_object("from label");
         from_single = (Gtk.Label) builder.get_object("from_single");
         from_multiple = (Gtk.ComboBoxText) builder.get_object("from_multiple");
@@ -1073,9 +1087,13 @@ public class ComposerWidget : Gtk.EventBox {
     private void validate_send_button() {
         send_button.sensitive =
             to_entry.valid_or_empty && cc_entry.valid_or_empty && bcc_entry.valid_or_empty
-         && (!to_entry.empty || !cc_entry.empty || !bcc_entry.empty);
-         
-         reset_draft_timer();
+            && (!to_entry.empty || !cc_entry.empty || !bcc_entry.empty);
+        bool tocc = !to_entry.empty && !cc_entry.empty,
+            ccbcc = !(to_entry.empty && cc_entry.empty) && !bcc_entry.empty;
+        compact_header.label = _("To: ") + to_entry.buffer.text + (tocc ? ", " : "")
+            + cc_entry.buffer.text + (ccbcc ? ", " : "") + bcc_entry.buffer.text;
+        
+        reset_draft_timer();
     }
     
     private void on_formatting_action(Gtk.Action action) {
diff --git a/ui/composer.glade b/ui/composer.glade
index 47fc1da..426fe05 100644
--- a/ui/composer.glade
+++ b/ui/composer.glade
@@ -197,6 +197,23 @@
             <property name="orientation">vertical</property>
             <property name="spacing">6</property>
             <child>
+              <object class="GtkLabel" id="compact_recipients">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_left">6</property>
+                <property name="margin_right">6</property>
+                <property name="margin_top">6</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">You're sending an email!</property>
+                <property name="ellipsize">end</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkGrid" id="recipients">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>


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