Mercurial > pidgin
changeset 15971:05d347516fcd
Fine tune column hiding.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 30 Mar 2007 06:47:54 +0000 |
parents | 790d1d003825 |
children | 5eb0621e0760 |
files | finch/libgnt/gnttree.c |
diffstat | 1 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/finch/libgnt/gnttree.c Fri Mar 30 05:32:40 2007 +0000 +++ b/finch/libgnt/gnttree.c Fri Mar 30 06:47:54 2007 +0000 @@ -223,6 +223,10 @@ GList *iter; int i; gboolean notfirst = FALSE; + int lastvisible = tree->ncol; + + while (lastvisible && tree->columns[lastvisible].invisible) + lastvisible--; for (i = 0, iter = row->columns; i < tree->ncol && iter; i++, iter = iter->next) { @@ -231,10 +235,16 @@ int len = gnt_util_onscreen_width(col->text, NULL); int fl = 0; gboolean cut = FALSE; + int width; if (tree->columns[i].invisible) continue; + if (i == lastvisible) + width = GNT_WIDGET(tree)->priv.width - gnt_util_onscreen_width(string->str, NULL); + else + width = tree->columns[i].width; + if (i == 0) { if (row->choice) @@ -269,8 +279,8 @@ notfirst = TRUE; - if (len > tree->columns[i].width) { - len = tree->columns[i].width - 1; + if (len > width) { + len = width - 1; cut = TRUE; } text = gnt_util_onscreen_width_to_pointer(col->text, len - fl, NULL); @@ -284,7 +294,7 @@ } if (len < tree->columns[i].width && iter->next) - g_string_append_printf(string, "%*s", tree->columns[i].width - len, ""); + g_string_append_printf(string, "%*s", width - len, ""); } return g_string_free(string, FALSE); }