From 6ae4cd620ff3c0605c7f3bed415c31e32589c9f3 Mon Sep 17 00:00:00 2001 From: Niels De Graef Date: Sun, 19 Nov 2023 22:58:04 +0100 Subject: [PATCH] composer-widget: Ellipsize long attachment names If an attachment name is way too long, the attachment name label forces the composer widget to become too wide which breaks on smaller screens. To fix this, ellipsize the label if needed. Since the user has probably just chosen the attachment, they probably have an idea which attachment it is anyway, so we can do this instead of wrapping. Since the file extension can make a big difference, we ellipsize in the middle. When a label is ellipsized, we also add the label as a tooltip in case a user wants to double check the attachment name though. Fixes: https://gitlab.gnome.org/GNOME/geary/-/issues/1577 --- src/client/composer/composer-widget.vala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala index 412c8a3b..965898e8 100644 --- a/src/client/composer/composer-widget.vala +++ b/src/client/composer/composer-widget.vala @@ -1872,6 +1872,9 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface { Gtk.Label label = new Gtk.Label(label_text); box.pack_start(label); label.halign = Gtk.Align.START; + label.ellipsize = Pango.EllipsizeMode.MIDDLE; + label.has_tooltip = true; + label.query_tooltip.connect(Util.Gtk.query_tooltip_label); Gtk.Button remove_button = new Gtk.Button.from_icon_name("user-trash-symbolic", BUTTON); box.pack_start(remove_button, false, false);