From: <sa...@us...> - 2007-03-30 06:48:35
|
Revision: 18221 http://svn.sourceforge.net/gaim/?rev=18221&view=rev Author: sadrul Date: 2007-03-29 23:48:32 -0700 (Thu, 29 Mar 2007) Log Message: ----------- Fine tune column hiding. Modified Paths: -------------- trunk/console/libgnt/gnttree.c Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2007-03-30 05:49:39 UTC (rev 18220) +++ trunk/console/libgnt/gnttree.c 2007-03-30 06:48:32 UTC (rev 18221) @@ -223,7 +223,11 @@ 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) { GntTreeCol *col = iter->data; @@ -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); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |