[sylpheed:33477] Re: [RFC, PATCH] Text in preview header cut under windows border.

Antonio Ospite ospite at studenti.unina.it
Tue Jan 5 20:05:53 JST 2010


On Tue, 29 Dec 2009 00:50:47 +0100
Antonio Ospite <ospite at studenti.unina.it> wrote:

> Hi,
> 
> there is a little glitch in the header of the preview window (and
> panel), when the text (either the Recipient list or the Subject, or
> both) is longer than the window width it is cut under the border in an
> unpleasant way. It is even more unpleasant when an X-Face is present.
>

Ok, the problem is in headerview, and it should derive from the fact
that GtkLabels force their container to grow if we don't tell them
otherwise.

> See the attached images, on the right side.
> This is one of those small, insignificant issues that obsess you once
> you notice them :)
> 
> Could we fix this by "ellipsizing" the text, or wrapping it to a new
> line? In the case of X-Face we should also take into account the X-Face
> width and set a right margin to the text, so it doesn't get overlapped
> by the image.
>

By fixing the first problem the space reserved to the headerview->image
is then respected so the overlap does not occur anymore.

> I'll try to cook a patch to fix this, but feel free to anticipate
> me, as I am still studying sylpheed code and GTK+.
>

The following patch, inspired from Claws, is just to show the concept,
the basic idea is realized, but the Cc and Newsgroup labels are still
expanded like they shouldn't when you make the window larger, this is
due to Gtk+ limitations, it does not handle natural size:

diff --git a/src/headerview.c b/src/headerview.c
index 5156099..bbb89ec 100644
--- a/src/headerview.c
+++ b/src/headerview.c
@@ -126,13 +126,22 @@ HeaderView *headerview_create(void)
        gtk_box_pack_start(GTK_BOX(hbox1), from_header_label, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox1), from_body_label, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox1), to_header_label, FALSE, FALSE, 0);
-       gtk_box_pack_start(GTK_BOX(hbox1), to_body_label, FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(hbox1), to_body_label, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(hbox1), cc_header_label, FALSE, FALSE, 0);
-       gtk_box_pack_start(GTK_BOX(hbox1), cc_body_label, FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(hbox1), cc_body_label, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(hbox1), ng_header_label, FALSE, FALSE, 0);
-       gtk_box_pack_start(GTK_BOX(hbox1), ng_body_label, FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(hbox1), ng_body_label, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(hbox2), subject_header_label, FALSE, FALSE, 0);
-       gtk_box_pack_start(GTK_BOX(hbox2), subject_body_label, FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(hbox2), subject_body_label, TRUE, TRUE, 0);
+
+       gtk_misc_set_alignment(GTK_MISC(to_body_label), 0, 0.5);
+       gtk_misc_set_alignment(GTK_MISC(cc_body_label), 0, 0.5);
+       gtk_misc_set_alignment(GTK_MISC(ng_body_label), 0, 0.5);
+       gtk_misc_set_alignment(GTK_MISC(subject_body_label), 0, 0.5);
+       gtk_label_set_ellipsize(GTK_LABEL(to_body_label), PANGO_ELLIPSIZE_END);
+       gtk_label_set_ellipsize(GTK_LABEL(cc_body_label), PANGO_ELLIPSIZE_END);
+       gtk_label_set_ellipsize(GTK_LABEL(ng_body_label), PANGO_ELLIPSIZE_END);
+       gtk_label_set_ellipsize(GTK_LABEL(subject_body_label), PANGO_ELLIPSIZE_END);

        headerview->hbox = hbox;
        headerview->from_header_label    = from_header_label;


the ideal solution would be to use (expand=FALSE, ellipsize=TRUE) like
explained in[1,2] but only in gtk3 they will support this properly.

So for the time being I suggest two solutions:
  1. ignore the problem
  2. rearrange the fields so that ellipsized fields are the last ones on
     a line, maybe putting Cc on another line. I have a question about
     the Newsgroup filed, is it mutually exclusive with To?

Comments? I can send an RFC patch for 2. if there are chances it would
be accepted.

Thanks,
   Antonio Ospite

[1] http://log.ometer.com/2006-10.html#14
[2] http://live.gnome.org/MathiasHasselmann/NewLayoutManager

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://www.sraoss.jp/pipermail/sylpheed/attachments/20100105/10efc935/attachment.bin 


More information about the Sylpheed mailing list