Mercurial > pidgin.yaz
changeset 14846:c7651586e27b
[gaim-migrate @ 17615]
Patch from Richard Nelson (wabz) to fix the blist-width, and do ellipsization in the trees.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sun, 29 Oct 2006 01:32:04 +0000 |
parents | b1650510f4b8 |
children | d478f3853671 |
files | console/gntblist.c console/libgnt/gntbox.c console/libgnt/gnttree.c console/plugins/gnthistory.c |
diffstat | 4 files changed, 23 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/console/gntblist.c Sun Oct 29 00:15:32 2006 +0000 +++ b/console/gntblist.c Sun Oct 29 01:32:04 2006 +0000 @@ -1315,10 +1315,13 @@ } static void -size_changed_cb(GntWidget *w, int width, int height) +size_changed_cb(GntWidget *w, int wi, int h) { + int width, height; + gnt_widget_get_size(w, &width, &height); gaim_prefs_set_int(PREF_ROOT "/size/width", width); gaim_prefs_set_int(PREF_ROOT "/size/height", height); + gnt_tree_set_col_width(GNT_TREE(ggblist->tree), 0, width - 1); } static void @@ -1864,12 +1867,14 @@ ggblist->tree = gnt_tree_new(); GNT_WIDGET_SET_FLAGS(ggblist->tree, GNT_WIDGET_NO_BORDER); - gnt_tree_set_col_width(GNT_TREE(ggblist->tree), 0, 25); gnt_widget_set_size(ggblist->tree, gaim_prefs_get_int(PREF_ROOT "/size/width"), gaim_prefs_get_int(PREF_ROOT "/size/height")); gnt_widget_set_position(ggblist->window, gaim_prefs_get_int(PREF_ROOT "/position/x"), gaim_prefs_get_int(PREF_ROOT "/position/y")); + gnt_tree_set_col_width(GNT_TREE(ggblist->tree), 0, + gaim_prefs_get_int(PREF_ROOT "/size/width") - 1); + gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->tree); ggblist->status = gnt_combo_box_new();
--- a/console/libgnt/gntbox.c Sun Oct 29 00:15:32 2006 +0000 +++ b/console/libgnt/gntbox.c Sun Oct 29 01:32:04 2006 +0000 @@ -704,6 +704,9 @@ GntWidget *wid; int width, height; + if (GNT_WIDGET(box)->parent != NULL) + return; + for (iter = box->list; iter; iter = iter->next) { GntWidget *w = iter->data;
--- a/console/libgnt/gnttree.c Sun Oct 29 00:15:32 2006 +0000 +++ b/console/libgnt/gnttree.c Sun Oct 29 01:32:04 2006 +0000 @@ -200,6 +200,7 @@ const char *text; int len = gnt_util_onscreen_width(col->text, NULL); int fl = 0; + gboolean cut = FALSE; if (i == 0) { @@ -231,13 +232,20 @@ else g_string_append_c(string, '|'); - if (len > tree->columns[i].width) - { - len = tree->columns[i].width; + if (len > tree->columns[i].width) { + len = tree->columns[i].width - 1; + cut = TRUE; + } + text = gnt_util_onscreen_width_to_pointer(col->text, len - fl, NULL); + string = g_string_append_len(string, col->text, text - col->text); + if (cut) { /* ellipsis */ + if (gnt_ascii_only()) + g_string_append_c(string, '~'); + else + string = g_string_append(string, "\342\200\246"); + len++; } - text = gnt_util_onscreen_width_to_pointer(col->text, len - fl, NULL); - string = g_string_append_len(string, col->text, text - col->text); if (len < tree->columns[i].width && iter->next) g_string_append_printf(string, "%*s", tree->columns[i].width - len, ""); } @@ -339,7 +347,6 @@ if ((wr = gnt_util_onscreen_width(str, NULL)) > scrcol) { - /* XXX: ellipsize */ char *s = (char*)gnt_util_onscreen_width_to_pointer(str, scrcol, &wr); *s = '\0'; }