Skip to content

Commit

Permalink
ComposerWindow: Use subject as title (#747)
Browse files Browse the repository at this point in the history
  • Loading branch information
meisenzahl authored Jan 11, 2022
1 parent d1b2288 commit 597229b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
9 changes: 9 additions & 0 deletions data/io.elementary.mail.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@
<binary>io.elementary.mail</binary>
</provides>
<releases>
<release version="6.3.2" date="2022-01-11" urgency="medium">
<description>
<p>Improvements:</p>
<ul>
<li>Use message subject for compose window title</li>
<li>Updated translations</li>
</ul>
</description>
</release>
<release version="6.3.1" date="2021-12-13" urgency="medium">
<description>
<p>Fixes:</p>
Expand Down
4 changes: 4 additions & 0 deletions src/Composer/ComposerWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
public class Mail.ComposerWidget : Gtk.Grid {
public signal void discarded ();
public signal void sent ();
public signal void subject_changed (string? subject);

private const string ACTION_GROUP_PREFIX = "composer";
private const string ACTION_PREFIX = ACTION_GROUP_PREFIX + ".";
Expand Down Expand Up @@ -168,6 +169,9 @@ public class Mail.ComposerWidget : Gtk.Grid {

subject_val = new Gtk.Entry ();
subject_val.margin_top = 6;
subject_val.changed.connect (() => {
subject_changed (subject_val.text);
});

var size_group = new Gtk.SizeGroup (Gtk.SizeGroupMode.HORIZONTAL);
size_group.add_widget (from_label);
Expand Down
19 changes: 13 additions & 6 deletions src/Composer/ComposerWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,26 @@ public class Mail.ComposerWindow : Hdy.ApplicationWindow {
}

construct {
var titlebar = new Hdy.HeaderBar () {
has_subtitle = false,
show_close_button = true,
title = _("New Message")
};
titlebar.get_style_context ().add_class ("default-decoration");

composer_widget.discarded.connect (() => {
close ();
});
composer_widget.sent.connect (() => {
close ();
});
composer_widget.subject_changed.connect ((subject) => {
if (subject == null || subject.length == 0) {
subject = _("New Message");
}

var titlebar = new Hdy.HeaderBar () {
has_subtitle = false,
show_close_button = true,
title = _("New Message")
};
titlebar.get_style_context ().add_class ("default-decoration");
titlebar.title = title = subject;
});

var content_grid = new Gtk.Grid ();
content_grid.orientation = Gtk.Orientation.VERTICAL;
Expand Down

0 comments on commit 597229b

Please sign in to comment.