Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use subject for window title of new message window #747

Merged
merged 11 commits into from
Jan 11, 2022
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