From 254e1c39cea8e4bf1da3db31488a97c198674658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 5 Aug 2026 12:17:30 -0700 Subject: [PATCH] Composer: cleanup and GTK4 prep --- src/Composer.vala | 76 +++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/src/Composer.vala b/src/Composer.vala index 2753a87d5..2126c31bc 100644 --- a/src/Composer.vala +++ b/src/Composer.vala @@ -85,16 +85,17 @@ public class Mail.Composer : Hdy.ApplicationWindow { headerbar.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT); headerbar.get_style_context ().add_class ("default-decoration"); + from_combo = new Gtk.ComboBoxText () { + hexpand = true + }; + var from_label = new Gtk.Label (_("From:")) { + mnemonic_widget = from_combo, xalign = 1 }; from_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); - from_combo = new Gtk.ComboBoxText () { - hexpand = true - }; - - var from_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6) { + var from_box = new Gtk.Box (HORIZONTAL, 6) { margin_bottom = 6 }; from_box.add (from_label); @@ -104,19 +105,15 @@ public class Mail.Composer : Hdy.ApplicationWindow { child = from_box }; - var to_label = new Gtk.Label (_("To:")) { - xalign = 1 + to_val = new Gtk.Entry () { + hexpand = true }; - to_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); - var subject_label = new Gtk.Label (_("Subject:")) { + var to_label = new Gtk.Label (_("To:")) { + mnemonic_widget = to_val, xalign = 1 }; - subject_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); - - to_val = new Gtk.Entry () { - hexpand = true - }; + to_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); cc_button = new Gtk.ToggleButton.with_label (_("Cc")); @@ -127,16 +124,17 @@ public class Mail.Composer : Hdy.ApplicationWindow { to_grid.add (cc_button); to_grid.add (bcc_button); + cc_val = new Gtk.Entry () { + hexpand = true + }; + var cc_label = new Gtk.Label (_("Cc:")) { + mnemonic_widget = cc_val, xalign = 1 }; cc_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); - cc_val = new Gtk.Entry () { - hexpand = true - }; - - var cc_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6) { + var cc_box = new Gtk.Box (HORIZONTAL, 6) { margin_top = 6 }; cc_box.add (cc_label); @@ -145,16 +143,17 @@ public class Mail.Composer : Hdy.ApplicationWindow { cc_revealer = new Gtk.Revealer (); cc_revealer.add (cc_box); + bcc_val = new Gtk.Entry () { + hexpand = true + }; + var bcc_label = new Gtk.Label (_("Bcc:")) { + mnemonic_widget = bcc_val, xalign = 1 }; bcc_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); - bcc_val = new Gtk.Entry () { - hexpand = true - }; - - var bcc_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6) { + var bcc_box = new Gtk.Box (HORIZONTAL, 6) { margin_top = 6 }; bcc_box.add (bcc_label); @@ -167,6 +166,12 @@ public class Mail.Composer : Hdy.ApplicationWindow { margin_top = 6 }; + var subject_label = new Gtk.Label (_("Subject:")) { + mnemonic_widget = subject_val, + xalign = 1 + }; + subject_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); + subject_val.changed.connect (() => { title = subject_val.text; }); @@ -268,8 +273,10 @@ public class Mail.Composer : Hdy.ApplicationWindow { action_bar.pack_start (signature_button); action_bar.pack_end (send); - var view_overlay = new Gtk.Overlay (); - view_overlay.add (web_view); + var view_overlay = new Gtk.Overlay () { + child = web_view + }; + message_url_overlay = new Granite.Widgets.OverlayBar (view_overlay); message_url_overlay.no_show_all = true; @@ -277,7 +284,7 @@ public class Mail.Composer : Hdy.ApplicationWindow { main_box.add (headerbar); main_box.add (recipient_grid); main_box.add (editor_toolbar); - main_box.add (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); + main_box.add (new Gtk.Separator (HORIZONTAL)); main_box.add (view_overlay); main_box.add (attachment_box); main_box.add (action_bar); @@ -313,9 +320,7 @@ public class Mail.Composer : Hdy.ApplicationWindow { bind_property ("has-recipients", send, "sensitive"); bind_property ("title", headerbar, "title"); - cc_button.clicked.connect (() => { - cc_revealer.reveal_child = cc_button.active; - }); + cc_button.bind_property ("active", cc_revealer, "reveal-child", SYNC_CREATE); cc_val.changed.connect (() => { on_sanitize_recipient_entry (cc_val); @@ -326,9 +331,7 @@ public class Mail.Composer : Hdy.ApplicationWindow { } }); - bcc_button.clicked.connect (() => { - bcc_revealer.reveal_child = bcc_button.active; - }); + bcc_button.bind_property ("active", bcc_revealer, "reveal-child", SYNC_CREATE); bcc_val.changed.connect (() => { on_sanitize_recipient_entry (bcc_val); @@ -382,12 +385,12 @@ public class Mail.Composer : Hdy.ApplicationWindow { } if ("bcc" in result) { - bcc_button.clicked (); + bcc_button.active = true; bcc_val.text = result["bcc"].to_array ()[0]; } if ("cc" in result) { - cc_button.clicked (); + cc_button.active = true; cc_val.text = result["cc"].to_array ()[0]; } @@ -1055,7 +1058,8 @@ public class Mail.Composer : Hdy.ApplicationWindow { margin_bottom = 3; margin_start = 3; margin_end = 3; - add (box); + + child = box; remove_button.clicked.connect (() => { destroy ();