Re: [Patch] unify wrapped label creation



Hi Albrecht:

On 01/25/2020 09:27:36 AM Sat, Albrecht Dreß wrote:
Hi all,

as a follow-up to the recent discussion re. label wrapping and alignment, attached is a patch which attempts 
to clean up this issue a little bit:
* create a new helper for wrapped labels, including the halign and xalign properties and
* remove calls for setting default values (like GTK_JUSTIFY_LEFT or wrap = FALSE).

The patch works with the master and gmime3 branches, with a 2-line offset in libbalsa/misc.c for the latter.

Opinions?

Cheers,
Albrecht.

Thanks for looking into the alignment issues!

After reading the GtkAlign enum documentation[0] and the GtkLabel::xalign property documentation[1], I'm inclined to 
believe that the best "halign" choice for a GtkLabel is the default GTK_ALIGN_FILL. When we use 
GTK_ALIGN_START (or occasionally GTK_ALIGN_END), the label widget may not fill all the space allocated to it; that 
doesn't seem to be a problem for me, but it would presumably look bad if someone set different backgrounds for the 
GtkLabel and whatever widget contains it.

If I'm right (and I recognize a substantial probability that I'm wrong!-), we should just use the "xalign" 
property to make sure that the text is flush left (or occasionally flush right) in the space allocated to the widget.

Does that make any sense?

BTW: Other parts of the Gtklabel documentation mention using halign, and not xalign, to " set the alignment of the label as a 
whole" (see the section "Text layout" and the entry for gtk_label_set_justify), but those comments predate 
"xalign", and I'm guessing they're just out of date.

Best,

Peter

[0] https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkAlign
[1] https://developer.gnome.org/gtk3/stable/GtkLabel.html#GtkLabel--xalign

Attachment: pgpjDyhsvlTQ9.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]