Compact header for inline replies

This commit is contained in:
Robert Schroll 2014-05-15 23:27:33 -07:00 committed by Jim Nelson
parent 35e3cdfd9b
commit 94c15bd461
3 changed files with 40 additions and 5 deletions

View file

@ -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);

View file

@ -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) {

View file

@ -196,6 +196,23 @@
<property name="can_focus">False</property>
<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>